Home » RDBMS Server » Server Administration » Dynamic Variable Declaration
Dynamic Variable Declaration [message #371403] Fri, 13 October 2000 08:03 Go to next message
Shalini
Messages: 14
Registered: September 2000
Junior Member
How can I declare the Data type and Size of a
PL/SQL Variable Dynamically?
Re: Dynamic Variable Declaration [message #371456 is a reply to message #371403] Fri, 20 October 2000 20:51 Go to previous message
LUNA
Messages: 4
Registered: October 2000
Junior Member
with dbms_sql.variable_value:

DBMS_SQL.VARIABLE_VALUE(
c IN INTEGER,
name IN VARCHAR2,
value OUT <datatype>);
where <datatype> can be any one of the following types:

NUMBER
DATE
MLSLABEL
VARCHAR2

The following syntax is also supported for the VARIABLE_VALUE procedure:

DBMS_SQL.VARIABLE_VALUE_CHAR(
c IN INTEGER,
name IN VARCHAR2,
value OUT CHAR);

DBMS_SQL.VARIABLE_VALUE_RAW(
c IN INTEGER,
name IN VARCHAR2,
value OUT RAW);

DBMS_SQL.VARIABLE_VALUE_ROWID(
c IN INTEGER,
name IN VARCHAR2,
value OUT ROWID);

where c:Specify the ID number of the cursor from which to get the values.
name:Specify the name of the variable for which you are retrieving the value
value:Returns the value of the variable for the specified position.
Oracle raises exception ORA-06562, inconsistent_type, if the type of this output parameter differs from the actual type of the value, as defined by the call to BIND_VARIABLE.
Previous Topic: Dynamic SQL
Next Topic: help with in-built function
Goto Forum:
  


Current Time: Sun Dec 22 15:14:47 CST 2024