create or replace procedure proname(
aa in varchar2,
bb in integer,
result out types.cursortype )is
v_un date;
v_u1 varchar2(1000);
v_u2 varchar2(1000);
sqlmain varchar2(5000); --主sql
v_count int; --資料集的行數
a integer := 1;
tb_recv type_table := type_table(); --oracle裡的陣列
type cur is ref cursor;
cur_local cur;
begin
proname2(..,...,..);--呼叫另外的儲存過程
tb_recv := funname(..,..);
sqlmain := ' select sysdate a1,sysdate a2 from dual';
if ...then
sqlmain := sqlmain || ' and dual.dummy = ''x'' ';
end if;
open cur_local for sqlmain;
loop
fetch cur_local
into v_u1,v_u2
exit when cur_local%notfound;
open result for
select v_u1,v_u2 from table(cast(tb_recv as type_table ));
exception
when others then
........
rollback;
end proname;
(oracle)如何建立和使用procedure
1 定義procedure 在高階程式語言中的模組的概念 create or replace procedure procedure name param 1 in type param 2 in out type as param inner type begin statement end a ...
oracle裡的merge into用法
1 根據表newproducts的product id欄位是否匹配來updates表products的資訊 sql merge into products p 2 using newproducts np 3 on p.product id np.product id 4 when matched ...
oracle裡的判斷函式
乙個類似於判斷的函式.它就是decode.先來看看它的用法 decode 條件,值1,翻譯值1,值2,翻譯值2,值n,翻譯值n,預設值 它的意思也就是這樣 if 條件 值1 then return 翻譯值1 elsif 條件 值2 then return 翻譯值2 elsif 條件 值n then ...