DB_ExecDirect Function

Action

Prepares and executes a SQL statement in one step. DB_ExecDirect is the fastest way to submit a SQL statement for one-time execution. Binding of program variables and random variables used in the SQL statement is done automatically.

Include file

DBAPI.bdh

Syntax

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

Return value

SQL return code

Parameter Description
cCursor Cursor
sqlStat SQL statement name (defined in the SQL section); the statement is executed directly

Example

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

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

Sample scripts

Trans.bdf, MutexLogin.bdf