DEFINE_COLUMN v16
The DEFINE_COLUMN
procedure defines a column or expression in the SELECT
list 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's being defined.
column
A variable 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. Specify column_size
only if column
is VARCHAR2
. Returned data exceeding column_size
is truncated to column_size
characters.
Examples
This example 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 that produces the same results. The lengths of the data types are irrelevant. The empno
, sal
, and comm
columns 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 returns data up to 10 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.
- On this page
- Parameters
- Examples