DB_Prepare Function

Action

Prepares a SQL statement (declared in the SQL section) for execution. Binding of program variables and random variables used in the SQL statement is done automatically.

Include file

DBAPI.bdh

Syntax

DB_Prepare( in cCursor: cursor, in sqlStat: sql ): number;

Return value

SQL return code

Parameter Description
cCursor Cursor for prepared SQL statement
sqlStat SQL statement name (defined in the SQL section) to be prepared for further executing

Example

dcltrans
  transaction TPrepare
  var
    nRetCode: number;
  begin
    ...
    nRetCode := DB_Prepare(c1, InsSelling);
    ...
  end TPrepare;

dclsql
  InsSelling:
    INSERT INTO sale VALUES (:gAno, "121297", 'N', :rTerm);

Sample scripts

DBApi01.bdf