0% found this document useful (0 votes)
79 views1 page

Part 13

PL SQL is a procedural language that combines SQL and procedural programming constructs like conditionals and loops. %ROWTYPE is used when an entire table row is returned by a query, while TYPE RECORD handles columns from different tables. Cursors are required to process queries returning multiple rows individually, and cursor FOR loops implicitly declare a %ROWTYPE variable to represent each row, opening and closing the cursor to iterate through the result set.

Uploaded by

Sumit K
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views1 page

Part 13

PL SQL is a procedural language that combines SQL and procedural programming constructs like conditionals and loops. %ROWTYPE is used when an entire table row is returned by a query, while TYPE RECORD handles columns from different tables. Cursors are required to process queries returning multiple rows individually, and cursor FOR loops implicitly declare a %ROWTYPE variable to represent each row, opening and closing the cursor to iterate through the result set.

Uploaded by

Sumit K
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

1. What is PL SQL ?

PL SQL is a procedural language which has interactive SQL, as well as procedural


programming language constructs like conditional branching and iteration.

2. Differentiate between % ROWTYPE and TYPE RECORD.

% ROWTYPE is used when a query returns an entire row of a table or view.

TYPE RECORD, on the other hand, is used when a query returns column of different tables
or views.

Eg. TYPE r_emp is RECORD (sno smp.smpno%type,sname smp sname %type)

e_rec smp %ROWTYPE

Cursor c1 is select smpno,dept from smp;

e_rec c1 %ROWTYPE

3. Explain uses of cursor.

Cursor is a named private area in SQL from which information can be accessed. They are
required to process each row individually for queries which return multiple rows.

4. Show code of a cursor for loop.

Cursor declares %ROWTYPE as loop index implicitly. It then opens a cursor, gets rows of
values from the active set in fields of the record and shuts when all records are processed.

Eg. FOR smp_rec IN C1 LOOP

totalsal=totalsal+smp_recsal;

ENDLOOP;

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy