How To Write PL/SQL block using Loop Statement & Exception Handling.

INPUT
declare
          no number(5);
          bal number(6);
          deb_bal number(6);
          min_bal constant number(5):=500;

begin
          no:=&no;
          deb_bal:=&deb_bal;
          select balance into bal from acc where acc_no=no;
          if bal>min_bal then
                   update acc set balance=balance-deb_bal where acc_no=no;
                   dbms_output.put_line('debit sucessfully');
          else
                   dbms_output.put_line('you have not minimum balance');
          end if;

end;

OUTPUT
1)
Enter value for no: 1201
old   8:  no:=&no;
new   8:  no:=1201;
Enter value for deb_bal: 1000
old   9:  deb_bal:=&deb_bal;
new   9:  deb_bal:=1000;
debit sucessfully
PL/SQL procedure successfully completed.


2)
Enter value for no: 1202
old   8:  no:=&no;
new   8:  no:=1202;
Enter value for deb_bal: 100
old   9:  deb_bal:=&deb_bal;
new   9:  deb_bal:=100;
you have not minimum balance
PL/SQL procedure successfully completed.

Post a Comment

4 Comments

  1. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.

    oracle training in bangalore


    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Really useful content and well-structured information 👏
    If you’re planning to enter the testing domain, don’t miss Immek’s Software Testing Training in Chennai. Their courses include manual, automation, and advanced frameworks, plus placement support that helps you get real career results.

    jmeter-performance-testing-training-in-chennai
    etl-training-in-chennai

    ReplyDelete
  4. Thanks for the useful insights! I joined placement point solutions for Python training in Chennai, and the learning experience was top-notch. The team provides strong placement support and practical exposure that really makes a difference

    Best Python Training in chennai

    ReplyDelete