Contents IndexSyntax conventions Expressions

User's Guide
   Part VI. SQL Anywhere Reference
     Chapter 40. Watcom-SQL Language Reference
      Watcom-SQL language elements

The following elements are found in the syntax of many SQL statements. Each of these elements is discussed in more detail later in this chapter.

column-name An identifier representing the name of a column.

condition An expression that evaluates to TRUE, FALSE, or UNKNOWN. See "Search conditions".

connection-name An identifier or a string representing the name of an active connection.

owner An identifier representing a user ID.

data-type A storage data type as described in "SQL Anywhere Data Types".

expression An expression, as described in "Expressions".

filename A string containing a filename.

host-variable A C language variable declared as a host variable preceded by a colon.

identifier Any string of the characters A through Z, a through z, 0 through 9, underscore (_ ), at sign (@), number sign (#), or dollar sign ($). The first character must be a letter. Alternatively, any string of characters can be used as an identifier by enclosing it in quotation marks ("double quotes"). A quotation mark inside the identifier is represented by two quotation marks in a row. Identifiers are truncated to 128 characters. The following are all valid identifiers.

     Surname
     "Surname"
     SomeBigName
     some_big_name
     "Client Number"
     "With a quotation "" mark"

indicator-variable A second host variable of type short int immediately following a normal host variable. It must also be preceded by a colon. Indicator variables are used to pass NULL values to and from the database.

number Any sequence of digits followed by an optional decimal part and preceded by an optional negative sign. Optionally, the number can be followed by an E and then an exponent. For example,

     42
     -4.038
     .001
     3.4e10
     1e-10

role-name An identifier representing the role name of a foreign key.

search-condition A condition that evaluates to TRUE, FALSE, or UNKNOWN. See "Search conditions".

string Any sequence of characters enclosed in apostrophes ('single quotes'). An apostrophe is represented inside the string by two apostrophes in a row. A new line character is represented by a backslash followed by an n (\n). Hexadecimal escape sequences can be used for any character, printable or not. A hexadecimal escape sequence is a backslash followed by an x followed by two hexadecimal digits (for example, \x6d represents the letter m). A backslash character is represented by two backslashes in a row (\\). The following are valid strings:

     'This is a string.'
     'John''s database'
     '\x00\x01\x02\x03'

savepoint-name An identifier representing the name of a savepoint.

statement-label An identifier representing the label of a loop or compound statement.

table-list A list of table names which may include correlation names. See "FROM clause".

table-name An identifier representing the name of a table.

userid An identifier representing a user name.

variable An identifier representing a variable name.

Contents IndexSyntax conventions Expressions