日期:2014-05-17 浏览次数:27351 次
Connected as SYS SQL> create or replace procedure pro_test 2 as 3 begin 4 for i in ( 5 select table_name from dba_tables 6 where owner='SCOTT') loop 7 dbms_output.put_line('tabels in scott schema:'||i.table_name); 8 end loop; 9 end pro_test;--注意end 10 / Procedure created SQL> set serveroutput on; SQL> set pagesize 100; SQL> exec pro_test;--调用无参过程只需写过程名 tabels in scott schema:DEPT tabels in scott schema:EMP tabels in scott schema:BONUS tabels in scott schema:SALGRADE tabels in scott schema:BIN$YCT5xmhFSU+EnAnp/mSHZw==$0 tabels in scott schema:BIN$MuwRbIWjRKiVUurtyIT03w==$0 tabels in scott schema:GOODS_TB1 tabels in scott schema:GOODS_TB2 tabels in scott schema:TEST tabels in scott schema:BIN$vPkh4GFBSw21ItWKZT4KkA==$0 tabels in scott schema:BIN$BYrKqm3ZSxykDmtNfKVNfA==$0 tabels in scott schema:PROJECT_MANAGE tabels in scott schema:BIN$Mw8EGfnRS72UzIG/j6X+Ew==$0 tabels in scott schema:SYS_TEMP_FBT tabels in scott schema:BIN$hUpvDWyHTPKmNcrDdDy4IQ==$0 tabels in scott schema:BIN$DFFcU4qjShmXeco/LcjswQ==$0 tabels in scott schema:BIN$uoKglXK2RnKCr1qQXRoIIg==$0 tabels in scott schema:BIN$/aoGE/7uSauFL3HTtl6wUg==$0 tabels in scott schema:BIN$LRRbWxbsSMWAAbuPUHLjCQ==$0 tabels in scott schema:TEMP_TABLE_SESSION PL/SQL procedure successfully completed
------解决方案--------------------
oracle的存储过程不能直接这样写一条select返回数据的,不同于sql server,你这样写没有意义。
而且也通不过。
建议你看这个帖子
http://topic.csdn.net/t/20030707/16/1999981.html
------解决方案--------------------
正解,如果想测试写存储过程也写点有意义的,这样写是不能通过。