Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

pl/SQL - getting value from prompt

690390Mar 11 2009 — edited Mar 12 2009
Hi,
I am using oracle8i. i tried to write a procedure for a banking project. there are two options. one is credit another is debit. if we enter 'credit' i should get the prompt(old:) credit, otherwise it will be 'debit'. it write the code as follows:
table name is bank1;
declare
tcr bank1%type;
tdr bank1%type;
opt bank1%type;
begin
select tcr, tdr, opt into tcr, tdr, opt from bank1;
opt:=&opt;
if(opt='credit')
tcr:=&tcr;
tcb:=tcb+tcr;
elsif(opt='debit')
tdr:=&tdr
tcb:=tcb-tdr;
end;
update bank1 set tcr=...........;
end;
here i encounter a problem: even if i give the 'if..elsif..'condition, the prompt ask both tcr and tdr. why? i need either one of that. how do i do?
Thank you.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 9 2009
Added on Mar 11 2009
5 comments
837 views