create or replace procedure "CREAR_PF_VIEW" is
pragma AUTONOMOUS_TRANSACTION;
cursor cur is --定义游标
SELECT SPBLX FROM YDS_SHBPDY;
sqlstr varchar2(32767);
sql_ls varchar2(32767);
uid varchar2(32767);
begin
open cur;
fetch cur
into uid;
sqlstr := 'create or replace view V_PF as select * from (select distinct XMBH as XMBH From YDS_SHPB ) X1 ';
while cur%found
loop
sql_ls := ' left join (select B.XMBH as '|| uid || '_BH,B.JBRYJ as '|| uid || '_YJ,B.JBR1 as '|| uid ||
'_QZ, B.JBRQ1 as '|| uid || '_RQ from YDS_SHBPDY A,YDS_SHPB B where A.SPBLX = B.SPBLX and A.SPBLX ='''|| uid|| '''
) '|| uid|| ' on X1.XMBH = '|| uid|| '.'|| uid || '_BH';
sqlstr := sqlstr ||
pragma AUTONOMOUS_TRANSACTION;
cursor cur is --定义游标
SELECT SPBLX FROM YDS_SHBPDY;
sqlstr varchar2(32767);
sql_ls varchar2(32767);
uid varchar2(32767);
begin
open cur;
fetch cur
into uid;
sqlstr := 'create or replace view V_PF as select * from (select distinct XMBH as XMBH From YDS_SHPB ) X1 ';
while cur%found
loop
sql_ls := ' left join (select B.XMBH as '|| uid || '_BH,B.JBRYJ as '|| uid || '_YJ,B.JBR1 as '|| uid ||
'_QZ, B.JBRQ1 as '|| uid || '_RQ from YDS_SHBPDY A,YDS_SHPB B where A.SPBLX = B.SPBLX and A.SPBLX ='''|| uid|| '''
) '|| uid|| ' on X1.XMBH = '|| uid|| '.'|| uid || '_BH';
sqlstr := sqlstr ||