This page is part of the book SQL-99 Complete, Really, by Peter Gulutzan & Trudy Pelzer. The authors have graciously allowed us to reproduce the contents of the book here. Because the book is about the SQL-99 standard, the contents of this and other pages in the book may not directly apply to MariaDB. Use the navigation bar to navigate the book.

Some SQL statements are not preparable. Here's the list of all possibilities, showing whether the SQL statement can be prepared.

SQL STATEMENTSQL STATEMENT CLASSPREPARABLE?
ALTERSchemayes
CALLcontrolyes
CLOSEdataNO
COMMITtransactionNO [Note 2]
CONNECTConnectionNO [Note 1]
CREATESchemayes
DELETEdata changeyes
DISCONNECTConnectionNO [Note 1]
DROPSchemayes
FETCHdataNO
GET DIAGNOSTICSdiagnosticsNO
GRANTSchemayes
INSERTdata changeyes
OPENdataNO
RELEASE SAVEPOINTtransactionyes
RETURNcontrolyes
REVOKESchemayes
ROLLBACKtransactionNO [Note 2]
SAVEPOINTtransactionyes
SELECT with no INTOqueryyes
SELECT with INTOqueryNO
SET CONNECTIONConnectionNO [Note 1]
SET CONSTRAINTS MODEtransactionyes
SET LOCAL TIME ZONESQL-sessionyes
SET ROLESQL-sessionyes
SET SESSIONSQL-sessionyes
SET TRANSACTIONtransactionyes
START TRANSACTIONtransactionyes
UPDATEdata changeyes

Notes: The "preparable statements" for embedded SQL are as above, except:

  • [Note 1] Connection statements are "directly executable" with embedded SQL, but not preparable.
  • [Note 2] COMMIT and ROLLBACK are "preparable" with embedded SQL.

There are some SQL statements which you may use in other contexts (such as embedded SQL or SQL/PSM), but their use is inappropriate with the CLI because their functionality is included in special function calls which require a henv or hdbc as the input handle and the SQLPrepare function requires a hstmt. For such SQL statements there will usually be an analogous CLI function. For example: CONNECT and DISCONNECT statements are not preparable, but there are SQLConnect and SQLDisconnect functions; GET DIAGNOSTICS is not preparable but there are SQLGetDiag... functions; COMMIT and ROLLBACK are not preparable but there is an SQLEndTran ("end transaction") function.

Comments

Comments loading...