Skip Headers

Oracle® Objects for OLE Developer's Guide
10g Release 1 (10.1)

Part Number B10118-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Master Index
Master Index
Go to Feedback page
Feedback

CreateSQL Method

See Also
Example
Applies To

OraDatabase

Description

Executes the SQL statement and creates an OraSqlStmt object from the specified SQL statement and options.

Usage

Set orasqlstmt = oradatabase.CreateSQL(sql_statement, options)

Arguments
Description
sql_statement
Any valid Oracle SQL statement.
options
A bit flag indicating the status of any optional states of the sqlstmt object. You can combine one or more options by adding their respective values.

The options flag values are:

Options Flag Values

Constant
Value
Description
ORASQL_NO_AUTOBIND
&H1&
Do not perform automatic binding of database parameters.
ORASQL_FAILEXEC
&H2&
Raise error and do not create SQL statement object.
ORASQL_NONBLK
&H4&
To execute SQL in non-blocking state

These values can be found in the file oraconst.txt.

Remarks

The SQL statement can be one continuous line with no breaks. If it is necessary to break the line, be sure to use line feeds (ASCII 10). Do not use carriage returns (ASCII 13), because the underlying Oracle database functions treat carriage returns as null terminators.

You can use PL/SQL bind variables in conjunction with the OraParameters collection.

Executing the SQL statement generates a commit to the database by default. To avoid this, use BeginTrans on the session object before using CreateSQL.

When executing PL/SQL blocks or calling stored procedures, you must include a BEGIN and END around your call as if you were executing an anonymous PL/SQL block. This is equivalent to the EXECUTE command of SQL*Plus and SQL*DBA.

If ORASQL_FAILEXEC is used, an error will be raised during SQLstatement object creation failure (on SQLstatement object refresh). The SQLstatement object will not be created and cannot be refreshed.

See Asynchronous Processing for further information on ORASQL_NONBLK option.

Note: Use CreateSQL with care, since any SQL statement or PL/SQL block that is executed might cause errors afterward when you use the Edit method on open dynasets.

Data Type

String