ORACLE数字转换人民币大写
ORACLE 数字转换人民币大写
示例.
数字 :183066999230.68
人民币大写 :壹仟捌佰参拾亿陆仟陆佰玖拾玖万玖仟贰佰参拾圆陆角捌分
数字 :999900000000
人民币大写 :玖仟玖佰玖拾玖亿圆整
Step 1. Create Lookups: CUX_CNY_DICTIONARY
(N) Application Developer > Application > Lookups > Application Object Library

|
Application Object Library Lookups |
||||||||
|
Type |
CUX_CNY_DICTIONARY |
Access Level
|
||||||
|
Meaning |
CUX_CNY_DICTIONARY |
|||||||
|
Application |
Application Object Library |
|||||||
|
Description |
CNY character translation |
|||||||
|
Code |
Meaning |
Description |
Tag |
From |
To |
Enabled |
[ ] |
|
0 |
零 |
|
|
|
|
* |
|
|
1 |
壹 |
|
|
|
|
* |
|
|
2 |
贰 |
|
|
|
|
* |
|
|
3 |
参 |
|
|
|
|
* |
|
|
4 |
肆 |
|
|
|
|
* |
|
|
5 |
伍 |
|
|
|
|
* |
|
|
6 |
陆 |
|
|
|
|
* |
|
|
7 |
染 |
|
|
|
|
* |
|
|
8 |
捌 |
|
|
|
|
* |
|
|
9 |
玖 |
|
|
|
|
* |
|
|
Q |
仟 |
|
|
|
|
* |
|
|
B |
佰 |
|
|
|
|
* |
|
|
S |
拾 |
|
|
|
|
* |
|
|
Y |
亿 |
|
|
|
|
* |
|
|
W |
万 |
|
|
|
|
* |
|
|
U |
圆 |
|
|
|
|
* |
|
|
Z |
整 |
|
|
|
|
* |
|
|
J |
角 |
|
|
|
|
* |
|
|
F |
分 |
|
|
|
|
* |
|
Step 2. Create Function: CUX_CONVERT_CNY
create or replace function cux_convert_cny(num in number) return varchar2
is
l_receive_number number(14,2);
l_number varchar2(100);
l_num_length number;
l_unit varchar2(100) := 'QBSGYQBSGWQBSG.JF';
l_cny varchar2(200);
l_trans_cny varchar2(200);
function translater(transNum in varchar2) return varchar2
is
l_meaning varchar2(80);
begin
select flv.meaning
into l_meaning
from fnd_lookup_values_vl flv
where 1 = 1
and flv.enabled_flag = 'Y'
and sysdate between nvl (flv.start_date_active, sysdate)
and nvl (flv.end_date_active, sysdate + 1)
and flv.lookup_code = transNum
and flv.lookup_type = 'CUX_CNY_DICTIONARY'
and flv.view_application_id = 0
and flv.security_group_id = 0;
return l_meaning;
end translater;
begin
--checking input number throw exception
select decode(num, 0, 'x', num) into l_receive_number from dual;
l_number := trim(to_char(l_receive_number, '9999,9999,9999.99'));
l_num_length := length(l_number);
--linking number and unit
for numIndex in 1..l_num_length loop
l_cny := l_cny || (substr(l_number, numIndex, 1) || substr(l_unit, -(l_num_length-numIndex+1), 1));
end loop;
--replace symbol
select regexp_replace(l_cny, ',|\.', '') into l_cny from dual;
--insert UZ to 0J0F
select regexp_replace(l_cny, '(0J0F)', 'UZ') into l_cny from dual;
--insert U to xJxF
select regexp_replace(l_cny, '([0-9]J[0-9]F)', 'U\1') into l_cny from dual;
--replace more zero to blank
select regexp_replace(l_cny, '(0Q0B0S0GW)|(0Q0B0S0G)|(0B0S0G)|(0S0G)|(0G)|(G)|(0J)|(0F)', '') into l_cny from dual;
--replace more zero to zero
select regexp_replace(l_cny, '(0Q0B0S)|(0Q0B)|(0Q)|(0B)|(0S)', '0') into l_cny from dual;
--translation
for transIndex in 1..length(l_cny) loop
l_trans_cny := l_trans_cny || translater(substr(l_cny,transIndex, 1));
end loop;
return l_trans_cny;
exception when others
then
fnd_file.put_line (fnd_file.output, sqlcode);
fnd_file.put_line (fnd_file.output, sqlerrm);
end;
Step 3. Apply Function: CUX_CONVERT_CNY
select cux_convert_cny (183066999230.68) cny from dual;

select cux_convert_cny (999900000000) cny from dual;

|
Author |
若愚 |
|
Creation Date |
November 4, 2014 |
|
Last Updated |
November 4, 2014 |
|
Version |
V1411.2 |
ORACLE数字转换人民币大写的更多相关文章
- 数字转人民币大写(SQL SERVER)
--数字转人民币大写NumToRMB ---新建方法create FUNCTION dbo.NumToRMB (@num numeric(14,5)) RETURNS varchar(100) ...
- sql 数字转人民币大写函数(两种方法)
,)) returns @rmb table( 亿 ) ,仟万 ) ,佰万 ) ,拾万 ) ,万 ) ,仟 ) ,佰 ) ,拾 ) ,元 ) ,角 ) ,分 )) as begin insert in ...
- js将数字转换成大写的人民币表达式
function changeNumMoneyToChinese(money) { var cnNums = new Array("零", "壹", " ...
- C# 数字转换成大写
/// <summary> /// 数字转大写 /// </summary> /// <param name="Num">数字</para ...
- 【PHP】金额数字转换成大写形式
<?php /*将数字金额转成大写*/ function num_to_upper($num) { $d = array('零','壹','贰','叁','肆','伍','陆','柒','捌', ...
- 实现数字转换RMB大写~
实现的功能是将数字“673”转换成“陆佰柒拾叁” “3681”转换成“叁仟陆佰捌拾壹” “8007”转换成“捌仟零柒” 主要使用了数组和循环来实现 代码雏形 package com.te ...
- PHP实现金额数字转换成大写函数
<?php header("Content-Type:text/html;charset=utf-8"); function num_to_upper($num) { $d ...
- 一个用php写的人民币数字转人民币大写的函数
function num2rmb ($num) { $c1 = "零壹贰叁肆伍陆柒捌玖"; $c2 = "分角元拾佰仟万拾佰仟亿"; ...
- php数字转人民币金额大写
numToRmb.php <?php header("content-type:text/html;charset=utf-8"); function numToRmb($n ...
随机推荐
- 安装"MySQLdb"一波三折.
在慕课网学习课程"Python操作MySQL数据库",安装"MySQLdb"时遇到问题. 先是找错地方: 百度搜索"Mysql for Python& ...
- 查内网虚拟机映射的公网IP
1.访问ip138.com 2.curl ifconfig.me
- bzoj1231: [Usaco2008 Nov]mixup2 混乱的奶牛
思路:状压dp,设f[i][j]表示当前已经选出的牛的状态为i,最后一头选出的牛为j的方案数. 然后注意就是初值不能是f[0][i]=1,因为所有牛本来都可以第一个被选中,然而这样一定初值有些牛可能就 ...
- ubuntu vim 插件安装
参考:http://blog.sina.com.cn/s/blog_00f0230d0100y7ih.html 不过由于时间久远,有些已经失效,以上是我的修改过程 参考:https://github. ...
- Linux网络
netstat 查看网络状态 netstat: -r :显示路由表 -n: 以数字方式显示 -u: 显示UDP连接 -t :显示TCP连接 -l:显示监听状态的连接 -p: 显示监听指定套接字的进程的 ...
- tmux与vim主题不一致
在centos6.5 x64 vim6.2 需要在tmux.conf中添加set -g default-terminal "screen-256color" 然后再次启动tmux的 ...
- thinkphp分页格式的完全自定义,直接输入数字go到输入数字页
实现分页效果如下: 以下标注红色字体的为重点 找到文件page.class.php在ThinkPHP/Library/Thinkpage.class.php并打开文件,复制函数show,在本文件中 ...
- Sublime Text 3 LESS、SASS、SCSS高亮插件、提示插件
为sublime text 添加LESS语法高亮 功能:LESS高亮插件 下载 https://packagecontrol.io/packages/LESS 简介:用LESS的同学都知道,s ...
- 关于mac上的homebrew
首先它的安装指令并不难: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/ ...
- 如何在django的filter中传递字符串变量作为查询条件(动态改变查询条件)
一般来说在需要查询数据的时候都是以下形式 ret=Articles.objects.filter(id=1) 然而如果要动态的改变查询的条件怎么办呢? 如下代码 def getModelResult( ...