Oracle7 Server SQL Reference

Contents Index Home Previous Next

DESCRIBE (Embedded SQL)

Purpose

To initialize a descriptor to hold descriptions of host variables for a dynamic SQL statement or PL/SQL block.

Prerequisites

You must have prepared the SQL statement or PL/SQL block in a previous embedded SQL PREPARE statement.

Syntax

Keywords and Parameters

BIND VARIABLES

initializes the descriptor to hold information about the input variables for the SQL statement or PL/SQL block.

SELECT LIST

initializes the descriptor to hold information about the select list of a SELECT statement.

The default is SELECT LIST FOR.

statement_name block_name

identifies a SQL statement or PL/SQL block previously prepared with a PREPARE statement.

descriptor

is the name of the descriptor to be initialized.

Usage Notes

You must issue a DESCRIBE statement before manipulating the bind or select descriptor within an embedded SQL program.

You cannot describe both input variables and output variables into the same descriptor.

The number of variables found by a DESCRIBE statement is the total number of placeholders in the prepare SQL statement or PL/SQL block, rather than the total number of uniquely named placeholders. For more information on this command, see Programmer's Guide to the Oracle Precompilers.

Example

This example illustrates the use of the DESCRIBE statement in a Pro*C embedded SQL program:

EXEC SQL PREPARE my_statement 	FROM :my_string; 
EXEC SQL DECLARE emp_cursor 
	FOR SELECT empno, ename, sal, comm 
			FROM emp 
			WHERE deptno = :dept_number 
EXEC SQL DESCRIBE BIND VARIABLES FOR my_statement 
	INTO bind_descriptor; 
EXEC SQL OPEN emp_cursor 
	USING bind_descriptor; 
EXEC SQL DESCRIBE SELECT LIST FOR my_statement 
	INTO select_descriptor; 
EXEC SQL FETCH emp_cursor 
	INTO select_descriptor; 

Related Topics

PREPARE command [*]


Contents Index Home Previous Next