Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
52 views

3rd PL - SQL Interview Questions (2022) - Javatpoint

The document discusses PL/SQL interview questions and answers. It begins by defining PL/SQL as an extension of SQL that supports procedural programming features. It then lists 20 questions that cover topics like the basic structure of PL/SQL, differences between functions and procedures, exceptions, triggers, stored procedures, and more. The questions provide explanations of PL/SQL concepts and syntax.

Uploaded by

omkar gaikwad
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

3rd PL - SQL Interview Questions (2022) - Javatpoint

The document discusses PL/SQL interview questions and answers. It begins by defining PL/SQL as an extension of SQL that supports procedural programming features. It then lists 20 questions that cover topics like the basic structure of PL/SQL, differences between functions and procedures, exceptions, triggers, stored procedures, and more. The questions provide explanations of PL/SQL concepts and syntax.

Uploaded by

omkar gaikwad
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

2/1/22, 7:21 PM PL/SQL Interview Questions (2022) - javatpoint

Home Interview Questions Java SQL Python JavaScript Angular

https://www.javatpoint.com/pl-sql-interview-questions 1/17
2/1/22, 7:21 PM PL/SQL Interview Questions (2022) - javatpoint

PL/SQL Interview Questions


PL/SQL is an advance version of SQL. There are given top list of PL/SQL interview questions with
answer.

1) What is PL/SQL?

PL/SQL stands for procedural language extension to SQL. It supports procedural features of
programming language and SQL both. It was developed by Oracle Corporation in early of 90's to
enhance the capabilities of SQL.

2) What is the purpose of using PL/SQL?

PL/SQL is an extension of SQL. While SQL is non-procedural, PL/SQL is a procedural language


designed by Oracle. It is invented to overcome the limitations of SQL.

3) What are the most important characteristics of PL/SQL?

A list of some notable characteristics:

https://www.javatpoint.com/pl-sql-interview-questions 2/17
2/1/22, 7:21 PM PL/SQL Interview Questions (2022) - javatpoint

PL/SQL is a block-structured language.

It is portable to all environments that support Oracle.

PL/SQL is integrated with the Oracle data dictionary.

Stored procedures help better sharing of application.

4) What is PL/SQL table? Why it is used?

Objects of type tables are called PL/SQL tables that are modeled as database table. We can also say
that PL/SQL tables are a way to providing arrays. Arrays are like temporary tables in memory that
are processed very quickly. PL/SQL tables are used to move bulk data. They simplifies moving
collections of data.

5) What are the datatypes available in PL/SQL?

There are two types of datatypes in PL/SQL:

1. Scalar datatypes Example are NUMBER, VARCHAR2, DATE, CHAR, LONG, BOOLEAN etc.
2. Composite datatypes Example are RECORD, TABLE etc.

6) What is the basic structure of PL/SQL?

PL/SQL uses BLOCK structure as its basic structure. Each PL/SQL program consists of SQL and
PL/SQL statement which form a PL/SQL block.

PL/SQL block contains 3 sections.

1. The Declaration Section (optional)


2. The Execution Section (mandatory)
3. The Exception handling Section (optional)

7) What is the difference between FUNCTION, PROCEDURE AND


PACKAGE in PL/SQL?

https://www.javatpoint.com/pl-sql-interview-questions 3/17
2/1/22, 7:21 PM PL/SQL Interview Questions (2022) - javatpoint

Function: The main purpose of a PL/SQL function is generally to compute and return a single value.
A function has a return type in its specification and must return a value specified in that type.

Procedure: A procedure does not have a return type and should not return any value but it can
have a return statement that simply stops its execution and returns to the caller. A procedure is used
to return multiple values otherwise it is generally similar to a function.

Package: A package is schema object which groups logically related PL/SQL types , items and
subprograms. You can also say that it is a group of functions, procedure, variables and record type
statement. It provides modularity, due to this facility it aids application development. It is used to
hide information from unauthorized users.

Grokking System Design


Advanced Course
The advanced Grokking course to learn key
system design skills for senior level
interviews
educative.io

OPEN

8) What is exception? What are the types of exceptions?

Exception is an error handling part of PL/SQL. There are two type of exceptions: pre_defined
exception and user_defined exception.

