What is dynamic SQl and how you will create and execute
dynamic sql?

Answers were Sorted based on User's Feedback



What is dynamic SQl and how you will create and execute dynamic sql?..

Answer / raksha

Dynamic SQL enables you to write programs that reference SQL statements whose full text is not known until runtime.

Below is the way to execute dynamic sql

EXECUTE IMMEDIATE 'SELECT d.id, e.name FROM dept_new d, TABLE(d.emps) e -- not allowed in static SQL
-- in PL/SQL
WHERE e.id = 1'

Is This Answer Correct ?    5 Yes 0 No

What is dynamic SQl and how you will create and execute dynamic sql?..

Answer / ravi singh

Dynamic SQL enables you to executes your SQL statement at run time on the basis of different conditions. They can be executed with the help of creating SQLs at run time. you can store your where clause or sql statements in variables and on the basis of requirements you can execute them.
Dynamic SQL comprises reference cursors.
for ex: open cursor for select a,b,c from table_name;

execute immediate 'select a,b from table_name'

you can store the result set into variables too.

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

what are the differences among these table level lock modes - IN SHARE MODE, IN SHARE UPDATE MODE, IN EXCLUSIVE MODE ?

3 Answers   HCL,


What is the use of index in sql?

0 Answers  


What are packages in pl sql and also explain its advantages?

0 Answers  


Differentiate between % rowtype and type record.

0 Answers  


What is the use of <> sql?

0 Answers  






write the Sql query for creating database backup?

7 Answers   TCS,


Is mariadb nosql?

0 Answers  


Does sqlite need a server?

0 Answers  


Can procedure in a package be overloaded?

1 Answers   HCL,


What is a relationship and what are they?

0 Answers  


What is procedure and function in sql?

0 Answers  


can a stored procedure call itself or recursive stored procedure? : Sql dba

0 Answers  


Categories