CURSOR cursor_name [(parameters)] IS query_expression;
It allows processing queries that return multiple rows.
42.What are the steps that need to be performed to use an explicit cursor? Discuss briefly.
The steps that need to be performed on explicit cursor are −
DECLARE − assigns a name to the cursor and defines the structure of query within it.
OPEN − executes the query, whereby the rows returned by the query are available for fetching.
FETCH − assigns values from the current row (cursor position) into specified variables.
CLOSE − releases the memory space.
43.PL/SQL packages usually have two parts. What are these two parts?
PL/SQL packages have two parts −
Specification part − where the interface to the application are defined.
Body part − where the implementation of the specification are defined.
44.Which command(s) are used for creating PL/SQL packages?
CREATE PACKAGE command is used for creating the specification part. CREATE PACKAGE BODY command is used for creating the body part.
45.How do you refer to the types, objects and subprograms declared within a package?
The types, objects, and subprograms declared within a package are referred to using the dot notation as −
46.Say True or False. If False, explain why.
PL/SQL allows subprogram overloading feature within a package.
47.Which command is used to delete a package?
The DROP PACKAGE command.
48.What is the difference between implicit and explicit cursors?
Oracle implicitly declares a cursor to all the DDL and DML commands that return only one row. For queries returning multiple rows, an explicit cursor is created.
49.Say True or False. If False, explain why.
The %NOTFOUND attribute returns true when the cursor is not created explicitly.
False. The %NOTFOUND attribute returns true when the last row of the cursor is processed and no other row is available.
50.Say True or False. If False, explain why.
The %ROWCOUNT attribute returns the total number of rows returned by the FETCH command.