sql中table用法

 1  for c in (select column_value from table(f_split(V_FileID, ','))) loop
 2       --若没有填写资格开始结束时间,则填入
 3       select count(*)
 4         into numDataCount
 5         from ly_zg_jzfbt z
 6        where file_id = c.column_value
 7          and z.pt_valid_stime is null;
 8       if numDataCount > 0 then
 9         update ly_zg_jzfbt z
10            set z.pt_valid_stime     = trunc(sysdate),
11                z.pt_valid_etime     = add_months(trunc(sysdate), 12) - 1,
12                z.fanaly_valid_etime = add_months(trunc(sysdate), 12) - 1
13          where z.file_id = c.column_value;
14         commit;
15       end if;
16     
17       select l.CONTROL_ID
18         into numControl
19         from ly_zg_jzfbt l
20        where file_id = c.column_value;
21       varERRMSG := PK_JJZLFBTINFO.F_CheckStandard(c.column_value,
22                                                   to_char(numControl));
23       if varERRMSG is not null then
24         raise_application_error('-20001', varERRMSG);
25       end if;
26       PK_FAMILYHOUSE.P_GetFamilyHouseInfoData(
27                                               numControl,
28                                               c.column_value,
29                                               p_temp);
30       if varERRMSG is not null then
31         raise_application_error('-20001', varERRMSG);
32       end if;
33       PK_FAMILYINFO.P_GetFamilyInfo(
34                                     c.column_value,
35                                     p_temp);
36       if varERRMSG is not null then
37         raise_application_error('-20001', varERRMSG);
38       end if;
39     
40       select l.is_over_certificate
41         into doCeritify
42         from ly_zg_jzfbt l
43        where file_id = c.column_value;
44     
45       if doCeritify is null or doCeritify = 1 then
46         update ly_zg_jzfbt l
47            set l.do_certificate_time = sysdate, l.is_over_certificate = 0
48          where file_id = c.column_value;
49         commit;
50       end if;
51       --将out出的内容与file_id拼接在一起
52       varIncomeAvg_All         := varIncomeAvg_All || c.column_value || ':' ||
53                                   numIncomeAvg || ',';
54       varIdentifiedArea_All    := varIdentifiedArea_All || c.column_value || ':' ||
55                                   numIdentifiedArea || ',';
56       varPerIdentifiedArea_All := varPerIdentifiedArea_All ||
57                                   c.column_value || ':' ||
58                                   numPerIdentifiedArea || ',';
59     end loop;

 

posted @ 2019-03-27 20:51  王小鹏  阅读(1772)  评论(0编辑  收藏  举报