Forum

PL/SQL Interview Qu...
 
Share:
Notifications
Clear all

PL/SQL Interview Questions for Oracle Developer Roles in TCS & Infosys (2025 Edition)

1 Posts
1 Users
0 Reactions
216 Views
Posts: 134
Admin
Topic starter
(@sql-admin)
Reputable Member
Joined: 6 years ago

If you’re applying for an Oracle Developer role in TCS or Infosys (2025), PL/SQL knowledge is a key differentiator.
These real-world interview questions have been compiled from recent candidate experiences and technical rounds conducted by top Indian IT companies.

You’ll find everything from triggers, procedures, and exception handling to performance tuning and cursor management — all in one concise guide.


🔹 Top PL/SQL Interview Questions & Answers (2025 Edition)

1️⃣ What is PL/SQL and how is it different from SQL?

Answer:

  • SQL is a query language for interacting with the database.

  • PL/SQL (Procedural Language for SQL) adds programming features like loops, conditions, and error handling.
    ✅ Used in TCS technical rounds to test your foundation.


2️⃣ What are the different types of PL/SQL blocks?

  1. Anonymous Block – unnamed, executed once.

  2. Named Block – stored as procedure, function, or trigger.

  3. Nested Block – blocks inside another block for modular code.


3️⃣ What is the difference between a procedure and a function?

FeatureProcedureFunction
Returns valueNoYes
Used in SQLNoYes
PurposePerform actionReturn a computation result

Example function:

 
CREATE OR REPLACE FUNCTION get_bonus(sal NUMBER)
RETURN NUMBER AS
BEGIN
RETURN sal * 0.1;
END;

4️⃣ What are triggers in PL/SQL?

Triggers are special stored programs that automatically execute when a database event occurs (INSERT, UPDATE, DELETE).
Example:

 
CREATE OR REPLACE TRIGGER trg_audit
AFTER INSERT ON employees
FOR EACH ROW
BEGIN
INSERT INTO audit_log(emp_id, created_on)
VALUES(:NEW.emp_id, SYSDATE);
END;

Frequently asked in Infosys project-based interviews.


5️⃣ What is a cursor? What are its types?

Cursors are pointers to result sets of SQL queries.

  • Implicit Cursor – created automatically for simple queries.

  • Explicit Cursor – declared by the developer for complex queries.
    Example:

 
CURSOR emp_cur IS SELECT emp_id, salary FROM employees;

6️⃣ How do you handle exceptions in PL/SQL?

PL/SQL uses the EXCEPTION block for error handling.

 
BEGIN
SELECT salary INTO v_sal FROM employees WHERE emp_id = 100;
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('Employee not found');
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Error occurred');
END;

7️⃣ What is the difference between %TYPE and %ROWTYPE?

  • %TYPE: Refers to the data type of a variable/column.

  • %ROWTYPE: Represents a complete row of a table.
    Example:

 
v_name employees.name%TYPE;
v_row employees%ROWTYPE;

8️⃣ How can you improve PL/SQL performance?

  • Use bulk operations (FORALL, BULK COLLECT)

  • Avoid too many context switches between SQL and PL/SQL

  • Use bind variables

  • Analyze execution plans

Asked in both TCS & Infosys performance optimization rounds.


9️⃣ Explain the use of packages in PL/SQL.

Packages group related procedures, functions, and variables.
They improve performance by loading once into memory.
Example:

 
CREATE OR REPLACE PACKAGE emp_pkg AS
PROCEDURE get_details(p_id NUMBER);
END emp_pkg;

🔟 What are autonomous transactions?

An autonomous transaction is independent of the main transaction — used in logging or auditing.

 
PRAGMA AUTONOMOUS_TRANSACTION;

Used frequently in Infosys finance domain projects for audit tracking.


💡 Pro Tip:

When answering PL/SQL questions, always add a real project use-case — for example:

“We used triggers to maintain a daily audit log for employee record changes in Oracle HRMS.”

This adds depth and shows hands-on experience.


🧩 Conclusion

These PL/SQL interview questions for TCS and Infosys (2025) prepare you for both theoretical and practical rounds.
Focus on writing clean, optimized, and modular PL/SQL code — as recruiters value logic clarity, performance awareness, and debugging skills more than memorized syntax.


Leave a reply

Author Name

Author Email

Title *

 
Preview 0 Revisions Saved
Share: