1 create or replace procedure testpro6( 2 param1 varchar2, 3 param2 out varchar2 , 4 param3 in out varchar2 5 ) as tes varchar(20); 6 7 Cursor cursor is select xtyh from xtyhtable ; 8 begin 9 for xtyh in cursor loop 10 begin 11 dbms_output.put_line('第:'||test_nev.nextval); 12 -- dbms_output.put_line('xtyh'||xtyh); 13 insert into test(id , name) values(test_nev.nextval , xtyh.xtyh); 14 end; 15 end loop; 16 end;
1.定義存儲過程
2.定義參數 只能輸入、且不可改變
3.定義參數 輸出參數 可改變
4.定義參數 可輸入可輸出、 可改變
5.存儲過程標志、is as 之類
7 定義游標 cursor 是 從xtyhtable中查詢名稱的
8.開始
9.開始循環cursor 定義一個 xtyh字段 、開始 loop 循環
10.開始循環
11.存儲過程輸出sequesces的排序值
13.插入一張表中、id是sequences排序的值、 name 是 xtyh.xtyh(第一個xtyh對應 cursor 的一條記錄、第二個xtyh對應 該條cursor記錄里面的 xtyh 這個字段值)
14.結束
15.結束循環
16.結束存儲