Notifications
Clear all
Aug 08, 2020 11:03 pm
Please check the attachment for additional information.
2 Replies
Aug 08, 2020 11:22 pm
You can try the below procedure.
Create or replace procedure
withdraw(acno number, amt number)
Is
V_amt number:=0;
Begin
Select Balance into v_amt
From account
Where accno = acno;
If amt < v_amt then
Update account
Set balance = balance -amt
Where accno = acno;
Commit;
dbms_output.put_line('Transaction Successful');
Else
dbms_output.put_line('Insufficient balance');
End if;
Exception
When others then
Rollback;
End;