Top 10 Essential PLSQL Developer Interview Questions Part-3 (Ace Your Interview!)

PLSQL Developer Interview Questions

In the competitive landscape of technology careers, mastering the art of interviewing is crucial for aspiring PL/SQL developers. This blog post, Top 10 Essential PL/SQL Developer Interview Questions Part-3 (Ace Your Interview!), aims to equip job seekers, students, and tech enthusiasts with the knowledge they need to excel in their interviews. By exploring key PL/SQL developer interview questions, we provide insights and tips that will enhance your preparation and boost your confidence. Whether you are a seasoned professional or new to the field, this guide will help you navigate the interview process and stand out as a candidate.

1. What is the difference between SQL and PLSQL?

SQLPL/SQL
SQL is Structured Query LanguageAt a time in SQL we can execute only one statement
Sql directly interacts with database serverPlsql won’t interacts directly with database server
Sql won’t support for loop, if conditionsPlsql support for loop, if conditions, while loop
Sql won’t support variablesPlsql support variables and data types
Sql is data oriented languagePlsql is application oriented language
Sql is mainly used to manipulate dataPlsql is mainly used to create an application
At a time in sql we can execute only one statementAt a time in plsql we can execute multiple statements

2. What is the Difference between procedure and function?

FUNCTIONPROCEDURE
Function can be called inside select statementProcedure cannot be called inside the select statement
Function must return a valueProcedure may or may not return a value
We can use return statement inside a functionWe can use return statement inside a procedure. But that doesn’t act like the return statement inside the function
In functions, we can use DML operations. But the functions with dml operations cannot be called inside the select statementIn procedures, we can use DML operations
If we want to call the functions with dml operations inside the select statement, then we can use pragma autonomous transaction + tcl commandIrrespective of dml operations, we cannot call procedure inside select statement
Out parameter is not required inside the function, as function must return a valueIf we want any output in procedure then we can use out parameter
If we want, we can use out parameter in function but that function cannot be called inside the select statementIrrespective of out parameter , we cannot call procedure inside select statement

3. Difference between constraint and trigger?

TRIGGERCONSTRAINT
Trigger is user-definedConstraint is pre-defined
Trigger is 3 types i.e DDL ,DML , DATABASEConstraints are 4 types UNIQUE KEY, PRIMARY KEY , CHECK key, FOREIGN KEY
Triggers can be written on tables, schema, databaseConstraints can be created only on columns
Trigger can be seen and modify the codeConstraints code cannot be seen and cannot be modified as they are encrypted
Constraints always follow same rules and regulationsConstraints always follow the same rules and regulations
To see triggers in our schema:
Select * from user_triggers
To see constraints in our schema:
Select * from user_constraints
Whatever we cannot handle through constraints that can be handled through triggers.By using constraints we cannot maintain audit_table

4. Difference between Procedure and Trigger ?

TRIGGERPROCEDURE
Trigger fires implicitlyProcedure fires explicitly
We cannot give parameters to triggersWe can debug the procedure
Anyone can call the procedure and use itWe can give parameters to a procedure
We can drop the procedureWe cannot debug the trigger
We can call procedure inside triggersWe cannot call triggers inside procedures
We can disable or enable triggersWe can drop procedure
Triggers are mainly used to avoid transaction, to maintain audit, to do one action while another action is going onProcedure is mainly used to do calculations

5. Difference between Procedure and Package?

Package Procedure
Package is a collection of related objectsProcedure is a standalone object with a set of statements
Package has 2 parts SPEC & BODYProcedure has no parts. Complete procedure we can write in one area
If we call any program in the package then entire package will come and store in the ram until the session endIf we call procedure, then the procedure will come and store in ram until program execution only
If we declare variables in the package spec, they become global and can be used inside and outside the package.Procedure variables are local variables
If we want to declare any objects that can be done only in package spec, if we want to write any function or procedure, we can do it in package body.In procedure both variable declaration and body will be in one area
Packages support function overloading, forward declaration, on time procedureThose we cannot see in procedures
Packages are mainly used to develop a moduleProcedures are mainly used to do calculations

6. Difference between Implicit cursor and Explicit cursor?

