?? sp_daserviceexecute.sql
字號(hào):
create or replace procedure sp_daserviceexecute
(
l_inpatientid in integer,
l_stockoutorderid in integer,
l_reckoningid in integer,
l_createby in integer
)
is
cursor c is select * from daservice where inpatientid = l_inpatientid and isactive = 0;
r daservice%rowtype;
l_price number(16, 4);
begin
for r in c loop
if round(trunc(sysdate, 'hh24') - trunc(r.executed, 'hh24'), 1) < 0.5 then
raise_application_error(-20001, '12小時(shí)內(nèi)不能重復(fù)執(zhí)行醫(yī)囑');
end if;
select charge into l_price from service where serviceid = r.serviceid;
insert into rservice
(
rserviceid,
isactive,
price,
total,
amount,
reckoningid,
unitsid,
serviceid,
created
)
values
(
null,
0,
l_price,
r.daytimes * l_price,
r.daytimes,
l_reckoningid,
null,
r.serviceid,
sysdate
);
update daservice set executed = sysdate where daserviceid = r.daserviceid;
update daservice set stopdate = sysdate, isactive = 1 where daserviceid = r.daserviceid and istemporary = 0;
end loop;
end;
/
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -