SQL program for high level language extension with implict cursor


HIGHLEVEL LANGUAGE EXTENSION
WITH IMPLICIT CURSOR

AIM:
To write a PL/SQL program for high level language extension with implict cursor.

ALGORITHM:
                        Step 1:  Start the program
                        Step 2: create the cursor named cur1 & cur2
Step 3: store cur1 divided by row wise in √1 & cur2 divide by  row wise
              in √2
Step 4: fetch the values for I from 1to c
Step 5:  for each display stu no,stu name, course, address fees from cur1 &
             batch from cur2
Step 6: Stop the program

                       
PROGRAM:

           SQL> set serveroutput on
            SQL> declare
                        2  cursor cur1 is select * from fanta;
                        3  cursor cur2 is select * from munch;
                        4  r1 cur1 %rowtype;
                        5  r2 cur2 %rowtype;
                        6  c number;
                        7  i number;
                        8  begin
                        9  select count (*) into c from fanta;
                        10  for i in 1...c
            11  loop
                        12  select * into r1 from fanta where rupees=i;
                        13  select * into r2 from munch where rupees=i;
14  dbms_output.put_line                     ('r1.name'||'r1.brand'||'r1.rupees'||'r2.name'||'r2.brand'||'r2.rupees');
                        15  end loop;
                        16  end;
                        17  /
                 
OUTPUT:

1          NEHA             ECE    ERODE          20000  1
2          NISHA           CSE     KARUR          20000  2
3          JANA              MECH            NKL                25000  2
4          HARI              IT        SALEM          25000  3
5          AACHU         CSE     CHENNAI     25000  4

0 comments:

Post a Comment