begin
select t.type,t.orglevel into v_type,v_orglevel from sys_organize_info t where t.id = ai_forgid;
if v_type = '03' and v_orglevel = '04' then
open out_cur for
select t1.requcode,--申請單號
t2.orderid,--序號
t3.medicode,--專案編碼
t3.mediname||'['||t3.spec||']' as mediname,--專案名稱
t2.unit,--單位
t2.requnum as sqsl,--申請數量
t2.spsl,--審批數量
pkg_bshis_common.f_get_add('dictoper',t1.inputor,'opername') as sqr,--申請人
t1.requdate as sqrq--申請日期
from request_total t1,request t2,dictmedi_public t3
where t1.requestid = t2.requestid
and t2.mediid = t3.mediid
and t1.forgid = t2.forgid
and t1.frcode = t2.frcode
and t2.forgid = t3.forgid
and t2.frcode = t3.frcode
and t1.stage = 1
--and t1.retu = 0
and t1.requestid = ai_requestid
and t1.forgid = ai_forgid;
elsif v_type = '03' and v_orglevel = '05' then
open out_cur for
select t1.requcode,
t2.orderid,
t3.medicode,
t3.mediname||'['||t3.spec||']' as mediname,
t2.unit,
t2.requnum as sqsl,
t2.spsl,
pkg_bshis_common.f_get_add('dictoper',t1.inputor,'opername') as sqr,
t1.requdate as sqrq
from request_total t1,request t2,dictmedi t3
where t1.requestid = t2.requestid
and t2.mediid = t3.mediid
and t1.forgid = t2.forgid
and t1.frcode = t2.frcode
and t2.forgid = t3.forgid
and t2.frcode = t3.frcode
and t1.stage = 1
--and t1.retu = 0
and t1.requestid = ai_requestid
and t1.forgid = ai_forgid;
end if;
end;
sql語句
oracle帶游標的儲存過程
create or replace procedure xs test add19 is bachelor edu varchar2 2000 new bachelor edu varchar2 2000 aa varchar2 2000 bb varchar2 2000 edu length in...
oracle 帶游標的儲存過程
如果各位以前從來沒有寫儲存過程,可得仔細了,因為在進行儲存過程編寫的時候,新手很容易出錯,非常容易。執行儲存過程各個oracle客戶端是不是樣的 可能你在網上看到的是呼叫exec,但是你再怎以呼叫你都執行不了,原因何在,因為exec是pl sql develop裡面的乙個程式,而你當前使用oracl...
帶游標的儲存過程例子,很經典
create or replace procedure sum storage isplant g containerinv.plant type sloc g containerinv.sloc type part g containerinv.partno type qty g containe...