Oracle PL-SQL

  Home  Oracle  Oracle PL-SQL


“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

21⟩ What is a database trigger? Name some usages of database trigger?

Database trigger is stored PL/SQL program unit associated with a specific database table. Usages are Audit data modifications, Log events transparently, Enforce complex business rules Derive column values automatically, Implement complex security authorizations. Maintain replicate tables.

 144 views

24⟩ What are two virtual tables available during database trigger execution?

The table columns are referred as OLD.column_name and NEW.column_name.

For triggers related to INSERT only NEW.column_name values only available.

For triggers related to UPDATE only OLD.column_name NEW.column_name values only available.

For triggers related to DELETE only OLD.column_name values only available.

 141 views

27⟩ What is an Exception? What are types of Exception?

Exception is the error handling part of PL/SQL block. The types are Predefined and user defined. Some of Predefined exceptions are.

CURSOR_ALREADY_OPEN

DUP_VAL_ON_INDEX

NO_DATA_FOUND

TOO_MANY_ROWS

INVALID_CURSOR

INVALID_NUMBER

LOGON_DENIED

NOT_LOGGED_ON

PROGRAM-ERROR

STORAGE_ERROR

TIMEOUT_ON_RESOURCE

VALUE_ERROR

ZERO_DIVIDE

OTHERS.

exception is an identifier and error handling part of pl/sql types := 1)predifined

2) user defined.

 146 views

28⟩ 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)

 151 views

29⟩ 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.

 136 views

33⟩ 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;

 153 views

34⟩ 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.

 162 views

36⟩ 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.

 156 views

38⟩ 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

 157 views