18.3.3 SQL statements that can be used in SQLJ

Table 18-3 lists the SQL statements that can be used in SQLJ.

Table 18-3 SQL statements that can be used in SQLJ

TypeSQL statementUsabilityAlternate means
Standard interface versionNative interface version
Definition SQL statementAllYYNone
Data manipulation SQL statementsASSIGN LIST statementN (SQLJ)N (SQLJ)Use JDBC.
CALL statementYYNone
CLOSE statementN (SQLJ)N (SQLJ)Use an iterator.
DECLARE CURSORN (SQLJ)N (SQLJ)
DELETE statementYYNone
DESCRIBE statementN (JDBC)N (JDBC)*Use JDBC.
DESCRIBE TYPE statementN (JDBC)N (JDBC)*
DROP LIST statementN (JDBC)N (JDBC)*
EXECUTE statementN (JDBC)N (JDBC)*
EXECUTE IMMEDIATE statementN (JDBC)N (JDBC)*
FETCH statement (Format 1 or 3)YYNone
FETCH statement (Format 2)NNNone
INSERT statementYYNone
OPEN statement (Format 1)N (SQLJ)N (SQLJ)Use an iterator.
OPEN statement (Format 2)N (SQLJ)N (SQLJ)Use JDBC.
PREPARE statementN (SQLJ)N (SQLJ)
PURGE TABLE statementYYNone
Single-row SELECT statementYYNone
Dynamic SELECT statementN (JDBC)N (JDBC)*Use JDBC.
UPDATE statementYYNone
Control SQL statementsCOMMIT statementYYNone
COMMIT statement (RELEASE specified)N (SQLJ)N (SQLJ)Split into COMMIT and DISCONNECT.
CONNECT statementNYNone
DISCONNECT statementNYNone
LOCK statementYYNone
CONNECT statement with RD-node specificationNNNone
DISCONNECT statement with RD-node specificationNNNone
ROLLBACK statementYYNone
ROLLBACK statement (RELEASE specified)N (SQLJ)N (SQLJ)Split into ROLLBACK and DISCONNECT.
SET CONNECTION statementNNNone
SET SESSION AUTHORIZATION statementNNNone
Embedded language syntaxBEGIN DECLARE SECTIONNNNone
END DECLARE SECTIONNNNone
ALLOCATE CONNECTION HANDLEN (SQLJ)N (SQLJ)Use a connection context.
DECLARE CONNECTION HANDLEN (SQLJ)N (SQLJ)
FREE CONNECTION HANDLEN (SQLJ)N (SQLJ)
GET CONNECTION HANDLENNNone
COPYNNNone
GET DIAGNOSTICSNNNone
WHENEVERN (SQLJ)N (SQLJ)Implement using try ... catch.
Legend:
Y: Can be used in SQLJ.
N (SQLJ): Cannot be used in SQLJ, but a similar function is available in the functions provided by SQLJ or JAVA.
N (JDBC): Cannot be used in SQLJ, but a similar function is available when JDBC is used.
N: Cannot be used in SQLJ.
None: There is no alternate means.
Note
SQLJ cannot use HiRDB functions that are not provided by the JDBC driver. The following functions cannot be used:
  • UPDATE statement and DELETE statement that use an iterator
  • Specification of a keyword in a WITH clause during the declaration of an iterator
  • INSERT function that uses an array
* If you use a JDBC connection object to create a connection context, you can also use the alternate means with the native interface. If you do not use a JDBC connection object to create a connection context, you cannot use the alternate means.