Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create or replace procedure Buy_share(acno share_trans.account_no%type,
- shid share_trans.share_id%type,qty share_trans.quantity%type)is
- cursor cc1 is select share_idfrom share_trans,share_info where share_trans.account_no=share_info.account_no and share_id= shid and quantity=qtyfor update of qty nowait;
- tno share_trans.transaction_no%type;
- ttype share_trans.trans_type%type;
- tdate share_trans.trans_date%type;
- begin
- unit:=Enquiry(acno,shid);
- shid:=&shid;
- qty:=&qty;
- for cc1_rec in cc1 loop
- if shid>0 then
- update share_trans set qty=qty+unit where current of cc1;
- commit;
- dbms_output.put_line('found/update');
- else
- insert into share_info values(acno,shid,unit);
- end if;
- insert into share_trans values(acno,tno,shid,qty,ttype,tdate);
- end loop;
- end;
Add Comment
Please, Sign In to add comment