Senior Plsql Developer

20+ Senior Plsql Developer Interview Questions and Answers

Updated 11 Dec 2024
search-icon

Q1. Did you ever work on query tuning and optimization? What do you see in explain plan?

Ans.

Yes, I have worked on query tuning and optimization. Explain plan helps in identifying the execution plan of a query.

  • I have experience in identifying and resolving performance issues in SQL queries.

  • I use explain plan to analyze the query execution plan and identify any bottlenecks.

  • I look for factors like full table scans, index usage, and join methods to optimize the query.

  • I also use tools like SQL Trace and TKPROF to identify performance issues.

  • For example, I optimized a que...read more

Q2. How to write package what are the syntax of creating package and some inside of package.

Ans.

A package is a collection of related functions, procedures, and other program objects.

  • Syntax: CREATE [OR REPLACE] PACKAGE package_name AS

  • Package can contain variables, constants, cursors, exceptions, types, subprograms.

  • Syntax: CREATE [OR REPLACE] PACKAGE BODY package_name AS

  • Package body contains the implementation of the subprograms declared in the package specification.

Q3. Difference between PK & UK. How many Nulls are allowed for UK

Ans.

PK is Primary Key and UK is Unique Key. PK does not allow nulls while UK allows only one null value.

  • PK is used to uniquely identify each record in a table, while UK ensures that all values in a column are unique.

  • PK does not allow duplicate values, while UK allows duplicate values except for one null value.

  • Example: If a table has a PK on column 'ID', each record must have a unique ID value. If a table has a UK on column 'Email', all email values must be unique except for one n...read more

Q4. How to debug procedure which has nested procedure in it.

Ans.

Debugging a procedure with nested procedure.

  • Use DBMS_OUTPUT.PUT_LINE to print debug information

  • Use EXCEPTION block to catch and handle errors

  • Use SQL Developer Debugger to step through the code

  • Check the input and output parameters of the nested procedure

  • Use logging framework to log debug information

Are these interview questions helpful?

Q5. What is pragma autonomous transactions. How does it work.

Ans.

Pragma autonomous transactions allow a PL/SQL subprogram to commit or rollback its own transactions independently of its caller.

  • Pragma autonomous transactions are used to execute a transaction independently of the main transaction.

  • It allows a subprogram to commit or rollback its own transactions without affecting the main transaction.

  • Autonomous transactions are often used for logging, auditing, or error handling purposes.

  • To declare an autonomous transaction, use the PRAGMA AU...read more

Q6. Explain how an insert/update is parsed in Oracle database

Ans.

An insert/update statement in Oracle database is parsed by the SQL parser to check syntax and semantics.

  • The SQL parser first checks the syntax of the insert/update statement to ensure it follows the rules of the SQL language.

  • Next, the parser checks the semantics of the statement, which involves verifying the existence and accessibility of the tables and columns referenced in the statement.

  • During parsing, the parser also determines the execution plan for the statement, which i...read more

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

Q7. Explain how an Select statement is parsed in Oracle database

Ans.

The parsing of a SELECT statement in Oracle database involves several steps.

  • The statement is first checked for syntax errors.

  • The query is then parsed to identify the objects involved and their relationships.

  • The optimizer determines the most efficient execution plan.

  • The plan is executed and the result set is returned.

Q8. How partitions is useful and when to create it

Ans.

Partitions are useful for managing large tables and improving query performance.

  • Partitions allow for data to be split into smaller, more manageable chunks

  • Queries can be run on specific partitions, improving performance

  • Partitions can be based on various criteria such as date, range, or hash

  • Example: Partitioning a sales table by date can improve query performance for recent sales data

  • Example: Partitioning a customer table by region can improve query performance for regional ana...read more

Senior Plsql Developer Jobs

Senior PL SQL Developer 5-9 years
Robert Bosch Engineering and Business Solutions Private Limited
4.2
Bangalore / Bengaluru
Senior PL/SQL Developer 5-8 years
Insightsoftware
3.5
₹ 25 L/yr - ₹ 30 L/yr
Hyderabad / Secunderabad
Senior PLSQL Developer 3-8 years
Apex Systems
4.1
Bangalore / Bengaluru

