PLSQL Interview Question With Answer-6
PLSQL Interview Question With Answer-6
1. What is PL/SQL.?
-- 2. What is Cursor.?
- Cursor is a SQL private area where the query get passed and executed.
- It is a pointer to the memory location which holds the information about the
SQL statement and its resultset.
- Implicit Cursor can return eaxctly single row. It is constructed and managed by
PL/SQL, but can get information from
its attributes.
- Explicit cursor can return multiple rows. It is constructed and managed by us.
We can open, fetch and close cursor as we want.
-- 3. What is Exception.?
- In PL/SQL , Exception block that raises the Exception which helps us to find out
the error and resolve it.
--
PLSQL Interview Question with Answer
- It is complied once and can be executed multiple times for Repeated Usage.
-- 5. What is Functions.?
- Function is named PLSQL sub program which compiled and stored in the
database.
- Function is mostly used to Compute values and to fetching some data from
table.
- Function must return one value and Function header contains return clause.
-- 7. What is Package.?
- Package is a schema object which will groups logically related procedure and
function.
PLSQL Interview Question with Answer
- Package specification
- Package body or definition
- if you execute any procedure or function inside the package, the rest of the
program also get loaded into memory.
-- 8. What is Trigger.?
- Triggers are stored procedure, which are automatically executed or fired when
some events occur
-- 9. What is Refcursor.?
- Ref cursor is a datatype. It used for multiple SQL statements in the PL/SQL
Block.
- Ref cursor is used to pass the resultset from one sub program to another sub
program.
- It is a high level datatype used to store multiple values as single variable can be
declared by using TYPE keyword.
- It mainly reduces context switches between SQL and PL/SQL engine and allows
SQL engine to fetch all the records
at once.
- The SQL statements will be created and executed at run-time based on the
requirement is called Dynamic SQL.
- The advantage of Dynamic SQL is that we can use DDL statement in PLSQL
block.
4. %ROWCOUNT - Returns the number of rows fetched from the cursor at the
point of time.
- While declaring the cursor we can add parameter and passed them into the query
whenever the cursor are opened.
- It define only datatype of parameter and not need to define its length.
1. Pre-defined Exception.-> This exception will get raised if certain database rule is violated by
the program.
2. User-defined Exception.-> In this Exception, User can create own exception and handle the
error. It must be declared and
raised explicitly using RAISE statement.
- Procedure can have same name but the Number of Parameters must be different
or order of the data type is different.
- If the procedure and function name are having same, thenn Number of
Parameter must be different or
PLSQL Interview Question with Answer
--
- But Inside the package body, We can include procedure or function which is not
declare in the specification
It is called forward declaration package.
- Program will be get success while compilation, but not executed which is not
declared in the specification part.