CREATE OR REPLACE PROCEDURE P_map_channel_info(channel_id IN varchar2 )--, identy_flag IN varchar2)
as
cursor b_cursor is
select column_name
from user_tab_columns where table_name='MAP_CHANNEL_INFO';
b_cur b_cursor%rowtype;
cursor a_cursor is
select * from kpi.map_channel_info t;
a_cur a_cursor%rowtype;
cursor c_cursor is
select * from kpi.map_channel_info t where t.channel_id=channel_id ;--or t.identy_flag=identy_flag;
c_cur c_cursor%rowtype;
begin
if (channel_id is null ) then--and identy_flag is null) then
for a_cur in a_cursor loop
for b_cur in b_cursor loop
A b_cur%type;
select b_cur into A from kpi.map_channel_info t where t.channel_id=a_cur.channel_id;
IF A is null THEN
update kpi.map_channel_info k set k.is_over ='0' where k.channel_id=a_cur.channel_id;
exit;
END IF;
end loop;
update kpi.map_channel_info k set k.is_over ='1' where k.channel_id=a_cur.channel_id;
end loop;
elsif (channel_id is not null) then --or identy_flag is not null) then
for c_cur in c_cursor loop
for b_cur in b_cursor loop
B b_cur%type; select b_cur into B from kpi.map_channel_info t where t.channel_id=c_cur.channel_id;
IF B is null THEN
update kpi.map_channel_info k set k.is_over ='0' where k.channel_id=c_cur.channel_id;
exit;
END IF;
end loop;
update kpi.map_channel_info k set k.is_over ='1' where k.channel_id=c_cur.channel_id;
end loop;
end if;
end;
as
cursor b_cursor is
select column_name
from user_tab_columns where table_name='MAP_CHANNEL_INFO';
b_cur b_cursor%rowtype;
cursor a_cursor is
select * from kpi.map_channel_info t;
a_cur a_cursor%rowtype;
cursor c_cursor is
select * from kpi.map_channel_info t where t.channel_id=channel_id ;--or t.identy_flag=identy_flag;
c_cur c_cursor%rowtype;
begin
if (channel_id is null ) then--and identy_flag is null) then
for a_cur in a_cursor loop
for b_cur in b_cursor loop
A b_cur%type;
select b_cur into A from kpi.map_channel_info t where t.channel_id=a_cur.channel_id;
IF A is null THEN
update kpi.map_channel_info k set k.is_over ='0' where k.channel_id=a_cur.channel_id;
exit;
END IF;
end loop;
update kpi.map_channel_info k set k.is_over ='1' where k.channel_id=a_cur.channel_id;
end loop;
elsif (channel_id is not null) then --or identy_flag is not null) then
for c_cur in c_cursor loop
for b_cur in b_cursor loop
B b_cur%type; select b_cur into B from kpi.map_channel_info t where t.channel_id=c_cur.channel_id;
IF B is null THEN
update kpi.map_channel_info k set k.is_over ='0' where k.channel_id=c_cur.channel_id;
exit;
END IF;
end loop;
update kpi.map_channel_info k set k.is_over ='1' where k.channel_id=c_cur.channel_id;
end loop;
end if;
end;
我的这个存储过程报pls00103:Encountered the symbol "b_cur " when exception one of the following错误