Blog Detail

execute immediate in oracle

22 Dec 10
admin
No Comments
Hi,

Execute immediate is used to execute dynamic SQL statement or anonymous PL/SQL block.

Syntax:

EXECUTE IMMEDIATE dynamic_sql_string
[INTO {define_variable,… | INTO record_name}]
[USING
[IN|OUT|IN OUT] bind_argument,…]
[RETURN[ING] INTO
bind_argument,…];
dynamic_sql_string : The SQL statement string or PL/SQL block

define_variable : One variable receives each column
value returned by the query.

record_name : A record based on a user-defined TYPE
or %ROWTYPE that receives an entire row
returned by a query

bind_argument : An expression whose value is passed to the
SQL statement or PL/SQL block INTO clause
Use for single-row queries; for each column value
returned by the query, you must supply an
individual variable or field in a record of
compatible type.

USING clause : Allows you to supply bind arguments for the
SQL string. This clause is used for both
dynamic SQL and PL/SQL,
which is why you can specify a parameter mode.
This usage is only relevant for PL/SQL,
however; the default is IN, which is the only
kind of bind argument you would have for
SQL statements.

Happy Programing…..

Leave A Comment