Pipi大侠,你好,终于你又出现了。
我是根据DFW上一个帖子"怎样实现根据不同条件定义一个游标"这样做的。
来自:yyanghhong, 时间:2002-1-12 4:43:00, ID:851977
type ty_Quecur is ref cursor ;
a_Quecur ty_Quecur;
Que_Sql varchar2 (500);
c_key number ;
begin
if p_key<>-1 then
Que_Sql :='select LogCode_Location_Key from ETL.LogCode_Location where '||
' Application_key='||App_Key||
' and parent_LogCode_Location_key='||p_key||
' and Code_Location='''||CodeLocationName||'''';
else
Que_Sql :='select LogCode_Location_Key from ETL.LogCode_Location where '||
' Application_key='||App_Key||
' and parent_LogCode_Location_key is null'||
' and Code_Location='''||CodeLocationName||'''';
end if;
c_key:=-1;
open a_Quecur for Que_Sql;
loop
fetch a_Quecur into c_key;
exit when a_Quecur%notfound;
end loop;
close a_Quecur;
以前没搞过PL/SQL,还希望多多指教。