
Domains
Agile Management
Master Agile methodologies for efficient and timely project delivery.
View All Agile Management Coursesicon-refresh-cwCertifications
Scrum Alliance
16 Hours
Best Seller
Certified ScrumMaster (CSM) CertificationScrum Alliance
16 Hours
Best Seller
Certified Scrum Product Owner (CSPO) CertificationScaled Agile
16 Hours
Trending
Leading SAFe 6.0 CertificationScrum.org
16 Hours
Professional Scrum Master (PSM) CertificationScaled Agile
16 Hours
SAFe 6.0 Scrum Master (SSM) CertificationAdvanced Certifications
Scaled Agile, Inc.
32 Hours
Recommended
Implementing SAFe 6.0 (SPC) CertificationScaled Agile, Inc.
24 Hours
SAFe 6.0 Release Train Engineer (RTE) CertificationScaled Agile, Inc.
16 Hours
Trending
SAFe® 6.0 Product Owner/Product Manager (POPM)IC Agile
24 Hours
ICP Agile Certified Coaching (ICP-ACC)Scrum.org
16 Hours
Professional Scrum Product Owner I (PSPO I) TrainingMasters
32 Hours
Trending
Agile Management Master's Program32 Hours
Agile Excellence Master's ProgramOn-Demand Courses
Agile and ScrumRoles
Scrum MasterTech Courses and Bootcamps
Full Stack Developer BootcampAccreditation Bodies
Scrum AllianceTop Resources
Scrum TutorialProject Management
Gain expert skills to lead projects to success and timely completion.
View All Project Management Coursesicon-standCertifications
PMI
36 Hours
Best Seller
Project Management Professional (PMP) CertificationAxelos
32 Hours
PRINCE2 Foundation & Practitioner CertificationAxelos
16 Hours
PRINCE2 Foundation CertificationAxelos
16 Hours
PRINCE2 Practitioner CertificationSkills
Change ManagementMasters
Job Oriented
45 Hours
Trending
Project Management Master's ProgramUniversity Programs
45 Hours
Trending
Project Management Master's ProgramOn-Demand Courses
PRINCE2 Practitioner CourseRoles
Project ManagerAccreditation Bodies
PMITop Resources
Theories of MotivationCloud Computing
Learn to harness the cloud to deliver computing resources efficiently.
View All Cloud Computing Coursesicon-cloud-snowingCertifications
AWS
32 Hours
Best Seller
AWS Certified Solutions Architect - AssociateAWS
32 Hours
AWS Cloud Practitioner CertificationAWS
24 Hours
AWS DevOps CertificationMicrosoft
16 Hours
Azure Fundamentals CertificationMicrosoft
24 Hours
Best Seller
Azure Administrator CertificationMicrosoft
45 Hours
Recommended
Azure Data Engineer CertificationMicrosoft
32 Hours
Azure Solution Architect CertificationMicrosoft
40 Hours
Azure DevOps CertificationAWS
24 Hours
Systems Operations on AWS Certification TrainingAWS
24 Hours
Developing on AWSMasters
Job Oriented
48 Hours
New
AWS Cloud Architect Masters ProgramBootcamps
Career Kickstarter
100 Hours
Trending
Cloud Engineer BootcampRoles
Cloud EngineerOn-Demand Courses
AWS Certified Developer Associate - Complete GuideAuthorized Partners of
AWSTop Resources
Scrum TutorialIT Service Management
Understand how to plan, design, and optimize IT services efficiently.
View All DevOps Coursesicon-git-commitCertifications
Axelos
16 Hours
Best Seller
ITIL 4 Foundation CertificationAxelos
16 Hours
ITIL Practitioner CertificationPeopleCert
16 Hours
ISO 14001 Foundation CertificationPeopleCert
16 Hours
ISO 20000 CertificationPeopleCert
24 Hours
ISO 27000 Foundation CertificationAxelos
24 Hours
ITIL 4 Specialist: Create, Deliver and Support TrainingAxelos
24 Hours
ITIL 4 Specialist: Drive Stakeholder Value TrainingAxelos
16 Hours
ITIL 4 Strategist Direct, Plan and Improve TrainingOn-Demand Courses
ITIL 4 Specialist: Create, Deliver and Support ExamTop Resources
ITIL Practice TestData Science
Unlock valuable insights from data with advanced analytics.
View All Data Science Coursesicon-dataBootcamps
Job Oriented
6 Months
Trending
Data Science BootcampJob Oriented
289 Hours
Data Engineer BootcampJob Oriented
6 Months
Data Analyst BootcampJob Oriented
288 Hours
New
AI Engineer BootcampSkills
Data Science with PythonRoles
Data ScientistOn-Demand Courses
Data Analysis Using ExcelTop Resources
Machine Learning TutorialDevOps
Automate and streamline the delivery of products and services.
View All DevOps Coursesicon-terminal-squareCertifications
DevOps Institute
16 Hours
Best Seller
DevOps Foundation CertificationCNCF
32 Hours
New
Certified Kubernetes AdministratorDevops Institute
16 Hours
Devops LeaderSkills
KubernetesRoles
DevOps EngineerOn-Demand Courses
CI/CD with Jenkins XGlobal Accreditations
DevOps InstituteTop Resources
Top DevOps ProjectsBI And Visualization
Understand how to transform data into actionable, measurable insights.
View All BI And Visualization Coursesicon-microscopeBI and Visualization Tools
Certification
24 Hours
Recommended
Tableau CertificationCertification
24 Hours
Data Visualization with Tableau CertificationMicrosoft
24 Hours
Best Seller
Microsoft Power BI CertificationTIBCO
36 Hours
TIBCO Spotfire TrainingCertification
30 Hours
Data Visualization with QlikView CertificationCertification
16 Hours
Sisense BI CertificationOn-Demand Courses
Data Visualization Using Tableau TrainingTop Resources
Python Data Viz LibsCyber Security
Understand how to protect data and systems from threats or disasters.
View All Cyber Security Coursesicon-refresh-cwCertifications
CompTIA
40 Hours
Best Seller
CompTIA Security+EC-Council
40 Hours
Certified Ethical Hacker (CEH v12) CertificationISACA
22 Hours
Certified Information Systems Auditor (CISA) CertificationISACA
40 Hours
Certified Information Security Manager (CISM) Certification(ISC)²
40 Hours
Certified Information Systems Security Professional (CISSP)(ISC)²
40 Hours
Certified Cloud Security Professional (CCSP) Certification16 Hours
Certified Information Privacy Professional - Europe (CIPP-E) CertificationISACA
16 Hours
COBIT5 Foundation16 Hours
Payment Card Industry Security Standards (PCI-DSS) CertificationOn-Demand Courses
CISSPTop Resources
Laptops for IT SecurityWeb Development
Learn to create user-friendly, fast, and dynamic web applications.
View All Web Development Coursesicon-codeBootcamps
Career Kickstarter
6 Months
Best Seller
Full-Stack Developer BootcampJob Oriented
3 Months
Best Seller
UI/UX Design BootcampEnterprise Recommended
6 Months
Java Full Stack Developer BootcampCareer Kickstarter
490+ Hours
Front-End Development BootcampCareer Accelerator
4 Months
Backend Development Bootcamp (Node JS)Skills
ReactOn-Demand Courses
Angular TrainingTop Resources
Top HTML ProjectsBlockchain
Understand how transactions and databases work in blockchain technology.
View All Blockchain Coursesicon-stop-squareBlockchain Certifications
40 Hours
Blockchain Professional Certification32 Hours
Blockchain Solutions Architect Certification32 Hours
Blockchain Security Engineer Certification24 Hours
Blockchain Quality Engineer Certification5+ Hours
Blockchain 101 CertificationOn-Demand Courses
NFT Essentials 101: A Beginner's GuideTop Resources
Blockchain Interview QsProgramming
Learn to code efficiently and design software that solves problems.
View All Programming Coursesicon-codeSkills
Python CertificationInterview Prep
Career Accelerator
3 Months
Software Engineer Interview PrepOn-Demand Courses
Data Structures and Algorithms with JavaScriptTop Resources
Python TutorialDatabase
4.6 Rating 95 Questions 55 mins read39 Readers

This is a frequently asked question in PL SQL interview questions.
PL/SQL is an extension for SQL and Oracle. It enhances the capabilities of SQL. Therefore, with every release of the Oracle Database, the feature and functionalities of PL/SQL are enhanced.
It is available in Oracle Database since version 6. However, PL/SQL is also available in TimesTen in-memory database since version 11.2.1 and IBM DB2 since version 9.7.
PL/SQL is strongly integrated with SQL and supports both static and dynamic SQL.
The following are the features in PL/SQL:
PL/SQL is an extension for SQL and Oracle. It enhances the capabilities of SQL. Therefore, with every release of the Oracle Database, the feature and functionalities of PL/SQL is enhanced.
It is available in Oracle Database since version 6. However, PL/SQL is also available in TimesTen in-memory database since version 11.2.1 and IBM DB2 since version 9.7.
TL/SQL is Transact Structure Query language. T-SQL expands on the SQL standard to add procedural programming, local variables, etc. It is Microsoft's and Sybase's proprietary extension to the SQL.
The following are the differences:
| Basis | PL/SQL | T/SQL |
|---|---|---|
| Efficiency | It is more powerful than T/SQL. | T/SQL is less powerful than PL/SQL. |
| Relation with SQL | PL/SQL is an extension for SQL and Oracle. It enhances the capabilities of SQL. | T-SQL expands on the SQL standard to add procedural programming, local variables, etc. |
| Full Form | PL SQL is Procedural Language Structural Query Language. | TL SQL is Transact Structure Query language. |
| Compatibility | PL-SQL works best with Oracle database Server. | T-SQL works best with Microsoft SQL Server |
| Easier/ Complex | PL/SQL is considered complex to learn than T/SQL | It is easier to learn and work with T/SQL. |
| Developer | It is developed and owned by Oracle. | T/SQL is Microsoft's and Sybase's proprietary extension to the SQL. |
PL/SQL is an extension for SQL and Oracle. It enhances the capabilities of SQL. Therefore, with every release of the Oracle Database, the feature and functionalities of PL/SQL is enhanced. It is available in Oracle Database since version 6. However, PL/SQL is also available in TimesTen in-memory database since version 11.2.1 and IBM DB2 since version 9.7.
SQL is a domain-specific language used in programming. It is a Structured Query Language for database creation, deletion, fetching rows, modifying rows, etc. relational database management system
The following are the differences:
| Basis | PL/SQL | SQL |
|---|---|---|
| Embed | Can have SQL embedded in it. | Cannot have PL/SQL code embedded in it. |
| Interaction with database server | There is no interaction with the database server. | Interaction with the database server. |
| How/What | PL/SQL defines how it needs to be done. | Defines what needs to be done. |
| Writing program/functions/procedures | PL/SQL is used to write program blocks, functions, procedures triggers, etc. | SQL is used to write queries, DDL and DML statements. |
| Execution | Executes as a whole block. | Issue a single query or execute a single insert/update/delete. Executes one statement at a time. |
PL/SQL is an extension for SQL and Oracle. It enhances the capabilities of SQL. Therefore, with every release of the Oracle Database, the feature and functionalities of PL/SQL is enhanced. It is strongly integrated with SQL and supports both static and dynamic SQL.
The following are the characteristics of PL/SQL:
Expect to come across this popular question in PL SQL questions.
Oracle forms a memory area when an SQL statement is processed. This memory area is called the context area. A cursor in PL/SQL is a pointer to this context area. It has information about processing the statement. A PL/SQL cursor holds the rows (one or more) returned by a SQL statement.
The following are the two forms of cursors:
Implicit cursors in PL/SQL are created automatically by Oracle when an SQL statement is executed. This occurs when there is no explicit cursor for the statement.
An implicit cursor is associated when INSERT, UPDATE, and DELETE is issued. The attributes include %FOUND, %ISOPEN, %NOTFOUND, etc. With the attributes, you can check which rows got affected by the operation.
The attributes:
To use any of the above attributes, use the following syntax:
sql%attribute_name
Above, set any attribute name under “attribute_name”.Let us consider the following table for our example:
<DEPTBUDGET> +-----------+-----------------+---------------+------------------+ | DEPTID | DEPTNAME | DEPTLOC | BUDGET| +----------+------------------+---------------+------------------+ | 1 | Finance | NORTH | 56678 | | 2 | Marketing | EAST | 87687 | | 3 | Operations | WEST | 95979 | | 4 | Technical | SOUTH | 76878 | | 5 | Accounting | NORTHWEST| 86767 | +----------+------------------+------------------+--------------+
Now, we will update the budget of all the departments and then check what all rows got affected using the implicit cursor attribute. With that, we will use other attributes as well:
DECLARE
rows_count number(2);
BEGIN
UPDATE deptbudget
SET budget = budget + 3000;
IF sql%notfound THEN
dbms_output.put_line('Nothing selected!');
ELSIF sql%found THEN
rows_count := sql%rowcount;
dbms_output.put_line( rows_count || ' rows affected! ');
END IF;
END;
/ The output:
5 rows affected!
Since we updated the budget for all the departments above, our table rows would look like this:
<DEPTBUDGET> +-----------+-----------------+---------------+------------------+ | DEPTID | DEPTNAME | DEPTLOC | BUDGET| +----------+------------------+---------------+------------------+ | 1 | Finance | NORTH | 59678 | | 2 | Marketing | EAST | 90687 | | 3 | Operations | WEST | 98979 | | 4 | Technical | SOUTH | 79878 | | 5 | Accounting | NORTHWEST| 89767 | +----------+------------------+------------------+--------------+
Explicit cursors are custom defined i.e. programmer-defined cursors that give more control over the context area. Oracle forms a memory area when an SQL statement is processed, which is called a context area.
The following is the syntax to create an explicit cursor:
CURSOR name_of_cursor IS select_statement;
Here,
“name_of_cursor” is the cursor name
As you can see above, an explicit cursor is created on a SELECT statement. Let us now see how to work with Explicit Cursors,
Let us declare a cursor and set a cursor name with the SELECT statement:
CURSOR d_deptbudget IS SELECT deptid, deptname, deptloc, budget FROM deptbudget;
Above, “d_deptbudget” is our cursor.
The memory gets allocated for the cursor when it is opened in PL/SQL. Opening the cursor allocates the memory for the cursor and makes it ready for fetching the rows returned by the SQL statement into it.
OPEN d_deptbudget;
Access one row at a time when a cursor is fetched in PL/SQL. The following is when you fetch a cursor that is already opened:
FETCH d_deptbudget INTO d_deptid, d_deptname, d_deptloc, d_budget;
When a cursor is closed, then the allocated memory is released. To close the above-created cursor:
CLOSE d_deptbudget;
Let us now see an example of working with explicit cursors in PL/SQL:
DECLARE d_deptid deptbudget.deptid%type; d_deptname deptbudget.deptname%type; CURSOR d_deptbudget IS SELECT deptid, deptname FROM deptbudget; BEGIN OPEN d_deptbudget; LOOP FETCH d_deptbudget into d_deptid, d_deptname; EXIT WHEN d_deptbudget%notfound; dbms_output.put_line(d_deptid || ' ' || d_deptname); END LOOP; CLOSE d_deptbudget; END; /
The output display department id and name:
1 Finance 2 Marketing 3 Operations 4 Technical 5 Accounting
A staple in PL SQL interview questions, be prepared to answer this one.
The COLLECTION_IS_NULL exception is raised when a program attempts to apply collection methods other than EXISTS to an uninitialized nested table or varray, or the program attempts to assign values to the elements of an uninitialized nested table or varray.
The dot(.) operator is to be used in PL/SQL to access the fields of a record. This is between the record variable and the field.
Let us take an example of a record. This is how you can declare:
DECLARE TYPE laptop IS RECORD (brand varchar(50), RAM number, SNO number, ); l1 laptop; l1 laptop;
You can now access the fields using the dot(.) operator.
The following is the example wherein we have created user-define records and accesses the fields:
DECLARE
TYPE laptop IS RECORD
(brand varchar(50),
RAM number,
SNO number
);
lp1 laptop;
lp2 laptop;
lp3 laptop;
BEGIN
-- Laptop 1 specification
lp1.brand:= 'Dell';
lp1.RAM:= 4;
lp1.SNO:= 87667;
-- Laptop 2 specification
lp2.brand:= 'Lenevo';
lp2.RAM:= 4;
lp2.SNO:= 47656;
-- Laptop 3 specification
lp3.brand:= 'HP';
lp3.RAM:= 8;
lp3.SNO:= 98989;
-- Laptop 1 record
dbms_output.put_line('Laptop 1 Brand = '|| lp1.brand);
dbms_output.put_line('Laptop 1 RAM = '|| lp1.RAM);
dbms_output.put_line('Laptop 1 SNO = ' || lp1.SNO);
-- Laptop 2 record
dbms_output.put_line('Laptop 2 Brand = '|| lp2.brand);
dbms_output.put_line('Laptop 2 RAM = '|| lp2.RAM);
dbms_output.put_line('Laptop 2 SNO = ' || lp2.SNO);
-- Laptop 3 record
dbms_output.put_line('Laptop 3 Brand = '|| lp3.brand);
dbms_output.put_line('Laptop 3 RAM = '|| lp3.RAM);
dbms_output.put_line('Laptop 2 SNO = ' || lp3.SNO);
END;The output:
Laptop 1 Brand = Dell Laptop 1 RAM = 4 Laptop 1 SNO = 87667 Laptop 2 Brand = Lenevo Laptop 2 RAM = 4 Laptop 2 SNO = 47656 Laptop 3 Brand = HP Laptop 3 RAM = 8 Laptop 2 SNO = 98989
This question is a regular feature in PL SQL interview questions, be ready to tackle it.
One of the Collection types in PL/SQL is Index-By table. These are also called Associative Arrays. It gets created only in the PL/SQL block. The subscript type for Associative Array is a string or integer.
Associative Array is a set of key-value pairs. The key here can be an Integer or String. The following is the syntax:
TYPE type_name IS TABLE OF element_type [NOT NULL] INDEX BY subscript_type; name_of_table type_name;
Here, index-by table is the name_of_table. The keys of the subscript_type. The associated values will be of the element_type i.e. NUMBER, etc.
The following is an example:
DECLARE
TYPE budget IS TABLE OF NUMBER INDEX BY VARCHAR2(15);
dept_budget budget ;
dept_name VARCHAR2(20);
BEGIN
dept_budget ('Operations') := 30000;
dept_budget ('Finance') := 25000;
dept_budget ('Accounts') := 45000;
dept_name := dept_budget.FIRST;
WHILE dept_name IS NOT null LOOP
dbms_output.put_line
('Budget - ' || dept_name || ' Department = ' || TO_CHAR(dept_budget (dept_name )));
dept_name := dept_budget .NEXT(dept_name );
END LOOP;
END;
/The output:
Budget - Accounts Department = 45000 Budget - Finance Department = 25000 Budget - Operations Department = 30000
This is a frequently asked question in PLSQL interview questions.
The TIMESTAMP WITH TIME ZONE datatype is used for date information across geographic regions.
It has a time zone region name or a time zone offset in its value. TIME ZONE offset = difference in hours and minutes between local time and UTC.
A must-know for anyone heading into a PL SQL interview, this question is frequently asked in PL SQL interview questions.
Yes, this is correct. Here, the WHEN clause is used for conditions, which are from top to bottom. The sequence of statements with the WHEN clause whose condition evaluates to TRUE is executed. Only the first statement executes if more than one condition evaluates to TRUE.
The following is the syntax:
CASE WHEN condition_1 THEN statements_1 WHEN condition_2 THEN statements_2 ... WHEN condition_n THEN statements_n [ ELSE else_statements ] END CASE;]
Let us see an example:
DECLARE
points number := 100;
BEGIN
case
when points = 20 then dbms_output.put_line('Rank 4');
when points = 50 then dbms_output.put_line('Rank 3');
when points = 75 then dbms_output.put_line('Rank 2');
when points = 100 then dbms_output.put_line('Rank1... Topper');
else dbms_output.put_line('No ranking!');
end case;
END;
/The output:
Rank1... Topper
One of the most frequently posed PLSQL interview questions for experienced, be ready for it.
In PL/SQL, packages are the schema objects that group logically related PL/SQL types and variables. A Package has the following two parts:
The specification has information about the package content. It declares the types, variables, constants, cursors, etc. It excludes the code for subprograms. The objects in the specification are the public object, however, a subprogram not part of the specification is a private object.
The Package Body has the implementation of subprogram declared in the specification. To create Package Body, use the CREATE PACKAGE BODY statement.
The following is our sample table:
<DEPTBUDGET> +-----------+-----------------+---------------+------------------+ | DEPTID | DEPTNAME | DEPTLOC | BUDGET| +----------+------------------+---------------+------------------+ | 1 | Finance | NORTH | 56678 | | 2 | Marketing | EAST | 87687 | | 3 | Operations | WEST | 98979 | | 4 | Technical | SOUTH | 76878 | | 5 | Accounting | NORTHWEST| 86767 | +----------+------------------+------------------+--------------+
The following is an example wherein we have a package “dept_pck”:
CREATE OR REPLACE PACKAGE BODY dept_pck AS
PROCEDURE get_budget(d_id deptbudget.id%TYPE) IS
d_budget deptbudget.budget%TYPE;
BEGIN
SELECT budget INTO d_budget
FROM deptbudget
WHERE id = d_id;
dbms_output.put_line('Department Budget: '|| d_budget);
END get_budget;
END dept_pck;
/On executing the above code, the following is visible:
Package body created.
Now, to access the package variable, procedures, etc, you can use the dot operator as shown below:
package_name.element_name;
Continuing our example:
DECLARE myid deptbudget.id%type := &dd_id; BEGIN dept_pck. get_budget (myid); END; /
When you run the above code, you need to input the department id. Let’s say your input is department id 3, the output would be:
Department Budget: 98979
Expect to come across this popular question in advanced PL SQL interview questions.
With NOT INSTANTIABLE clause in PL/SQL, you can declare an abstract object. To work with it, you must create a subtype of such objects to use its functionalities.
It's no surprise that this one pops up often in PL SQL interview questions for experienced.
The HEXTORAW in PL/SQL was introduced to convert a hexadecimal value into a raw value. An example here displays the same:
HEXTORAW('7E')The output:
7E
One of the most frequently posed PL SQL developer interview questions, be ready for it.
The INVALID_NUMBER exception is raised when the conversion of a character string into a number fails because the string does not represent a valid number.
The existing trigger is recreated by the optional argument [OR REPLACE] in a CREATE TRIGGER command.