Q9. What is hard and soft parse

Ans.

Hard parse is when SQL statement is parsed every time it is executed. Soft parse is when SQL statement is parsed only once.

  • Hard parse is resource-intensive and can slow down performance.

  • Soft parse is faster and more efficient.

  • Hard parse occurs when there is a syntax error or when the SQL statement is not in the shared pool.

  • Soft parse occurs when the SQL statement is already in the shared pool.

  • Hard parse can be avoided by using bind variables.

  • Soft parse can be affected by chan...read more

Q10. How do access elements in XML/JSON data

Ans.

To access elements in XML/JSON data, use appropriate methods like XPath for XML and dot notation for JSON.

  • For XML data, use XPath expressions to navigate and extract specific elements or attributes.

  • For JSON data, use dot notation to access nested objects or arrays.

  • In PL/SQL, you can use XMLTable or JSON_TABLE functions to extract data from XML or JSON respectively.

Q11. Difference between Varray and Nested Tables

Ans.

Varrays are fixed-size arrays while Nested Tables are dynamic arrays in PL/SQL.

  • Varrays have a maximum size specified at declaration, while Nested Tables can grow dynamically.

  • Varrays are stored in contiguous memory locations, while Nested Tables are stored in a separate table.

  • Varrays can be sparse, while Nested Tables are always dense.

  • Example: Varray - DECLARE TYPE phone_numbers IS VARRAY(3) OF VARCHAR2(15); Nested Table - DECLARE TYPE phone_numbers IS TABLE OF VARCHAR2(15);

Q12. find the employee for 2 consecutive days absent

Ans.

Use SQL query to find employees who were absent for 2 consecutive days.

  • Use a SQL query to join the employee table with the attendance table

  • Filter the results to only include employees who have consecutive absent days

  • Group the results by employee to identify those who were absent for 2 consecutive days

Q13. Can we use commit in Triggers

Ans.

No, COMMIT cannot be used in triggers.

  • COMMIT cannot be used in triggers as it can cause mutating table errors.

  • Triggers are automatically committed by the database after they are executed.

  • Using COMMIT in triggers can lead to data integrity issues and performance problems.

Q14. How to fetch hierarchical data

Ans.

Hierarchical data can be fetched using recursive queries or hierarchical queries.

  • Recursive queries use a common table expression (CTE) to repeatedly join a table to itself.

  • Hierarchical queries use the CONNECT BY clause to specify the parent-child relationship.

  • Both methods require a column that identifies the parent of each row, such as an ID or parent ID column.

  • Example: SELECT * FROM employees WHERE manager_id = 123 CONNECT BY PRIOR employee_id = manager_id

  • Example: WITH recur...read more

Q15. What is index ? and types?

Ans.

An index is a database object that improves the speed of data retrieval operations on a table.

  • Indexes are used to quickly locate data without having to search every row in a table.

  • Types of indexes include B-tree indexes, bitmap indexes, and function-based indexes.

  • Examples of indexes are primary keys, unique constraints, and indexes created explicitly on columns.

Q16. difference between union and union all?

Ans.

Union combines and removes duplicates, Union All combines without removing duplicates.

  • Union combines result sets and removes duplicates

  • Union All combines result sets without removing duplicates

  • Union is slower than Union All as it involves removing duplicates

  • Example: SELECT column1 FROM table1 UNION SELECT column1 FROM table2;

  • Example: SELECT column1 FROM table1 UNION ALL SELECT column1 FROM table2;

Q17. What is materialized view?

Ans.

A materialized view is a database object that contains the results of a query and is stored on disk for faster access.

  • Materialized views store the results of a query like a table, allowing for faster access to data.

  • They are updated periodically to reflect changes in the underlying data.

  • Materialized views are commonly used in data warehousing and reporting applications.

  • Example: CREATE MATERIALIZED VIEW mv_sales AS SELECT product_id, SUM(amount) FROM sales GROUP BY product_id;

Q18. Difference between proc & function

Ans.

