马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
由于MySQL数据库已经如此普及,对企业来说它无疑是一个更好的选择。oracle
怎样在ORACLE中F国民年夜的DQ
作者:CCBZZP
ORACLE在F蟊淼墓δ苁呛年夜的,特e在F的弥经常使用到国民巨细DQ的},在此我函迪虼蠹液谓榻B一下,但愿和人人一同探,以便配合M步!配合l展!
1.函DX_MONEY()
CREATEFUNCTIONDX_MONEY
(
MONEYINNUMBER
)
RETURNVARCHAR2ASV_MONEYVARCHAR2(150);
RV_MONEY0VARCHAR2(20);
RV_MONEY1VARCHAR2(4);
RV_MONEY2VARCHAR2(4);
V_MONEY0VARCHAR2(20);
V_MONEY1VARCHAR2(4);
V_MONEY2VARCHAR2(4);
V_MONEY3VARCHAR2(4);
V_MONEY4VARCHAR2(4);
V_MONEY5VARCHAR2(4);
V_MONEY6VARCHAR2(4);
V_MONEY7VARCHAR2(4);
V_MONEY8VARCHAR2(4);
V_MONEY9VARCHAR2(4);
V_MONEY10VARCHAR2(4);
V_MONEY11VARCHAR2(4);
V_MONEY12VARCHAR2(4);
RPV_MONEY1VARCHAR2(4);
RPV_MONEY2VARCHAR2(4);
PV_MONEY0VARCHAR2(14);
PV_MONEY1VARCHAR2(4);
PV_MONEY2VARCHAR2(4);
PV_MONEY3VARCHAR2(4);
PV_MONEY4VARCHAR2(4);
PV_MONEY5VARCHAR2(4);
PV_MONEY6VARCHAR2(4);
PV_MONEY7VARCHAR2(4);
PV_MONEY8VARCHAR2(4);
PV_MONEY9VARCHAR2(4);
PV_MONEY10VARCHAR2(4);
PV_MONEY11VARCHAR2(4);
PV_MONEY12VARCHAR2(4);
BEGIN
V_MONEY0:=LTRIM(RTRIM(TO_CHAR(FLOOR(MONEY))));
RV_MONEY0:=LTRIM(RTRIM(TO_CHAR(FLOOR(MONEY*100))));
RV_MONEY1:=SUBSTR(RV_MONEY0,LENGTH(RV_MONEY0),1);
IFLENGTH(RV_MONEY0)>1THEN
RV_MONEY2:=SUBSTR(RV_MONEY0,LENGTH(RV_MONEY0)-1,1);
ELSE
RV_MONEY2:=0;
ENDIF;
V_MONEY1:=SUBSTR(V_MONEY0,LENGTH(V_MONEY0),1);
IFLENGTH(V_MONEY0)-1>0THEN
V_MONEY2:=SUBSTR(V_MONEY0,LENGTH(V_MONEY0)-1,1);
ELSEV_MONEY2:=0;
ENDIF;
IFLENGTH(V_MONEY0)-2>0THEN
V_MONEY3:=SUBSTR(V_MONEY0,LENGTH(V_MONEY0)-2,1);
ELSEV_MONEY3:=0;
ENDIF;
IFLENGTH(V_MONEY0)-3>0THEN
V_MONEY4:=SUBSTR(V_MONEY0,LENGTH(V_MONEY0)-3,1);
ELSEV_MONEY4:=0;
ENDIF;
IFLENGTH(V_MONEY0)-4>0THEN
V_MONEY5:=SUBSTR(V_MONEY0,LENGTH(V_MONEY0)-4,1);
ELSEV_MONEY5:=0;
ENDIF;
IFLENGTH(V_MONEY0)-5>0THEN
V_MONEY6:=SUBSTR(V_MONEY0,LENGTH(V_MONEY0)-5,1);
ELSEV_MONEY6:=0;
ENDIF;
IFLENGTH(V_MONEY0)-6>0THEN
V_MONEY7:=SUBSTR(V_MONEY0,LENGTH(V_MONEY0)-6,1);
ELSEV_MONEY7:=0;
ENDIF;
IFLENGTH(V_MONEY0)-7>0THEN
V_MONEY8:=SUBSTR(V_MONEY0,LENGTH(V_MONEY0)-7,1);
ELSEV_MONEY8:=0;
ENDIF;
IFLENGTH(V_MONEY0)-8>0THEN
V_MONEY9:=SUBSTR(V_MONEY0,LENGTH(V_MONEY0)-8,1);
ELSEV_MONEY9:=0;
ENDIF;
IFLENGTH(V_MONEY0)-9>0THEN
V_MONEY10:=SUBSTR(V_MONEY0,LENGTH(V_MONEY0)-9,1);
ELSEV_MONEY10:=0;
ENDIF;
IFLENGTH(V_MONEY0)-10>0THEN
V_MONEY11:=SUBSTR(V_MONEY0,LENGTH(V_MONEY0)-10,1);
ELSEV_MONEY11:=0;
ENDIF;
IFLENGTH(V_MONEY0)-11>0THEN
V_MONEY12:=SUBSTR(V_MONEY0,LENGTH(V_MONEY0)-11,1);
ELSEV_MONEY12:=0;
ENDIF;
selectDECODE(RV_MONEY1,0,零分,1,壹分,2,E分,3,⒎,4,肆分,5,伍分,
6,分,7,柒分,8,扒分,9,玖分)intorpv_money1fromdual;
selectDECODE(RV_MONEY2,0,零角,1,壹角,2,E角,3,⒔,4,肆角,5,伍角,
6,角,7,柒角,8,扒角,9,玖角)intorpv_money2fromdual;
selectDECODE(V_MONEY1,0,元,1,壹元,2,E元,3,⒃,4,肆元,5,伍元,
6,元,7,柒元,8,扒元,9,玖元)intopv_money1fromdual;
selectDECODE(V_MONEY2,0,,1,壹拾,2,E拾,3,⑹,4,肆拾,5,伍拾,
6,拾,7,柒拾,8,扒拾,9,玖拾)intopv_money2fromdual;
selectDECODE(V_MONEY3,0,,1,壹佰,2,E佰,3,,4,肆佰,5,伍佰,
6,佰,7,柒佰,8,扒佰,9,玖佰)intopv_money3fromdual;
selectDECODE(V_MONEY4,0,,1,壹仟,2,E仟,3,⑶,4,肆仟,5,伍仟,
6,仟,7,柒仟,8,扒仟,9,玖仟)intopv_money4fromdual;
selectDECODE(V_MONEY5,0,f,1,壹f,2,Ef,3,⑷f,4,肆f,5,伍f,
6,f,7,柒f,8,扒f,9,玖f)intopv_money5fromdual;
selectDECODE(V_MONEY6,0,,1,壹拾,2,E拾,3,⑹,4,肆拾,5,伍拾,
6,拾,7,柒拾,8,扒拾,9,玖拾)intopv_money6fromdual;
selectDECODE(V_MONEY7,0,,1,壹佰,2,E佰,3,,4,肆佰,5,伍佰,
6,佰,7,柒佰,8,扒佰,9,玖佰)intopv_money7fromdual;
selectDECODE(V_MONEY8,0,,1,壹仟,2,E仟,3,⑶,4,肆仟,5,伍仟,
6,仟,7,柒仟,8,扒仟,9,玖仟)intopv_money8fromdual;
selectDECODE(V_MONEY9,0,|,1,壹|,2,E|,3,|,4,肆|,5,伍|,
6,|,7,柒|,8,扒|,9,玖|)intopv_money9fromdual;
selectDECODE(V_MONEY10,0,,1,壹拾,2,E拾,3,⑹,4,肆拾,5,伍拾,
6,拾,7,柒拾,8,扒拾,9,玖拾)intopv_money10fromdual;
selectDECODE(V_MONEY11,0,,1,壹佰,2,E佰,3,,4,肆佰,5,伍佰,
6,佰,7,柒佰,8,扒佰,9,玖佰)intopv_money11fromdual;
selectDECODE(V_MONEY12,0,,1,壹仟,2,E仟,3,⑶,4,肆仟,5,伍仟,
6,仟,7,柒仟,8,扒仟,9,玖仟)intopv_money12fromdual;
V_MONEY:=PV_MONEY12||PV_MONEY11||PV_MONEY10||PV_MONEY9||PV_MONEY8||
PV_MONEY7||PV_MONEY6||PV_MONEY5||PV_MONEY4||PV_MONEY3||PV_MONEY2||PV_MONEY1||
RPV_MONEY2||RPV_MONEY1;
RETURN(V_MONEY);
END;
2.绦r以下:
SQL*Plus:Release9.2.0.1.0-Productionon礼拜二7月2915:03:362003
Copyright(c)1982,2002,OracleCorporation.Allrightsreserved.
B到:
Oracle8iEnterpriseEditionRelease8.1.6.1.0-Production
WiththePartitioningoption
JServerRelease8.1.6.0.0-Production
SQL>selectdx_money(324450567.89)fromdual;
DX_MONEY(324450567.89)
--------------------------------------------------------------------------------
|E仟肆佰肆拾伍f伍佰拾柒元扒角玖分
3.本例的最年夜底999999999999.99
4.以上函的比^我锥,Z法上纷歧定精,g迎人人一同探!
为维持生产环境和非生产环境需要不断地投入管理支持费用MySQL学习教程,最终导致客户为数据库资源投入巨额成本。 |