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. Very useful post! I recently came across PlacementPS.com
    , and their software testing course in Chennai stands out for its quality training and placement support. Definitely worth checking out

    Best Software Testing Training in chennai

    ReplyDelete
  4. Great article! I recently completed my Python training in Chennai from PlacementPS.com, and it was a wonderful experience. The trainers are very knowledgeable, and they focus on real-time projects. One of the best places for career growth!

    Best Python Training in chennai

    ReplyDelete