Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

What are exceptions in PL SQL?

Answer»

In PL/SQL, an exception is technically an error CONDITION during the execution of a program. There are two TYPES of limitations in PL/SQL, NAMELY:

2.

Why indexing is used in PL SQL?

Answer»

Nowadays, Databases are getting COLOSSAL, and there is a large amount of DATA to go through while finding anything in particular when required. Indexing in PL/SQL helps to speed up the process of finding a specific PIECE of data by RETURNING a small portion of table rows in order to make the process of accessing data accurate and faster.

3.

What are the differences between stored procedure and functions?

Answer»
S.noSTORED ProcedureFUNCTION
1.It supports all the parameters of PL/SQL, namely, IN, OUT, and IN-OUT.It supports only input parameters, not the output parameters.
2.They can call functions as and when required.A function can not call a stored procedure.
3.There is no possibility of calling stored procedures from select, having, and where statements.A function can be called using the select statement.
4.Here, transactions can be used.No transactions can be used here.
5.It can undergo exception handling by the insertion of try/catch blocks.There are no provisions for a function to EXPLICITLY undergo exception handling.
6.It may or may not return with a value.It has to return with EITHER a RESULT or a value to the caller.
7.All the database operations such as Insert, Delete, Update, etc. can be performed with stored procedures.Only the Select Database operation can be carried out with functions.
8.Stored procedures can fire triggers.Functions can not fire triggers.
9.It can use print commands.A function can not use print commands.
10.Stored Procedures can execute dynamic SQL commands.Functions can not execute dynamic SQL commands.
4.

Why do we need cursor in PL SQL?

Answer»

In PL/SQL a cursor is needed for the FOLLOWING reasons:

  • To retrieve data, a single row at a TIME, from a data set, UNLIKE in the SQL commands where all the rows are operated on the result set at one time.
  • Cursors are also USED for updating records in a singleton fashion or a row by row MANNER into a database table.
5.

What is scalar data type in PL SQL?

Answer»

A SCALAR data type in PL/SQL is one in which there are single VALUES with no internal components such as DATE, BOOLEAN, or NUMBER.

6.

How are multi line comments defined in PL SQL?

Answer»

To define a multi-line comment style in PLSQL, there are two steps.

  • A DOUBLE HYPHEN (- -) is placed anywhere on a line (except on a CHARACTER literal), which SHALL turn it into a comment.
  • To make a comment as a multi-line, it must begin with a slash-asterisk (/*) and then end with an asterisk-slash (*/).
7.

What are parameter modes in PL SQL functions and procedures?

Answer»

In PL/SQL, procedures support all the parameter MODES listed below, whereas, functions only support the IN parameter mode. Here are all the parameter modes in PL/SQL for procedures and functions:

  • IN: This is the DEFAULT mode, which allows the CALLING code to pass values in the procedures or functions.
  • OUT: The OUT PARAMETERS allow the procedures or functions to pass the values back towards the calling code.
  • IN OUT: The IN OUT parameters allow the calling code to pass the values in and also to receive values from procedures or functions.
8.

What is the difference between constraints and triggers?

Answer»
S.noConstraintsTriggers
1.This is defined by the relationship between DATA elements.These are the ACTIONS that are executed when a specific REACTION occurs.
2.It is USED for a column.It is used for a table.
3.These are useful for database consistency.These are used for LOGGING and auditing.
4.It precedes triggers when getting fired.First constraints get fired. Only then do triggers get fired.
9.

What are the difference between syntax and runtime errors in pl/sql?

Answer»
S.noRun-Time ErrorSyntax Error
1.This is a type of error that is encountered while the PROGRAM is running.This is an error encountered in the syntax of a sequence of characters or the tokens intended to be written in a PARTICULAR language.
2.It HAPPENS due to the occurrence of an illegal operation.It happens due to the occurrence of grammar RULES with respect to the programming language.
3.This type of error is detected while the program is still running.This type of error is detected while compiling the program.
4.E.g., Array out of bound, Diving by zero, etc.E.g., Missing CURLY braces, semicolons, etc.
10.

What is function overloading in PL SQL?

Answer»

The Function overloading in PL/SQL is based on the CONCEPT of polymorphism. It actually REFERS to the CAPABILITY of any programming method to perform multiple operations based on the input data type and the CONTEXT in which the PROCESS, i.e., function, is used.

11.

What is PGA and UGA?

Answer»

SERVER processes assigned in a CLIENT program to be used as a memory for PRIVATE data are known as Process Global Area. UGA or User Global Area is used to retain data during a session database such as PACKAGE Variables and Private SQL areas.

12.

What is the difference between Case and decode?

Answer»
CASEDECODE
Is a statementIs a function
Can be USED in the WHERE CLAUSECannot be used in the WHERE clause
13.

What is attribute indicator in PL SQL?

Answer»

Attributes in PL/SQL are properties which let the USER reference the DATA type and structure of a PRESENT item without having to REPEAT its definition. Attributes are mainly used for EASY maintenance of database tables.

14.

What is Savepoint in PL SQL?

Answer»

In, PL/SQL, a SAVEPOINT is a TCL(Transition Control Language), statement is used to create a breakpoint during a specific/current transaction at a PARTICULAR location. A Savepoint is basically a PIT stop for transactions and ROLLBACK can be used to ERASE any PART of a transaction.

15.

What is difference between commit and rollback?

Answer»
COMMITROLLBACK
Syntax: COMMIT;Syntax: ROLLBACK;
USED to validate modifications made by current transactionsUsed to erase modifications made by current transactions
After executing this, a TRANSACTION can’t be used for ROLLBACKAfter executing this, a transaction can be modified and SENT for COMMIT
Occurs after SUCCESSFUL completion of a transactionOccurs if transaction is abrupted unexpectedly
16.

Why packages are used in PL SQL?

Answer»

In PL/SQL modules, packages are used to encapsulate LOGICALLY related DATA types, constants, variables, subprograms, CURSORS, and any other exceptions. Each package can be used to simplify the level of understanding inside an interface using SIMPLE, clear and well-defined functions within.

17.

Why do we use Rowtype in PL SQL?

Answer»

In PL/SQL, Rowtype is used to PROVIDE a RECORD type/data type in the form of ROWS in a database. Variables declared using the %ROWTYPE attribute are CONSIDERED to be declared using a data type name.

4. How many types of triggers are there in PL SQL?

In PL/SQL, there are two types of triggers:

  • Row level triggers: Used to trigger an event once any changes are MADE in rows.
  • Statement level trigger: It is used to trigger an event for each executed SQL statement.
18.

What is delimiter in PL SQL?

Answer»

DELIMITER in PL/SQL is a simple/compound symbol. In PL/SQL, DELIMITERS are used to represent ARITHMETIC operations like addition and subtraction.

19.

What is the difference between SQL and PL SQL?

Answer»
SQLPL/SQL
Stands for Structured QUERY Language.Stands for Procedural Language SQL, an extension for SQL.
Only one SINGLE query can be executed at a time.Multiple codes can be executed at a single time.
It is used to store DATA to be displayedIt's the language through which an application is created to display data
PL SQL statements cannot be embedded in the codeSQL statements can be embedded in the code
Used to write queries and commands USING DDL and DML methodsUsed to write a block of code for having procedures, variables, FUNCTIONS and packages