A procedure does not return a value, while a function returns a value.

  • Procedure is used to perform an action, while function is used to compute and return a value.

  • Procedures can have OUT parameters to return values, while functions always return a single value.

  • Functions can be used in SQL queries, while procedures cannot be used in SQL queries.

Q19. What is dirty block

Ans.

A dirty block is a database block that has been modified but not yet written to disk.

  • Dirty blocks are a common occurrence in database systems.

  • They can cause performance issues if not managed properly.

  • Dirty blocks are typically written to disk during a checkpoint process.

  • If a dirty block is lost due to a system failure, data loss can occur.

Q20. Explain different pragma objects

Ans.

Pragma objects in PL/SQL provide compiler directives for controlling program behavior.

  • Pragma AUTONOMOUS_TRANSACTION: Allows a subprogram to execute SQL statements independently of the calling program.

  • Pragma EXCEPTION_INIT: Associates an exception name with an Oracle error number.

  • Pragma INLINE: Suggests the compiler to inline the code of a subprogram at the call site.

  • Pragma RESTRICT_REFERENCES: Specifies the purity level of a subprogram.

  • Pragma SERIALLY_REUSABLE: Indicates that...read more

Q21. What is trigger?

Ans.

A trigger is a PL/SQL block that is automatically executed in response to certain events on a particular table or view.

  • Triggers can be used to enforce business rules, audit changes, or replicate data.

  • They can be classified as row-level triggers (executed for each row affected) or statement-level triggers (executed once for the entire statement).

  • Examples of trigger events include INSERT, UPDATE, DELETE operations on a table.

Frequently asked in, ,

Q22. What is control file

Ans.

Control file is a configuration file used by Oracle database to manage the physical structure of the database.

  • It contains information about the database such as datafiles, redo log files, and control files.

  • It is created during database creation and is read by the database at startup.

  • It is used to manage the physical structure of the database and to recover the database in case of a failure.

  • It is edited using a text editor or Oracle Enterprise Manager.

  • It is located in the $ORA...read more

Q23. Packages and it's advantages.

Ans.

Packages in PL/SQL are a way to group related procedures, functions, variables, and other PL/SQL constructs together for better organization and security.

  • Packages help in modularizing code and promoting code reusability.

  • They provide encapsulation, allowing for better control over access to procedures and functions.

  • Packages improve performance by reducing network traffic and increasing scalability.

  • Example: Creating a package to handle employee data with procedures for adding, ...read more

Q24. Performance tuning explain

Ans.

Performance tuning involves optimizing the code and database to improve system speed and efficiency.

  • Identify bottlenecks in the system

  • Optimize SQL queries and indexes

  • Use caching and memory management techniques

  • Reduce network latency and disk I/O

  • Monitor system performance regularly

Q25. Explain cursors

Ans.

Cursors are used in PL/SQL to retrieve and process multiple rows from a result set.

  • Cursors are like pointers to a result set returned by a SELECT statement.

  • They allow us to fetch and process rows one by one.

  • Cursors are typically used in loops to iterate through the result set.

  • They can be explicit or implicit, with explicit cursors requiring more code.

  • Example: DECLARE cursor_name CURSOR FOR SELECT column1, column2 FROM table_name;

Q26. Explain indexes

Ans.

Indexes are data structures that improve the speed of data retrieval operations on a database table.

  • Indexes are created on columns in a database table to quickly retrieve rows based on the values in those columns.

  • They can be unique, allowing only unique values to be stored in the indexed column.

  • Indexes can significantly improve the performance of SELECT queries but may slow down INSERT, UPDATE, and DELETE operations.

  • Examples of indexes include primary keys, unique constraints...read more

Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

3.6
 • 7.6k Interviews
3.7
 • 4.8k Interviews
3.8
 • 2.9k Interviews
4.0
 • 2.4k Interviews
3.7
 • 899 Interviews
3.9
 • 610 Interviews
3.9
 • 366 Interviews
3.4
 • 152 Interviews
4.7
 • 4 Interviews
View all

Calculate your in-hand salary

Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary

Senior Plsql Developer Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter