Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

Explain About The Return Statement?

Answer»

A RETURN statement is used to terminate the execution of a stored function. This INTURN returns a value of expr to the function CALLER. In a stored function there should be at LEAST a SINGLE return statement. If there exists multiple functions it can have multiple exit points.

A RETURN statement is used to terminate the execution of a stored function. This inturn returns a value of expr to the function caller. In a stored function there should be at least a single return statement. If there exists multiple functions it can have multiple exit points.

2.

Explain About The Implementation Of Stored Procedures?

Answer»

Implementation of stored procedure varies for DIFFERENT databases and vendors. Stored procedures are very flexible and they can be implemented in VARIETY of languages. Stored procedures written in non SQL languages may have a very LITTLE COMPATIBILITY with SQL

Implementation of stored procedure varies for different databases and vendors. Stored procedures are very flexible and they can be implemented in variety of languages. Stored procedures written in non SQL languages may have a very little compatibility with SQL

3.

If Get_product_name Is My Procedure Called In My Stored Procedure. Here In My Procedure I Am Passing A Value Directly But I Need To Pass The Value To The Procedure Dynamically. How It Is Possible?

Answer»

By DYNAMIC SQL.

By Dynamic sql.

4.

State About The Security Aspects Of Stored Procedures?

Answer»

Stored procedures should be written very carefully because they store COMPLEX and logical data. Security PERMISSIONS should be very finely APPLIED and this is possible by carefully written code. Permissions for CLIENT data should be set in such a manner that it COULD be accessible only by the client and the method of access should be according to the procedure laid down in the Stored procedures. 

Stored procedures should be written very carefully because they store complex and logical data. Security permissions should be very finely applied and this is possible by carefully written code. Permissions for client data should be set in such a manner that it could be accessible only by the client and the method of access should be according to the procedure laid down in the Stored procedures. 

5.

Explain About Recursive Stored Procedures?

Answer»

Recursive stored PROCEDURES are used for performing repetitive tasks. Recursive FEATURE is disabled by default but can be activated by using the following COMMAND on the server max_sp_recursion_depth, also don?t forget to RENAME the system variable to a non zero variable.

Recursive stored procedures are used for performing repetitive tasks. Recursive feature is disabled by default but can be activated by using the following command on the server max_sp_recursion_depth, also don?t forget to rename the system variable to a non zero variable.

6.

Explain About The Implementation Of Business Logic In Stored Procedures?

Answer»

Stored procedures IMPLEMENT BUSINESS logic into the database. It is EMBEDDED as API and this reduces the implementation of Logic code again explicitly. Implementation of business logic internally reduces the CHANCES of data becoming CORRUPT.

Stored procedures implement business logic into the database. It is embedded as API and this reduces the implementation of Logic code again explicitly. Implementation of business logic internally reduces the chances of data becoming corrupt.

7.

What Is The Difference Between A User Defined Function And A Stored Procedure?

Answer»

A user defined FUNCTION and stored procedures are ALMOST similar but there exists a difference between their implementation procedures in the code. Stored PROCEDURE needs to be invoked whereas a UDF can be used like any other statement. 

A user defined function and stored procedures are almost similar but there exists a difference between their implementation procedures in the code. Stored procedure needs to be invoked whereas a UDF can be used like any other statement. 

8.

What Are External Procedures ? Why And When They Are Used?

Answer»

External procedures are EXTENDED stored procedures only. They let you create your own external ROUTINES in a programming language such as C. Extended stored procedures are DLLS that an instance of Microsoft SQL Server can dynamically load and RUN.Extended stored procedures run directly in the address space of an instance of SQL Server and are programmed by using the SQL Server Extended Stored Procedure API.

External procedures are Extended stored procedures only. They let you create your own external routines in a programming language such as C. Extended stored procedures are DLLs that an instance of Microsoft SQL Server can dynamically load and run.Extended stored procedures run directly in the address space of an instance of SQL Server and are programmed by using the SQL Server Extended Stored Procedure API.

9.

How One Call Ddl Statement Using Stored Procedures In Oracle?

Answer»

YES, we can call DDL COMMAND using EXECUTE IMMEDIATE command

Yes, we can call DDL command using EXECUTE IMMEDIATE command

10.

Does Storing Of Data In Stored Procedures Increase The Access Time? Explain?

Answer»

Data stored in stored PROCEDURES can be retrieved much faster than the data stored in SQL database. Data can be precompiled and stored in Stored procedures. This reduces the time GAP between query and compiling as the data has been precompiled and stored in the procedure. To avoid REPETITIVE NATURE of the data base STATEMENT caches are used. 

Data stored in stored procedures can be retrieved much faster than the data stored in SQL database. Data can be precompiled and stored in Stored procedures. This reduces the time gap between query and compiling as the data has been precompiled and stored in the procedure. To avoid repetitive nature of the data base statement caches are used. 

