Difficult Oracle PL-SQL Interview Preparation Guide
Download PDF

Oracle PL-SQL Interview Questions and Answers will help you to face a successful Oracle PL-SQL Interview and get hired, here you can learn PL-SQL of Oracle database also and update your knowledge and get preparation for a better job in Oracle PL SQL, So learn PL-SQL with the help of this Oracle PL-SQL Interview Questions with Answers guide

52 Oracle PL-SQL Questions and Answers:

Table of Contents:

Difficult  Oracle PL-SQL Job Interview Questions and Answers
Difficult Oracle PL-SQL Job Interview Questions and Answers

1 :: How to order siblings in oracle hierarchy queries?

SELECT last_name, employee_id, manager_id, LEVEL
FROM employees
START WITH employee_id = 100
CONNECT BY PRIOR employee_id = manager_id
ORDER SIBLINGS BY last_name;

2 :: Give the Types of modules in a form?

Form
Menu
Library

4 :: 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.

5 :: 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.

6 :: 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.

7 :: 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 ?

8 :: 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');

9 :: Give the structure of the function?

FUNCTION name (argument list .....) Return datatype is
local variable declarations
Begin
executable statements
Exception
execution handlers
End;

10 :: Give the structure of the procedure?

PROCEDURE name (parameter list.....)
is
local variable declarations
BEGIN
Executable statements.
Exception.
exception handlers
end;

11 :: What are the two parts of a procedure?

Procedure Specification and Procedure Body.

13 :: What are advantages fo Stored Procedures?

Extensibility,Modularity, Reusability, Maintainability and one time compilation.

14 :: 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.

15 :: 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

16 :: 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.

17 :: 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.

18 :: 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.

19 :: 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.

20 :: 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;

21 :: What is an oracle stored procedure?

A stored procedure is a sequence of statements that perform specific function.

22 :: Where the Pre_defined_exceptions are stored?

In the standard package.
Procedures, Functions & Packages ;

23 :: What are the return values of functions SQLCODE and SQLERRM?

SQLCODE returns the latest code of the error that has occurred.
SQLERRM returns the relevant error message of the SQLCODE.

24 :: What is Raise_application_error?

Raise_application_error is a procedure of package DBMS_STANDARD which allows to issue an user_defined error messages from stored sub-program or database
trigger.

25 :: What is Pragma EXECPTION_INIT? Explain the usage?

The PRAGMA EXECPTION_INIT tells the complier to associate an exception with an oracle error. To get an error message of a specific oracle error.
e.g. PRAGMA EXCEPTION_INIT (exception name, oracle error number)
Oracle PL-SQL Interview Questions and Answers
52 Oracle PL-SQL Interview Questions and Answers