set serveroutput on;declare
shnhead_rec shnhead%rowtype;
type inaCur is ref cursor;
TempCur inaCur;
sql1 varchar2(2000);
begin
sql1 := 'select * from shnhead where seq = 80714643';
execute immediate sql1 into TempCur ;
dbms_output.put_line ('-- 取得データ --');
--dbms_output.put_line (shnhead_rec.seq);
dbms_output.put_line (TempCur.seq);end;
上面的SQL为什么不能执行?提示错误如下:
execute immediate sql1 into TempCur ;
*
8行错误発生。
ORA-06550: 行 8、列 31:
PLS-00597: INTO列表内的式 'TEMPCUR'的型不正确。
ORA-06550: 行 8、列 3:
PL/SQL: Statement ignored
ORA-06550: 行 11、列 33:
PLS-00487: 変数'TEMPCUR'参照無効。
ORA-06550: 行 11、列 3:
PL/SQL: Statement ignored
shnhead_rec shnhead%rowtype;
type inaCur is ref cursor;
TempCur inaCur;
sql1 varchar2(2000);
begin
sql1 := 'select * from shnhead where seq = 80714643';
execute immediate sql1 into TempCur ;
dbms_output.put_line ('-- 取得データ --');
--dbms_output.put_line (shnhead_rec.seq);
dbms_output.put_line (TempCur.seq);end;
上面的SQL为什么不能执行?提示错误如下:
execute immediate sql1 into TempCur ;
*
8行错误発生。
ORA-06550: 行 8、列 31:
PLS-00597: INTO列表内的式 'TEMPCUR'的型不正确。
ORA-06550: 行 8、列 3:
PL/SQL: Statement ignored
ORA-06550: 行 11、列 33:
PLS-00487: 変数'TEMPCUR'参照無効。
ORA-06550: 行 11、列 3:
PL/SQL: Statement ignored
换成这个
OPEN TempCur FOR sql1;
接下来就
loop
fetch TempCur into ………… exit when TempCur%NOTFOUND;
相应你的操作
end loop;……