ODBC Using escape clauses

ODBC defines extensions that are common to most backend DBMSs. To cover vendor-specific extensions, the syntax defined by ODBC uses the escape clause provided by the X/Open and SQL Access Group (SAG) SQL draft specifications.

For example, some of the extensions defined in ODBC are:

  • Date, time, and timestamp data

  • Scalar functions (such as data type, numeric, and string conversion functions)

  • Outer joins

  • Procedures

Maximum portability

For maximum portability, you should use escape sequences in your applications.

Syntax

For example, PowerBuilder uses the date, time, and timestamp escape clauses as the default formats for data manipulation. The syntax for each of these escape clauses is:

{ d yyyy-mm-dd }
{ t hh:mm:ss }
{ ts yyyy-mm-dd hh:mm:ss:[fff[fff]] }

Example

Each of the following statements updates employee Henry Jones's start time in the Employee table. The first statement uses the escape clause, and the second statement uses native syntax for a time column:

UPDATE Employee
   SET start_time = {t 08:30:00}
   WHERE emp_name = "Henry Jones"
UPDATE Employee
   SET start_time = (08:30:00)
   WHERE emp_name = "Henry Jones"