DEFINE_COLUMN v13
The DEFINE_COLUMN
procedure defines a column or expression in the SELECT
list that is to be returned and retrieved in a cursor.
Parameters
c
Cursor id of the cursor associated with the SELECT
command.
position
Position of the column or expression in the SELECT
list that is being defined.
column
A variable that is of the same data type as the column or expression in position position
of the SELECT
list.
column_size
The maximum length of the returned data. column_size
must be specified only if column
is VARCHAR2
. Returned data exceeding column_size
is truncated to column_size
characters.
Examples
The following shows how the empno, ename, hiredate, sal
, and comm
columns of the emp
table are defined with the DEFINE_COLUMN
procedure.
The following shows an alternative to the prior example that produces the exact same results. Note that the lengths of the data types are irrelevant – the empno, sal
, and comm
columns will still return data equivalent to NUMBER(4)
and NUMBER(7,2)
, respectively, even though v_num
is defined as NUMBER(1)
(assuming the declarations in the COLUMN_VALUE
procedure are of the appropriate maximum sizes). The ename
column will return data up to ten characters in length as defined by the length
parameter in the DEFINE_COLUMN
call, not by the data type declaration, VARCHAR2(1)
declared for v_varchar
. The actual size of the returned data is dictated by the COLUMN_VALUE
procedure.