https://www.javatpoint.com/pl-sql-interview-questions 4/17
2/1/22, 7:21 PM PL/SQL Interview Questions (2022) - javatpoint

9) How to write a single statement that concatenates the words ?Hello? and
?World? and assign it in a variable named Greeting?

Greeting := 'Hello' || 'World';

10) Does PL/SQL support CREATE command?

No. PL/SQL doesn't support the data definition commands like CREATE.

11) Write a unique difference between a function and a stored procedure.

A function returns a value while a stored procedure doesn?t return a value.

12) How exception is different from error?

Whenever an Error occurs Exception arises. Error is a bug whereas exception is a warning or error
condition.

13) What is the main reason behind using an index?

Faster access of data blocks in the table.

14) What are PL/SQL exceptions? Tell me any three.

1. Too_many_rows

https://www.javatpoint.com/pl-sql-interview-questions 5/17
2/1/22, 7:21 PM PL/SQL Interview Questions (2022) - javatpoint

2. No_Data_Found
3. Value_error
4. Zero_error etc.

15) How do you declare a user-defined exception?

You can declare the User defined exceptions under the DECLARE section, with the keyword
EXCEPTION.

Syntax:

<exception_name> EXCEPTION;  

16) What are some predefined exceptions in PL/SQL?

A list of predefined exceptions in PL/SQL:

DUP_VAL_ON_INDEX

ZERO_DIVIDE

NO_DATA_FOUND

TOO_MANY_ROWS

CURSOR_ALREADY_OPEN

INVALID_NUMBER

INVALID_CURSOR

PROGRAM_ERROR

TIMEOUT _ON_RESOURCE

STORAGE_ERROR

LOGON_DENIED

VALUE_ERROR

https://www.javatpoint.com/pl-sql-interview-questions 6/17
2/1/22, 7:21 PM PL/SQL Interview Questions (2022) - javatpoint

etc.

17) What is a trigger in PL/SQL?

A trigger is a PL/SQL program which is stored in the database. It is executed immediately before or
after the execution of INSERT, UPDATE, and DELETE commands.

18) What is the maximum number of triggers, you can apply on a single
table?

12 triggers.

19) How many types of triggers exist in PL/SQL?

There are 12 types of triggers in PL/SQL that contains the combination of BEFORE, AFTER, ROW,
TABLE, INSERT, UPDATE, DELETE and ALL keywords.

BEFORE ALL ROW INSERT


AFTER ALL ROW INSERT
BEFORE INSERT
AFTER INSERT etc.

20) What is the difference between execution of triggers and stored


procedures?

A trigger is automatically executed without any action required by the user, while, a stored
procedure is explicitly invoked by the user.

21) What happens when a trigger is associated to a view?

When a trigger is associated to a view, the base table triggers are normally enabled.

22) What is the usage of WHEN clause in trigger?

A WHEN clause specifies the condition that must be true for the trigger to be triggered.

https://www.javatpoint.com/pl-sql-interview-questions 7/17
2/1/22, 7:21 PM PL/SQL Interview Questions (2022) - javatpoint

23) How to disable a trigger name update_salary?

ALTER TRIGGER update_salary DISABLE;

24) Which command is used to delete a trigger?

DROP TRIGGER command.

25) what are the two virtual tables available at the time of database trigger
execution?

Table columns are referred as THEN.column_name and NOW.column_name.

For INSERT related triggers, NOW.column_name values are available only.

For DELETE related triggers, THEN.column_name values are available only.

For UPDATE related triggers, both Table columns are available.

26) What is stored Procedure?

A stored procedure is a sequence of statement or a named PL/SQL block which performs one or
more specific functions. It is similar to a procedure in other programming languages. It is stored in
the database and can be repeatedly executed. It is stored as schema object. It can be nested,
invoked and parameterized.

https://www.javatpoint.com/pl-sql-interview-questions 8/17
2/1/22, 7:21 PM PL/SQL Interview Questions (2022) - javatpoint

27) What are the different schemas objects that can be created using
PL/SQL?

Stored procedures and functions

Packages

Triggers

Cursors

28) What do you know by PL/SQL Cursors?

Oracle uses workspaces to execute the SQL commands. When Oracle processes a SQL command, it
opens an area in the memory called Private SQL Area. This area is identified by the cursor. It allows
programmers to name this area and access it?s information.

29) What is the difference between the implicit and explicit cursors?

Implicit cursor is implicitly declared by Oracle. This is a cursor to all the DDL and DML commands
that return only one row.

Explicit cursor is created for queries returning multiple rows.

30) What will you get by the cursor attribute SQL%ROWCOUNT?

The cursor attribute SQL%ROWCOUNT will return the number of rows that are processed by a SQL
statement.

31) What will you get by the cursor attribute SQL%FOUND?

It returns the Boolean value TRUE if at least one row was processed.

32) What will you get by the cursor attribute SQL%NOTFOUND?

It returns the Boolean value TRUE if no rows were processed.

33) What do you understand by PL/SQL packages?


https://www.javatpoint.com/pl-sql-interview-questions 9/17
2/1/22, 7:21 PM PL/SQL Interview Questions (2022) - javatpoint

A PL/SQL package can be specified as a file that groups functions, cursors, stored procedures, and
variables in one place.

34) What are the two different parts of the PL/SQL packages?

PL/SQL packages have the following two parts:

Specification part: It specifies the part where the interface to the application is defined.

Body part: This part specifies where the implementation of the specification is defined.

35) Which command is used to delete a package?

The DROP PACKAGE command is used to delete a package.

36) How to execute a stored procedure?

There are two way to execute a stored procedure.

From the SQL prompt, write EXECUTE or EXEC followed by procedure_name.

EXECUTE or [EXEC] procedure_name;  

Simply use the procedure name

procedure_name;  

37) What are the advantages of stored procedure?

Modularity, extensibility, reusability, Maintainability and one time compilation.

38) What are the cursor attributes used in PL/SQL?

%ISOPEN: it checks whether the cursor is open or not.

%ROWCOUNT: returns the number of rows affected by DML operations:


INSERT,DELETE,UPDATE,SELECT.

https://www.javatpoint.com/pl-sql-interview-questions 10/17
2/1/22, 7:21 PM PL/SQL Interview Questions (2022) - javatpoint

%FOUND: it checks whether cursor has fetched any row. If yes - TRUE.

%NOTFOUND: it checks whether cursor has fetched any row. If no - TRUE.

39) What is the difference between syntax error and runtime error?

A syntax error can be easily detected by a PL/SQL compiler. For example: incorrect spelling etc.
while, a runtime error is handled with the help of exception-handling section in a PL/SQL block. For
example: SELECT INTO statement, which does not return any rows.

40) Explain the Commit statement.

Following conditions are true for the Commit statement:

Other users can see the data changes made by the transaction.

The locks acquired by the transaction are released.

The work done by the transaction becomes permanent.

41) Explain the Rollback statement?

The Rollback statement is issued when the transaction ends. Following conditions are true for a
Rollback statement:

The work done in a transition is undone as if it was never issued.

All locks acquired by transaction are released.

https://www.javatpoint.com/pl-sql-interview-questions 11/17
2/1/22, 7:21 PM PL/SQL Interview Questions (2022) - javatpoint

42) Explain the SAVEPOINT statement.

With SAVEPOINT, only part of transaction can be undone.

43) What is mutating table error?

Mutating table error is occurred when a trigger tries to update a row that it is currently using. It is
fixed by using views or temporary tables.

44) What is consistency?

Consistency simply means that each user sees the consistent view of the data.

Consider an example: there are two users A and B. A transfers money to B's account. Here the
changes are updated in A's account (debit) but until it will be updated to B's account (credit), till
then other users can't see the debit of A's account. After the debit of A and credit of B, one can see
the updates. That?s consistency.

45) What is cursor and why it is required?

A cursor is a temporary work area created in a system memory when an SQL statement is
executed.

A cursor contains information on a select statement and the row of data accessed by it. This
temporary work area stores the data retrieved from the database and manipulate this data. A cursor
can hold more than one row, but can process only one row at a time. Cursor are required to process
rows individually for queries.

46) How many types of cursors are available in PL/SQL?

There are two types of cursors in PL/SQL.

1. Implicit cursor, and


2. explicit cursor

Java Basics Interview Questions Java OOPs Interview Questions

https://www.javatpoint.com/pl-sql-interview-questions 12/17
2/1/22, 7:21 PM PL/SQL Interview Questions (2022) - javatpoint

Java Multithreading Interview Java String & Exception Interview Questions


Questions

Java Collection Interview Questions JDBC Interview Questions

Servlet Interview Questions JSP Interview Questions

Spring Interview Questions Hibernate Interview Questions

PL/SQL Interview Questions SQL Interview Questions

Oracle Interview Questions Android Interview Questions

SQL Server Interview Questions MySQL Interview Questions

You may also like:

Java Interview Questions


SQL Interview Questions
Python Interview Questions
JavaScript Interview Questions
Angular Interview Questions
Selenium Interview Questions
Spring Boot Interview Questions
HR Interview Questions

https://www.javatpoint.com/pl-sql-interview-questions 13/17
2/1/22, 7:21 PM PL/SQL Interview Questions (2022) - javatpoint

C Programming Interview Questions


C++ Interview Questions
Data Structure Interview Questions
DBMS Interview Questions
HTML Interview Questions
IAS Interview Questions
Manual Testing Interview Questions
OOPs Interview Questions
.Net Interview Questions
C# Interview Questions
ReactJS Interview Questions
Networking Interview Questions
PHP Interview Questions
CSS Interview Questions
Node.js Interview Questions
Spring Interview Questions
Hibernate Interview Questions
AWS Interview Questions
Accounting Interview Questions

Learn Latest Tutorials

Splunk tutorial SPSS tutorial Swagger T-SQL tutorial


tutorial
Splunk SPSS Transact-SQL
Swagger

Tumblr tutorial React tutorial Regex tutorial Reinforcement


learning tutorial
Tumblr ReactJS Regex
Reinforcement
Learning

https://www.javatpoint.com/pl-sql-interview-questions 14/17
2/1/22, 7:21 PM PL/SQL Interview Questions (2022) - javatpoint

R Programming RxJS tutorial React Native Python Design


tutorial tutorial Patterns
RxJS
R Programming React Native Python Design
Patterns

Python Pillow Python Turtle Keras tutorial


tutorial tutorial
Keras
Python Pillow Python Turtle

Preparation

Aptitude Logical Verbal Ability Interview


Reasoning Questions
Aptitude Verbal Ability
Reasoning Interview Questions

Company
Interview
Questions
Company Questions

Trending Technologies

Artificial AWS Tutorial Selenium Cloud


Intelligence tutorial Computing
AWS
Tutorial tutorial
Selenium
Artificial Cloud Computing
Intelligence

Hadoop tutorial ReactJS Data Science Angular 7


Tutorial Tutorial Tutorial
Hadoop
ReactJS Data Science Angular 7

https://www.javatpoint.com/pl-sql-interview-questions 15/17
2/1/22, 7:21 PM PL/SQL Interview Questions (2022) - javatpoint

Blockchain Git Tutorial Machine DevOps


Tutorial Learning Tutorial Tutorial
Git
Blockchain Machine Learning DevOps

B.Tech / MCA

DBMS tutorial Data Structures DAA tutorial Operating


tutorial System tutorial
DBMS DAA
Data Structures Operating System

Computer Compiler Computer Discrete


Network tutorial Design tutorial Organization and Mathematics
Architecture Tutorial
Computer Network Compiler Design
Computer Discrete
Organization Mathematics

Ethical Hacking Computer Software html tutorial


Tutorial Graphics Tutorial Engineering
Web Technology
Tutorial
Ethical Hacking Computer Graphics
Software
Engineering

Cyber Security Automata C Language C++ tutorial


tutorial Tutorial tutorial
C++
Cyber Security Automata C Programming

Java tutorial .Net Python tutorial List of


Framework Programs
Java Python
tutorial
Programs
.Net

Control Data Mining Data


Systems tutorial Tutorial Warehouse
Tutorial
Control System Data Mining

https://www.javatpoint.com/pl-sql-interview-questions 16/17
2/1/22, 7:21 PM PL/SQL Interview Questions (2022) - javatpoint

Data Warehouse

https://www.javatpoint.com/pl-sql-interview-questions 17/17

You might also like