23.10.2012 Views

Openedge Data Management: SQL Reference - Product ...

Openedge Data Management: SQL Reference - Product ...

Openedge Data Management: SQL Reference - Product ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Syntax<br />

Syntax<br />

DESCRIBE<br />

E<strong>SQL</strong> elements and statements<br />

Writes information about a prepared statement to the <strong>SQL</strong> Descriptor Area (<strong>SQL</strong>DA). You use<br />

a DESCRIBE statement in a series of steps that allows a program to accept <strong>SQL</strong> statements at run<br />

time. Dynamically generated statements are not part of a program's source code; they are<br />

generated at run time.<br />

There are two forms of the DESCRIBE statement:<br />

• The DESCRIBE BIND VARIABLES statement writes information about input variables in an<br />

expression to an <strong>SQL</strong>DA. These variables can be substitution variable names or parameter<br />

markers.<br />

• The DESCRIBE SELECT LIST statement writes information about select list items in a<br />

prepared SELECT statement to an <strong>SQL</strong>DA.<br />

DESCRIBE [ BIND VARIABLES | SELECT LIST ] FOR statement_name<br />

INTO input_sqlda_name ;<br />

The <strong>SQL</strong>DA is a host language data structure used in dynamic <strong>SQL</strong> processing. DESCRIBE<br />

statements write information about the number, data types, and sizes of input variables or select<br />

list items to <strong>SQL</strong>DA structures. Program logic then processes that information to allocate<br />

storage. OPEN, EXECUTE, and FETCH statements read the <strong>SQL</strong>DA structures for the addresses of<br />

the allocated storage.<br />

DESCRIBE BIND VARIABLES<br />

Writes information about any input variables in the prepared statement to an input <strong>SQL</strong>DA<br />

structure.<br />

DESCRIBE BIND VARIABLES FOR statement_name INTO input_sqlda_name ;<br />

statement_name<br />

The name of an input <strong>SQL</strong> statement to be processed using dynamic <strong>SQL</strong> steps. Typically,<br />

this is the same statement_name used in the PREPARE statement.<br />

input_sqlda_name<br />

The name of the <strong>SQL</strong>DA structure to which DESCRIBE will write information about input<br />

variables. Input variables represent values supplied to INSERT and UPDATE statements at<br />

run time, and to predicates in DELETE, UPDATE, and SELECT statements at run time.<br />

To utilize the DESCRIBE BIND VARIABLES statement in your application, issue statements in the<br />

following order:<br />

1. PREPARE<br />

2. DESCRIBE BIND VARIABLES<br />

3. EXECUTE or OPEN CURSOR<br />

325

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!