IMPLICIT CURSOREXPLICIT CURSOR
If we want to check the status of dml operations in plsql block, then we will use “implicit cursor”Explicit cursor is used to fetch records in plsql block
Implicit cursor is used to know the status of ‘into clause’Into clause is there to fetch record, but it will fetch only one record. If we want to fetch more than one record then we will use explicit cursor.
Implicit cursor has a key word called ‘SQL’In explicit cursor whatever name we want, we can give
Implicit cursor has 3 attributes FOUND, NOTFOUND ,ROWCOUNTExplicit cursor has 4 attributes i.e FOUND ,NOTFOUND ,ROWCOUNT, ISOPEN
Implicit cursor has no typesExplicit cursor has 3 types BASIC CURSOR, CURSOR FOR LOOP, CUROSR FOR LOOP WITH SELECT STATEMENT

7. Advantages and Disadvantages of Packages

Advantages of packages :

  • Package is used to develop module of an application and help us to maintain our application in more efficient way.
  • If we call any packaged program then entire package will come and store in the ram until the session end, if we call any other program of the same package it will be executed immediately as the entire package has stored in the ram and no need to go and search in the database.
  • If we declare any function/procedure/variable/collection/cursor in the package spec then these objects will be global. They can be used inside the package and outside the package.
  • Package is collection of related objects.
  • Package supports function overloading means we can write any no. of functions of procedures inside package with same name but the no. of parameters must be different.
  • When we declare variables in package spec then they will become global variables.
  • If we can drop package, then both spec and body will be dropped at a time. We cannot drop separately.

Disadvantages of packages :

  • Without package spec we cannot write package body.
  • It occupies space.
  • Package won’t support backward navigation.

8. Difference between raise and raise application error ?

RAISERAISE APPLICATION ERROR
Raise needs 3 sections DECLARATION SECTION HANDLING SECTION EXCEPTION SECTIONRAE needs only one section HANDLING SECTION
Raise doesn’t need any error numberRAE needs error number between -20000 to -20999
Raise will terminate the program there itself and enters the exception sectionRAE will terminate the program there itself and shows error message on the screen.
Raise won’t rollback the previous DML operationsRAE will rollback all the previous DML operations

9. Difference between cursor and collection ?

CURSORCOLLECTION
Cursor fetches data record by recordCollection fetches all data at time
Cursor requires more no. of context switches to fetch dataCollection requires only one context switch to fetch data
Cursor has global type called
sys refcursor
Collection has no global data type
In cursors, we can use normal variables and collection variablesIn collection, we must use collection variable
Cursor has 3 types IMPLICIT CURSOR ,EXPLICIT CURSOR ,REF CURSORCollection has only one type BULK COLLECT
Cursor has attributesCollection has methods
We can use into clause and bulk collect into clauseWe can use only bulk collect into clause
Cursor supports only forward navigationCollection supports both forward and backward navigation
There are 2 types of errors in cursors INVALID CURSOR ,CURSOR IS ALREADY OPENThere are 4 types of errors in collection NO DATA FOUND, SUBSCRIPT BEYOND COUNT, SUBSCRIPT OUT OF LIMIT ,REFERENCE TO UNINITIALIZED COLLECTION

10. What is bulk bind and Bulk Limit ?

Bulk Bind :

JOINS
Mastering Oracle SQL Joins: The Ultimate Guide to Data Retrieval and Performance
  • oracle uses two engines to execute plsql code. All the program code is handled by plsql engine and all the sql statements are handled by sql engine.
  • When we write any dml statement in collection loop then it will be considered as separate statement. So to execute each dml statement separate context switch is required, to avoid this we will use bulk bind.
  • Bulk bind will wait till the end of loop, bind all the dml statements and in one shot it will send them to sql engine.

Bulk Limit :

  • PLSQL collections are in memory. Massive collections may affect the performance of the system due to huge amount of data. So to avoid this we will use bulk limit.
  • Bulk limit will chunk the huge data of collection and process each chunk in one turn. Bulk limit we have to write along with collection only.

Latest Posts :

Categories :

Oracle Interview Questions
Master Oracle Interview Questions: Key Concepts & Examples for 2024

An experienced PostgreSQL DBA/SQL developer with years of expertise in designing and implementing robust database solutions. Proficient in writing complex queries, developing stored procedures, and conducting performance tuning to deliver highly efficient data-driven applications that meet business requirements. If any queries feel free to contact us at ganeshpudi12@gmail.com

5 thoughts on “Top 10 Essential PLSQL Developer Interview Questions Part-3 (Ace Your Interview!)”

  1. Clear Explanation and the good thing is mainly focused on the differences between functions and database objects which is crucial for the interview.

    Reply

Leave a Reply

Home
SQL
PLSQL
Interview Q&A