11.

State The Different Extensions For Stored Procedures?

Answer»

 Most of the database SYSTEMS have PROPRIETARY and VENDOR based extensions. Microsoft allows procedures to be written using Transact-SQL. Oracle CALLS its extension as PL/SQL. DB2 has its extension as PL/SQL. PL/pgSQL is the extension USED by Postgre SQL and this allows users to have their own functional language such as pl/PHP and pl/Perl.

 Most of the database systems have proprietary and vendor based extensions. Microsoft allows procedures to be written using Transact-SQL. Oracle calls its extension as PL/SQL. DB2 has its extension as PL/SQL. PL/pgSQL is the extension used by Postgre SQL and this allows users to have their own functional language such as pl/PHP and pl/Perl.

12.

What Is Cursors?

Answer»

CURSORS are supported by procedures, functions and triggers. SYNTAX of the cursors is embedded in SQL. CURSOR should be DECLARED before declaring handles. Before declaring cursors it is imperative to declare variables and conditions. 

Cursors are supported by procedures, functions and triggers. Syntax of the cursors is embedded in SQL. Cursor should be declared before declaring handles. Before declaring cursors it is imperative to declare variables and conditions. 

13.

Explain The Benefits Of Running Stored Procedure On A Database Engine?

Answer»

Stored procedures can run DIRECTLY run on a data base ENGINE. In industries where automation is the key a stored procedure can run entirely on the data base provided to it and this runs on a specialized data base server. Network communication can be avoided. Also this procedure is useful for execution of complex SQL STATEMENTS

Stored procedures can run directly run on a data base engine. In industries where automation is the key a stored procedure can run entirely on the data base provided to it and this runs on a specialized data base server. Network communication can be avoided. Also this procedure is useful for execution of complex SQL statements. 

14.

How Many Types Of Stored Procedure?

Answer»

Stored Procedure are of two TYPES

  1. USER define stored procedure
  2. SYSTEM define Stored procedure.

Stored Procedure are of two types

15.

Where The Procedures Are Stored In Database?

Answer»

A stored PROCEDURE is a SUBROUTINE available to applications accessing a relational database SYSTEM. Stored procedures (sometimes CALLED a proc, sproc, StoPro, or SP) are actually stored in the database data dictionary

A stored procedure is a subroutine available to applications accessing a relational database system. Stored procedures (sometimes called a proc, sproc, StoPro, or SP) are actually stored in the database data dictionary

16.

Explain About The Difficulties Faced By The Database Developer In Implementing Pre Compiled Statements?

Answer»

There are many difficulties for IMPLEMENTING PRE compiled statements because it should have all the arguments provided to it during compile TIME. It also depends UPON the database and configuration. Performance also varies and it largely depends upon whether it is a generic query or user DEFINED functions.

There are many difficulties for implementing pre compiled statements because it should have all the arguments provided to it during compile time. It also depends upon the database and configuration. Performance also varies and it largely depends upon whether it is a generic query or user defined functions.

17.

Explain About The Process Which Takes Place To Execute A Stored Routine?

Answer»

CREATE PROCEDURE and CREATE FUNCTION statement are USED to create stored routine. It can act as a function or a procedure. A procedure can be called by using a CALL statement and pass output with the help of output VARIABLES. It can call other Stored routines and it can be called from the INSIDE of a statement.

CREATE PROCEDURE and CREATE FUNCTION statement are used to create stored routine. It can act as a function or a procedure. A procedure can be called by using a call statement and pass output with the help of output variables. It can call other Stored routines and it can be called from the inside of a statement.

18.

How Can We Call Stored Procedures Inside Store Procedures?

Answer»

ALTER PROCEDURE CallAnotherProcedure as EXEC sp_helptext CallAnotherProcedure 

Alter procedure CallAnotherProcedure as exec sp_helptext CallAnotherProcedure 

19.

What Is The Difference Between Stored Procedures And Stored Functions In Oracle?

Answer»

Both(functions and PROCEDURES) are the Oracle Objects that work explicitly towards database objects LIKE TABLES,Views.

The diff. b/t Stored Procedures and Functions:

  1. The procedures doesn't RETURN values. whereas the function returns value.
  2. The procedures accept more than ONE argument whereas the functions not.

Both(functions and Procedures) are the Oracle Objects that work explicitly towards database objects like Tables,Views.

The diff. b/t Stored Procedures and Functions:

20.

What Is The Difference Between "is" And "as" While Creating Procedure?

Answer»

Both are EQUIVALENT. Just replacement of DECLARE keyword in DECLARATIVE SECTION.

Both are equivalent. Just replacement of DECLARE keyword in declarative section.

21.

Can We Use Commit Inside The Trigger? If Not Then How Can We Save The Transaction Made By The Trigger?

Answer»

USING PRAGMA CONCEPT.

Using pragma concept.