Oracle9i Supplied PL/SQL Packages and Types Reference
Release 1 (9.0.1)

Part Number A89852-02
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to beginning of chapter Go to next page

DBMS_SQL , 15 of 20


DESCRIBE_COLUMNS Procedure

This procedure describes the columns for a cursor opened and parsed through DBMS_SQL.

The DESC_REC Type

The DBMS_SQL package declares the DESC_REC record type as follows:

type desc_rec is record (  
   col_type            BINARY_INTEGER := 0,
   col_max_len         BINARY_INTEGER := 0,
   col_name            VARCHAR2(32)   := '',
   col_name_len        BINARY_INTEGER := 0,
   col_schema_name     VARCHAR2(32)   := '',
   col_schema_name_len BINARY_INTEGER := 0,
   col_precision       BINARY_INTEGER := 0,
   col_scale           BINARY_INTEGER := 0,
   col_charsetid       BINARY_INTEGER := 0,
   col_charsetform     BINARY_INTEGER := 0,
   col_null_ok         BOOLEAN        := TRUE);

Parameters

Table 62-16 DESC_REC Type Parameters
Parameter  Description 
col_type
 

Type of the column being described. 

col_max_len
 

Maximum length of the column. 

col_name
 

Name of the column. 

col_name_len
 

Length of the column name. 

col_schema_name
 

Name of the schema the column type was defined in, if an object type. 

col_schema_name_len
 

Length of the schema. 

col_precision
 

Column precision, if a number. 

col_scale
 

Column scale, if a number. 

col_charsetid
 

Column character set identifier. 

col_charsetform
 

Column character set form. 

col_null_ok
 

True if column can be null. 

The DESC_TAB Type

The DESC_TAB type is a PL/SQL table of DESC_REC records:

type desc_tab is table of desc_rec index by BINARY_INTEGER;

You can declare a local variable as the PL/SQL table type DESC_TAB, and then call the DESCRIBE_COLUMNS procedure to fill in the table with the description of each column. All columns are described; you cannot describe a single column.

Syntax

DBMS_SQL.DESCRIBE_COLUMNS ( 
   c              IN  INTEGER, 
   col_cnt        OUT INTEGER, 
   desc_t         OUT DESC_TAB);

Parameters

Table 62-17 DBMS_SQL.DESCRIBE_COLUMNS Procedure Parameters
Parameter  Description 
c
 

ID number of the cursor for the columns being described. 

col_cnt
 

Number of columns in the select list of the query. 

desc_t
 

Table of DESC_REC, each DESC_REC describing a column in the query. 

See Also:

"Example 8: Describe Columns" illustrates how to use DESCRIBE_COLUMNS


Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback