create or replace procedure test as
Cursor cursor is select pk_corp from bd_corp; name1 varchar(20);beginfor name1 in cursor LOOP begin dbms_output.put_line(name1);
end; end LOOP;end test;
我上面这个存储过程在ORACLE 10G中编译提示:“调用‘PUT_LINE'时参数或类型错误” ,请问我那里错误了,因为是初学者,在网上看到这个简单的例子想测试一下。
Cursor cursor is select pk_corp from bd_corp; name1 varchar(20);beginfor name1 in cursor LOOP begin dbms_output.put_line(name1);
end; end LOOP;end test;
我上面这个存储过程在ORACLE 10G中编译提示:“调用‘PUT_LINE'时参数或类型错误” ,请问我那里错误了,因为是初学者,在网上看到这个简单的例子想测试一下。
Cursor cur is select pk_corp from bd_corp; name1 varchar(20);beginfor r in cur LOOP begin dbms_output.put_line(r.字段1 || ', ' || r.字段2);
end; end LOOP;end test;
open cur;
fetch cur into name1
while cur%found
loop
dbms_output.put_line(name1);
fetch cur into name1;
end loop;
close cur;
2,for循环时 系统会隐式定义循环变量 即只需使用 不需定义
create or replace procedure test as
Cursor cursor is select pk_corp from bd_corp; --name1 varchar(20);
begin
for name1 in cursor LOOP
--begin
dbms_output.put_line(name1);
--end;
end LOOP;
end test;
而dbms_output.put_line()不能打印记录类型的