|
|
用户名:darkseven 笔名:seven 地区: 行业:其他 |
| 日 | 一 | 二 | 三 | 四 | 五 | 六 |
darkseven's工作文档
(作者置顶)
刚做的半成品
CREATE OR REPLACE PROCEDURE NLY_RATEPLAN_CHCEK_P AS
-- rateplanid VARCHAR2(30); --id
-- result VARCHAR2(30); --说明
-- billingrateplanid VARCHAR2(30); --计费模版id
--取原始数据
CURSOR c_origin_data IS
SELECT *
FROM nly_rateplancheck_Origindata_t;
--临时存放游标取出的数据
temp_origin_data c_origin_data%ROWTYPE;
BEGIN
EXECUTE IMMEDIATE 'truncate table NLY_rateplan_check_RESULT_T';
for temp_origin_data in c_origin_data loop
nly_RATEPLAN_ISBILLINGDO_p(temp_origin_data);
-- nly_RATEPLAN_ISPRESTORE_p(temp_origin_data);
if temp_origin_data.RPTYPEKEY='24' then
nly_RATEPLAN_RPTYPEKEY24_p(temp_origin_data);
end if;
if temp_origin_data.RPTYPEKEY='26' then
nly_RATEPLAN_RPTYPEKEY26_p(temp_origin_data);
end if;
if temp_origin_data.billingunitid='6214100912' then
nly_RATEPLAN_6214100912_p(temp_origin_data);
end if;
if temp_origin_data.billingunitid in ('6214100847','6214100851','6214100853','6214100857',
'6214100859','6214100861','6214100863','6214100865',
'6214100867','6214100869','6214100871','6214100873',
'6214100886','6214100916','6214100918','6214100936',
'6214100938')
then
nly_RATEPLAN_114PRESTORE_p(temp_origin_data);
end if;
/* C(temp_origin_data);
C(temp_origin_data);
C(temp_origin_data);
C(temp_origin_data);
C(temp_origin_data);*/
END LOOP;
end NLY_RATEPLAN_CHCEK_P;
==============================================
CREATE OR REPLACE PROCEDURE nly_RATEPLAN_114PRESTORE_p
(RATEPLAN_related nly_rateplancheck_Origindata_t%ROWTYPE) as
--变量
BEGIN
case RATEPLAN_related.billingunitid
when '6214100847' then
if NVL(RATEPLAN_related.ACCOUNTITEMTYPE,'-1')!='381020590' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'账目项不对');
end if;
when '6214100851' then
if NVL(RATEPLAN_related.ACCOUNTITEMTYPE,'-1')!='381020650' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'账目项不对');
end if;
when '6214100853' then
if NVL(RATEPLAN_related.ACCOUNTITEMTYPE,'-1')!='381020630' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'账目项不对');
end if;
when '6214100857' then
if NVL(RATEPLAN_related.ACCOUNTITEMTYPE,'-1')!='381020600' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'账目项不对');
end if;
when '6214100859' then
if NVL(RATEPLAN_related.ACCOUNTITEMTYPE,'-1')!='381020610' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'账目项不对');
end if;
when '6214100861' then
if NVL(RATEPLAN_related.ACCOUNTITEMTYPE,'-1')!='381020620' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'账目项不对');
end if;
when '6214100863' then
if NVL(RATEPLAN_related.ACCOUNTITEMTYPE,'-1')!='381020660' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'账目项不对');
end if;
when '6214100865' then
if NVL(RATEPLAN_related.ACCOUNTITEMTYPE,'-1')!='381020670' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'账目项不对');
end if;
when '6214100867' then
if NVL(RATEPLAN_related.ACCOUNTITEMTYPE,'-1')!='381020690' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'账目项不对');
end if;
when '6214100869' then
if NVL(RATEPLAN_related.ACCOUNTITEMTYPE,'-1')!='381020700' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'账目项不对');
end if;
when '6214100871' then
if NVL(RATEPLAN_related.ACCOUNTITEMTYPE,'-1')!='381020710' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'账目项不对');
end if;
when '6214100873' then
if NVL(RATEPLAN_related.ACCOUNTITEMTYPE,'-1')!='381020640' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'账目项不对');
end if;
when '6214100886' then
if NVL(RATEPLAN_related.ACCOUNTITEMTYPE,'-1')!='381020720' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'账目项不对');
end if;
when '6214100916' then
if NVL(RATEPLAN_related.ACCOUNTITEMTYPE,'-1')!='381020750' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'账目项不对');
end if;
when '6214100918' then
if NVL(RATEPLAN_related.ACCOUNTITEMTYPE,'-1')!='381020760' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'账目项不对');
end if;
when '6214100936' then
if NVL(RATEPLAN_related.ACCOUNTITEMTYPE,'-1')!='381020790' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'账目项不对');
end if;
when '6214100938' then
if NVL(RATEPLAN_related.ACCOUNTITEMTYPE,'-1')!='381020800' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'账目项不对');
end if;
end case;
end nly_RATEPLAN_114PRESTORE_p;
======================================
CREATE OR REPLACE PROCEDURE nly_RATEPLAN_6214100912_p
(RATEPLAN_related nly_rateplancheck_Origindata_t%ROWTYPE) as
--变量
BEGIN
if NVL(RATEPLAN_related.ACCOUNTITEMTYPE,'-1')!='帐户级分期预存款' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'账目项1不对');
end if;
if NVL(RATEPLAN_related.Secondparam,'-1')!='2' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'预存款参数2位置不对');
end if;
if NVL(RATEPLAN_related.Secondeaccounttype,'-1')!='帐户级预存款' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'账目项2不对');
end if;
if NVL(RATEPLAN_related.Secondisinvoice,'-1')!='1'
or NVL(RATEPLAN_related.Secondisinvoice,'-1')!='2' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'SECONDISINVOICE不对');
end if;
end nly_RATEPLAN_6214100912_p;
=====================================
CREATE OR REPLACE PROCEDURE nly_RATEPLAN_ISBILLINGDO_p
(RATEPLAN_related nly_rateplancheck_Origindata_t%ROWTYPE) as
--变量
BEGIN
if RATEPLAN_related.ISBILLINGIMPLKEY='1' then
if RATEPLAN_related.EXPTIME!='0' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'EXPTIM应该为0');
end if;
if RATEPLAN_related.OFFSETMONTH!='0' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'OFFSETMONTH应该为0');
end if;
if RATEPLAN_related.EFFECTIVEOFFSETMONTH!='0' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'EFFECTIVEOFFSETMONTH应该为0');
end if;
else
if RATEPLAN_related.EXPTIME='0' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'EXPTIM不应该为0');
end if;
if RATEPLAN_related.billingunitid != '6219100037' then
if RATEPLAN_related.OFFSETMONTH='0' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'OFFSETMONTH不应该为0');
end if;
end if;
if RATEPLAN_related.billingunitid != '6219100037' then
if RATEPLAN_related.EFFECTIVEOFFSETMONTH='0' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'EFFECTIVEOFFSETMONTH不应该为0');
end if;
end if;
end if;
end nly_RATEPLAN_ISBILLINGDO_p;
========================================
CREATE OR REPLACE PROCEDURE nly_RATEPLAN_ISPRESTORE_p
(RATEPLAN_related nly_rateplancheck_Origindata_t%ROWTYPE) as
--变量
BEGIN
if instr(RATEPLAN_related.XX,'预') then
if RATEPLAN_related.billingrateplanid != '6214100009' then --如果能查询模版信息,可以这样判断是否是需要预存款的
if RATEPLAN_related.PRESTORE='0' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'PRESTORE不应该为0');
end if;
if RATEPLAN_related.ACCOUNTITEMTYPE='0' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'ACCOUNTITEMTYPE不应该为0');
end if;
if RATEPLAN_related.ISINVOICE='0' then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'ISINVOICE不应该为0');
end if;
end if;
end if;
end nly_RATEPLAN_ISPRESTORE_p;
=====================================
CREATE OR REPLACE PROCEDURE nly_RATEPLAN_logresult_p
(RATEPLAN_related nly_rateplancheck_Origindata_t%ROWTYPE,
RESULT_CONTENT nly_rateplancheck_Origindata_t.Servicetypes%TYPE
)
as
-- rateplanid VARCHAR2(30); --id
-- result VARCHAR2(60); --说明
-- billingrateplanid VARCHAR2(30); --计费模版id
region_id VARCHAR2(30); --申报地市
BEGIN
region_id:=substr(RATEPLAN_related.BUSINESSAREA,1,4);
INSERT INTO NLY_rateplan_check_RESULT_T VALUES (RATEPLAN_related.id, RESULT_CONTENT,RATEPLAN_related.billingunitid,region_id);
COMMIT;
end nly_RATEPLAN_logresult_p;
====================================
CREATE OR REPLACE PROCEDURE nly_RATEPLAN_RPTYPEKEY24_p
(RATEPLAN_related nly_rateplancheck_Origindata_t%ROWTYPE) as
--变量
BEGIN
if RATEPLAN_related.billingunitid='6216100004' then
if
ABS(to_number(RATEPLAN_related.PARAM3)+to_number(RATEPLAN_related.PARAM4)
+to_number(RATEPLAN_related.PARAM5)+to_number(RATEPLAN_related.PARAM6)
+to_number(RATEPLAN_related.PARAM7)+to_number(RATEPLAN_related.PARAM8)-1)<=0.02
then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'分摊比例值之和不合理');
end if;
elsif RATEPLAN_related.billingunitid='6216100034' then
if
ABS(to_number(RATEPLAN_related.PARAM3)+to_number(RATEPLAN_related.PARAM4)
+to_number(RATEPLAN_related.PARAM5)+to_number(RATEPLAN_related.PARAM6)
+to_number(RATEPLAN_related.PARAM7)+to_number(RATEPLAN_related.PARAM8)
+to_number(RATEPLAN_related.PARAM9)-1)<=0.02
then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'分摊比例值之和不合理');
end if;
elsif RATEPLAN_related.billingunitid='6216100035' then
if
ABS(to_number(RATEPLAN_related.PARAM3)+to_number(RATEPLAN_related.PARAM4)
+to_number(RATEPLAN_related.PARAM5)+to_number(RATEPLAN_related.PARAM6)
+to_number(RATEPLAN_related.PARAM7)+to_number(RATEPLAN_related.PARAM8)
+to_number(RATEPLAN_related.PARAM9)+to_number(RATEPLAN_related.PARAM10)-1)<=0.02
then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'分摊比例值之和不合理');
end if;
end if;
end nly_RATEPLAN_RPTYPEKEY24_p;
==============================================
CREATE OR REPLACE PROCEDURE nly_RATEPLAN_RPTYPEKEY26_p
(RATEPLAN_related nly_rateplancheck_Origindata_t%ROWTYPE) as
--变量
BEGIN
if RATEPLAN_related.billingunitid='6216100032' then
if
ABS(to_number(RATEPLAN_related.PARAM2)+to_number(RATEPLAN_related.PARAM3)
+to_number(RATEPLAN_related.PARAM4)+to_number(RATEPLAN_related.PARAM5)
+to_number(RATEPLAN_related.PARAM6)+to_number(RATEPLAN_related.PARAM7)-1)<=0.02
then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'分摊比例值之和不合理');
end if;
elsif RATEPLAN_related.billingunitid='6216100040' then
if
ABS(to_number(RATEPLAN_related.PARAM3)+to_number(RATEPLAN_related.PARAM4)
+to_number(RATEPLAN_related.PARAM5)+to_number(RATEPLAN_related.PARAM6)
+to_number(RATEPLAN_related.PARAM7)+to_number(RATEPLAN_related.PARAM2)-1)<=0.02
then
nly_RATEPLAN_logresult_p(RATEPLAN_related,'分摊比例值之和不合理');
end if;
end if;
end nly_RATEPLAN_RPTYPEKEY26_p;
==============================================
CREATE OR REPLACE PROCEDURE NLY_TEST_P AS
rateplanid VARCHAR2(30); --id
result VARCHAR2(30); --说明
-- billingrateplanid VARCHAR2(30); --计费模版id
-- paramcount NUMBER(2); --参数个数
--取原始数据
CURSOR c_origin_data IS
SELECT *
FROM nly_rateplancheck_initial_t;
--临时存放游标取出的数据
temp_origin_data c_origin_data%ROWTYPE;
BEGIN
--open c_origin_data
--while c_origin_data%FOUND LOOP
for temp_origin_data in c_origin_data loop
-- temp_origin_data.billingrateplanid:=c_origin_data.billingrateplanid;
-- temp_origin_data.paramcount:=c_origin_data.paramcount;
if temp_origin_data.billingrateplanid='6212100002' then
if temp_origin_data.paramcount=1 then
rateplanid:=temp_origin_data.rateplanid;
result:='ok';
else
rateplanid:=temp_origin_data.rateplanid;
result:='参数个数不对';
END IF;
INSERT INTO nly_result_t VALUES (rateplanid, result,'');
COMMIT;
ELSIF temp_origin_data.billingrateplanid='6212100005' then
if temp_origin_data.param1=78 then
rateplanid:=temp_origin_data.rateplanid;
result:='ok';
else
rateplanid:=temp_origin_data.rateplanid;
result:='参数1值不对';
END IF;
INSERT INTO nly_result_t VALUES (rateplanid, result,'');
COMMIT;
else
rateplanid:=temp_origin_data.rateplanid;
result:='不参与校验';
INSERT INTO nly_result_t VALUES (rateplanid, result,'');
COMMIT;
end if;
/*case substr(temp_origin_data.rateplanid,1,1)
when '1' then
result:='11';
INSERT INTO nly_result_t(rateplanid,result_content) VALUES (temp_origin_data.rateplanid, result);
COMMIT;
when '2' then
result:='13';
INSERT INTO nly_result_t(rateplanid,result_content) VALUES (temp_origin_data.rateplanid, result);
COMMIT;
else
result:='19';
INSERT INTO nly_result_t(rateplanid,result_content) VALUES (temp_origin_data.rateplanid, result);
COMMIT;
end case;*/
END LOOP;
end NLY_TEST_P;
============================================
oracle 存储过程的基本语法
oracle 存储过程的基本语法
1.基本结构
CREATE OR REPLACE PROCEDURE 存储过程名字
(
参数1 IN NUMBER,
参数2 IN NUMBER
) IS
变量1 INTEGER :=0;
变量2 DATE;
BEGIN
END 存储过程名字
2.SELECT INTO STATEMENT
将select查询的结果存入到变量中,可以同时将多个列存储多个变量中,必须有一条
记录,否则抛出异常(如果没有记录抛出NO_DATA_FOUND)
例子:
BEGIN
SELECT col1,col2 into 变量1,变量2 FROM typestruct where xxx;
EXCEPTION
WHEN NO_DATA_FOUND THEN
xxxx;
END;
...
3.IF 判断
IF V_TEST=1 THEN
BEGIN
do something
END;
END IF;
4.while 循环
WHILE V_TEST=1 LOOP
BEGIN
XXXX
END;
END LOOP;
5.变量赋值
V_TEST := 123;
6.用for in 使用cursor
...
IS
CURSOR cur IS SELECT * FROM xxx;
BEGIN
FOR cur_result in cur LOOP
BEGIN
V_SUM :=cur_result.列名1+cur_result.列名2
END;
END LOOP;
END;
7.带参数的cursor
CURSOR C_USER(C_ID NUMBER) IS SELECT NAME FROM USER WHERE TYPEID=C_ID;
OPEN C_USER(变量值);
LOOP
FETCH C_USER INTO V_NAME;
EXIT FETCH C_USER%NOTFOUND;
do something
END LOOP;
CLOSE C_USER;
8.用pl/sql developer debug
连接数据库后建立一个Test WINDOW
在窗口输入调用SP的代码,F9开始debug,CTRL+N单步调试
史诗任务(最后的陨落)
猎人单刷厄运大树
经典遗言
1、三国周渝:既生渝,何生亮?
狍鸮
2、西楚霸王项羽:时不利兮骓不逝,虞姬虞姬奈若何?
3、戊戌六君子之谭嗣同:有心杀贼,无力回天!
4、宋代诗人陆游:王师北定中原日,家祭勿忘告乃翁。
5、革命领袖孙文:革命尚未成功,同志仍需努力。
6、宋代爱国名士文天详 :人生自古谁无死,留取丹心照汗青?
7、伟大的爱国者屈原:举世皆浊我独清,众人皆醉我独醒。
8、三十年代影星阮玲玉:不死不足以明我冤!
9、革命烈士夏明翰: 杀了我一个,还有后来人。
特别奖:这草有毒! (神农氏)
此外,民间还流传着不少脍炙人口大家耳熟能详的遗言:
1、十八年后老子又是一条好汉!
2、人死不过头点地 !
3、要杀要剐悉听尊便,动手吧!
4、这是我的党费!
5、孩子!不要报仇!!
6、老婆!我死了以后你就改嫁吧!
7、我觉得我还可以抢救一下!
老人安养院墙上发现的一篇文章
vba-find方法的使用
在区域中查找特定信息,并返回 Range 对象,该对象代表用于查找信息的第一个单元格。如果未发现匹配单元格,就返回 Nothing。本方法不影响选定区域或活动单元格。
有关在 Visual Basic 中使用 Find 工作表函数的详细信息,请参阅在 Visual Basic 中使用工作表函数。
expression.Find(What, After, LookIn, LookAt, SearchOrder, SearchDirection, MatchCase, MatchByte, SerchFormat)
expression 必需。该表达式返回一个 Range 对象。
What Variant 类型,必需。要搜索的数据。可为字符串或任意 Microsoft Excel 数据类型。
After Variant 类型,可选。表示搜索过程将从其之后开始进行的单元格。此单元格对应于从用户界面搜索时的活动单元格位置。值得注意的是,After 必须是区域中的单个单元格。请记住搜索是从该单元格之后 开始的;直到本方法绕回到指定的单元格时,才对其进行搜索。如果未指定本参数,搜索将从区域的左上角单元格之后开始。
LookIn Variant 类型,可选。信息类型。
LookAt Variant 类型,可选。可为以下 XlLookAt 常量之一:xlWhole 或 xlPart。
SearchOrder Variant 类型,可选。可为以下 XlSearchOrder 常量之一:xlByRows 或 xlByColumns。
SearchDirection XlSearchDirection 类型,可选。搜索的方向。
XlSearchDirection 可为以下 XlSearchDirection 常量之一。
xlNext 默认值
xlPrevious
MatchCase Variant 类型,可选。若为 True,则进行区分大小写的查找。默认值为 False。
MatchByte Variant 类型,可选。仅在选择或安装了双字节语言支持时使用。若为 True,则双字节字符仅匹配双字节字符。若为 False,则双字节字符可匹配其等价的单字节字符。
SearchFormat Variant 类型,可选。搜索的格式。
说明
每次使用本方法后,参数 LookIn、LookAt、SearchOrder 和 MatchByte 的设置将保存。如果下次调用本方法时不指定这些参数的值,就使用保存的值。设置这些参数将更改“查找和替换”对话框中的设置,如果您忽略参数,更改“查找和替换”对话框中的设置将更改使用的保存值。若要避免这种问题的出现,每次使用该方法时请明确设置这些参数。
可以使用 FindNext 和 FindPrevious 方法重复搜索。
当搜索到指定的搜索区域的末尾时,本方法将绕回到区域的开始继续搜索。发生绕转后,若要停止搜索,请保存第一个找到的单元格地址,然后依据该保存地址测试每个后续查找到的单元格地址。
若要进行更为复杂的模式匹配查找,请用 For Each...Next 语句和 Like 运算符。例如,下列代码在单元格区域 A1:C5 中搜索字体名称以“Cour”开始的单元格。当 Microsoft Excel 找到匹配单元格以后,就将其字体改为“Times New Roman”。
For Each c In [A1:C5]
If c.Font.Name Like "Cour*" Then
c.Font.Name = "Times New Roman"
End If
Next
示例
本示例在工作表的单元格区域 A1:A500 中查找包含值 2 的所有单元格,并将这些单元格的值更改为 5。
With Worksheets(1).Range("a1:a500")
Set c = .Find(2, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Value = 5
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With