Monday, May 26, 2014

20 TOP PL/SQL Interview Questions and Answers pdf

Most frequently Asked PL/SQL Interview Questions and Answers for freshers and experienced pdf free download

1. Give the Types of modules in a form?
Form
Menu
Library

2. Name the tables where characteristics of Package, procedure and functions are stored?
User_objects, User_Source and User_error.

3. How packaged procedures and functions are called from the following?
a. Stored procedure or anonymous block
b. an application program such a PRC *C, PRO* COBOL
c. SQL *PLUS
a. PACKAGE NAME.PROCEDURE NAME (parameters);
variable := PACKAGE NAME.FUNCTION NAME (arguments);
EXEC SQL EXECUTE
b.
BEGIN
PACKAGE NAME.PROCEDURE NAME (parameters)
variable := PACKAGE NAME.FUNCTION NAME (arguments);
END;
END EXEC;
c. EXECUTE PACKAGE NAME.PROCEDURE if the procedures does not have any out/in-out parameters. A function can not be called.

4. What is difference between a Cursor declared in a procedure and Cursor declared in a package specification?
A cursor declared in a package specification is global and can be accessed by other procedures or procedures in a package.
A cursor declared in a procedure is local to the procedure that can not be accessed by other procedures.

5. What are two parts of package?
The two parts of package are PACKAGE SPECIFICATION & PACKAGE BODY. Package Specification contains declarations that are global to the packages and local to the schema.
Package Body contains actual procedures and local declaration of the procedures and cursor declarations.

6. What is Overloading of procedures?
The Same procedure name is repeated with parameters of different datatypes and parameters in different positions, varying number of parameters is called overloading of procedures.
e.g. DBMS_OUTPUT put_line
What is a package ? What are the advantages of packages ?

7. Explain how procedures and functions are called in a PL/SQL block?
Function is called as part of an expression.
sal := calculate_sal ('a822');
procedure is called as a PL/SQL statement
calculate_bonus ('A822');

8. Give the structure of the function?
FUNCTION name (argument list .....) Return datatype is
local variable declarations
Begin
executable statements
Exception
execution handlers
End;

9. Give the structure of the procedure?
PROCEDURE name (parameter list.....)
is
local variable declarations
BEGIN
Executable statements.
Exception.
exception handlers
end;

10. What are the two parts of a procedure?
Procedure Specification and Procedure Body

11. What are the modes of parameters that can be passed to a procedure?
IN,OUT,IN-OUT parameters.

12. What are advantages fo Stored Procedures?
Extensibility,Modularity, Reusability, Maintainability and one time compilation.

13. What is difference between a PROCEDURE & FUNCTION?
A FUNCTION is always returns a value using the return statement.
A PROCEDURE may return one or more values through parameters or may not return at all.

14. What is PL/SQL table?
Objects of type TABLE are called "PL/SQL tables", which are modeled as (but not the same as) database tables, PL/SQL tables use a primary PL/SQL tables can have one column and a primary key.
Cursors

15. What is a cursor ? Why Cursor is required?
Cursor is a named private SQL area from where information can be accessed. Cursors are required to process rows individually for queries returning multiple rows.

16. Explain the two type of Cursors?
There are two types of cursors, Implicit Cursor and Explicit Cursor.
PL/SQL uses Implicit Cursors for queries. User defined cursors are called Explicit Cursors. They can be declared and used.

17. What are the PL/SQL Statements used in cursor processing?
DECLARE CURSOR cursor name, OPEN cursor name, FETCH cursor name INTO or Record types, CLOSE cursor name.

18. What are the cursor attributes used in PL/SQL?
%ISOPEN - To check whether cursor is open or not
% ROWCOUNT - Number of rows fetched/updated/deleted.
% FOUND - To check whether cursor has fetched any row. True if rows are fetched.
% NOT FOUND - To check whether cursor has fetched any row. True if no rows are featched.
These attributes are proceeded with SQL for Implicit Cursors and with Cursor name for Explicit Cursors.

19. What is a cursor for loop?
Cursor for loop implicitly declares %ROWTYPE as loop index,opens a cursor, fetches rows of values from active set into fields in the record and closes when all the records have been processed.
eg. FOR emp_rec IN C1 LOOP
salary_total := salary_total +emp_rec sal;
END LOOP;

20. What is an oracle stored procedure?
A stored procedure is a sequence of statements that perform specific function.

More PL/SQL Interview Questions & Answers: Click Here
More PL/SQL Multiple Choice Questions: Click Here

No comments: