Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Syntax elements of SESAM/SQL


The basic syntax elements defined in chapters 3 to 6 of the manual are listed in alphabetical order below.
For these syntax elements, only their name (the name to the left of the definition character "::=") is specified in the syntax of the SQL statements.

Any square brackets shown here in italics are special characters, and must be specified in the statement.


query_expression ::=
[ query_expression { UNION [ALL | DISTINCT] | EXCEPT [DISTINCT] }]

{ select_expression | TABLE table | join_expression | ( query_expression ) }


aggregate ::= <{ value | NULL }, . . . >


alphanumeric_literal ::=
{ '[ character ...]'[ separator ...'[ character ...]']... |
X'[ hex hex ]...'[ separator ...'[ hex hex ]...']... }

hex ::= 0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|A|B|C|D|E|F


annotation ::= /*% annotation_text %*/


statement_id ::= unqual_name


argumente ::= see user_defined_function


expression ::=
{

   value |
 [ table .] { column { column ( posno ) | column[posno] } |  { column ( min..max ) | column[min..max] } } |

   function |

   subquery |
   monadic_op expression |
   expression dyadic_op expression |
   case_expression |
   cast_expression |
 ( expression )

}

column ::= unqual_name
posno ::= unsigned_integer
min ::= unsigned_integer
max ::= unsigned_integer


monadic_op ::= { + | - }

dyadic_op ::= { * | / | + | = | || }


authorization_identifier ::= unqual_name


letter ::= see unqual_name


case_expression ::=

{



CASE

WHEN search_condition THEN

...

[ELSE { expression | NULL }]
END |


CASE expressionx
WHEN expression1 [, expression2 ] ... THEN { expression | NULL }
...

[ELSE { expression | NULL }]

END |


NULLIF ( expression1 , expression2 ) |


COALESCE ( expression1 , expression2, ... expressionn ) |


{ MIN | MAX }( expression1,expression2, ..., expressionn )

}



cast_expression ::= CAST ({ expression | NULL } AS data_type )


catalog ::= unqual_name


data_type ::=

{

   [{[ dimension ] | ( dimension )}] CHAR[ACTER][( length )] |

   CHAR[ACTER] VARYING( max ) | VARCHAR( max ) |

   [{[ dimension ] | ( dimension ) }] { NATIONAL CHAR[ACTER] | NCHAR }  [ ( cu_length [CODE_UNITS])] |

   { NATIONAL CHAR[ACTER] VARYING | NCHAR VARYING | NVARCHAR }  ( cu_max [CODE_UNITS]) |

   [{[ dimension ] | ( dimension )}]

     {

       SMALLINT |

       INT[EGER] |

       NUMERIC [( precision [, scale ])] |DEC[IMAL][( precision [, scale ])] |

       REAL |

       DOUBLE PRECISION |

       FLOAT [( precision )] |

       DATE |
       TIME(3) |
       TIMESTAMP(3)

     }

}


unqual_base_table_name ::= unqual_name

unqual_constraint_name ::= unqual_name

unqual_index_name ::= unqual_name

unqual_name ::= { regular_name | special_name }

regular_name ::= letter [ { letter | digit | _ } ] ...

special_name ::= " character... "

letter ::= a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|
        A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z

digit ::= 0|1|2|3|4|5|6|7|8|9

unqual_routine_name ::= unqual_name

unqual_schema_name ::= unqual_name

unqual_space_name ::= unqual_name

unqual_stogroup_name ::= unqual_name

error_name ::= unqual_name

fixed_pt_number ::= see numeric_literal

function ::= { time_function | string_function | numeric_function | aggregate_function | table_function | crypto_function | user_defined_function }

integer ::= see numeric_literal

floating_pt_number ::= see numeric_literal

hex ::= see alphanumeric_literal

index ::= see qualified_name

integrity_constraint_name ::= see qualified_name


join_expression ::=
{

      table_specification CROSS JOIN table_specification |
      table_specification [ INNER | { LEFT | RIGHT | FULL } [OUTER] ]
   JOIN table_specification ON search_condition |
      table_specification UNION JOIN table_specification |
   ( join_expression )

}


correlation_name ::= unqual_name

crypto_function ::= { ENCRYPT ( expression , key ) | DECRYPT ( expression2 , key , data_type ) }

key ::= expression

literal ::= { alphanumeric_literal | national_literal | special_literal | numeric_literal | time_literal }

max ::= unsigned_integer

aggregate_function ::= { operator ([ ALL | DISTINCT ] expression ) | COUNT(*) }

operator ::= {AVG | COUNT | MAX | MIN | SUM }

min ::= unsigned_integer


flag ::= see praedicate


pattern ::= see praedicate


national_literal ::=

{

N'[ character ...]'[ separator ...'[ character ...]'] ... |
NX'[ 4hex ...]'[ separator ...'[ 4hex ...]'] ...|
U&'[ uc-character ...]'[ separator... '[ uc-character '...] ... [UESCAPE' esc '] }

uc-character ::= { character | esc 4hex | esc+ 6hex | esc esc }


numeric_function ::=
{

   ABS ( expression ) |
   CEIL[ING] ( expression ) |
   FLOOR ( expression ) |
   MOD ( dividend,divisor ) |
   SIGN ( expression ) |
   TRUNC ( expression ) |
   { CHAR_LENGTH | CHARACTER_LENGTH }

   ( expression [USING { CODE_UNITS | OCTETS }]) |
   OCTET_LENGTH ( expression ) |
   POSITION ( expression IN expression [USING CODE_UNITS]) |
   JULIAN_DAY_OF_DATE ( expression ) |
   EXTRACT ( part FROM expression )

}


numeric_literal ::= { integer | fixed_pt_number | floating_pt_number }


integer ::= [{+|-}] unsigned_integer [.]


fixed_pt_number ::= [{+|-}] { unsigned_integer [. unsigned_integer ] | unsigned_integer . | . unsigned_integer }


floating_pt_number ::= fixed_pt_number E[{+|-}] unsigned_integer


unsigned_integer ::= digit ...


operand ::= see praedicate


praedicate ::=
{

row comparison_op row |
vector_column comparison_op expression |
row comparison_op { ALL | SOME | ANY } subquery |
row [NOT] BETWEEN row AND row |
vector_column [NOT] BETWEEN expression AND expression | expression IS [NOT] CASTABLE AS data_type |
row [NOT] IN { subquery | ( row ,...) } |
vector_column [NOT] IN ( expression , expression ,...) |
operand [NOT] LIKE pattern [ESCAPE character ...] |
operand [NOT] LIKE_REGEX regular_expression [FLAG flag ] |
expression IS [NOT] NULL |
EXISTS subquery

}


row ::= { ( expression ,...) | expression | subquery }

vector_column ::= [ table .]{ column[min..max] | column ( min..max ) }

comparison_op ::= { = | < | > | <= | >= | <> }

operand ::= expression

pattern ::= expression

character ::= expression

regular_expression ::= expression

flag ::= expression


pragma ::= --%PRAGMA pragma_text ,... lineend


qualified_name ::=
{

index |
integrity_constraint_name |
routine |
schema |
space |
stogroup |
table

}


index ::= [[ catalog .] unqual_schema_name .] unqual_index_name

integrity_constraint_name ::= [[ catalog .] unqual_schema_name .] unqual_constraint_name

routine ::= [[ catalog .] unqual_schema_name .] unqual_routine_name

schema ::= [ catalog .] unqual_schema_name

space ::= [ catalog .] unqual_space_name

stogroup ::= [ catalog .] unqual_stogroup_name


table ::=

{

   [[ catalog .] unqual_schema_name .] unqual_base_table_name |
   [[ catalog .] unqual_schema_name .] unqual_view_name |
      correlation_name

}


regular expression  ::= see praedicate


regular_name ::= see unqual_name


routine ::= see qualified_name


routine_parameter ::= unqual_name


schema ::= see qualified_name


key ::= see crypto_function

select_expression ::=

SELECT [ALL | DISTINCT] select_list
FROM table_specification ,...
[WHERE search_condition ]
[GROUP BY column ,...]
[HAVING search_condition ]


select_list ::= { * | { table .* | expression [[AS] column ] } }


space ::= see qualified_name

column ::= see expression


col_constraint ::=

{  
   NOT NULL |
   UNIQUE |
   PRIMARY KEY |

   REFERENCES table [( column )] |

   CHECK ( search_condition )

}


column_definition ::=
column { data_type [ default ] | FOR REF( table ) }
[[CONSTRAINT integrity_constraint_name ] col_constraint ] ...
[ call_dml_clause ]


default ::= DEFAULT
{

    alphanumeric_literal |

    national_literal |

    numeric_literal |

    time_literal |

  CURRENT_DATE |
  CURRENT_TIME(3) |
  LOCALTIME(3) |
  CURRENT_TIMESTAMP(3) |
  LOCALTIMESTAMP(3) |
  USER |
  CURRENT_USER |
  SYSTEM_USER |
  NULL |

  REF( tabelle )

}


call_dml_clause ::= CALL DML call_dml_default [ call_dml_symb_name ]


special_literal ::=

{

   CURRENT_CATALOG |

   CURRENT_ISOLATION_LEVEL |

   CURRENT_REFERENCED_CATALOG |

   CURRENT_SCHEMA |

   [CURRENT_]USER |

   SYSTEM_USER

}


special_name ::= see unqual_name


stogroup ::= see qualified_name


search_condition ::=  { praedicate search_condition { AND | OR } search_condition  |  NOT search_condition |( search_condition ) }


table ::= see qualified_name


table_specification ::=
{

     table [[AS] correlation_name [( column , ...)]] |
    subquery [AS] correlation_name [( column , ...)] |
  TABLE([ catalog .] table_function ) [WITH ORDINALITY] [[AS] correlation_name [( column , ...)]] |
    join_expression

}


table_constraint ::=
{

 UNIQUE ( column ,...) |
 PRIMARY KEY ( column ,...) |
 FOREIGN KEY ( column ,...) REFERENCES table [( column ,...)] |
 CHECK ( search_condition )

}


table_function ::=
{ CSV ([FILE] file DELIMITER delimiter [QUOTE quote ] [ESCAPE escape ], data_type ,...) | DEE [()] }


subquery ::= ( query_expression )


user_defined_function ::= unqual_routine_name argumente


arguments ::= ([ expression [{, expression }...]])


vector_column ::= see praedicate


comparison_op ::= see praedicate


default ::= see column_definition


unsigned_integer ::= see numeric_literal


value ::=

{

      literal |

   : host_variable [[INDICATOR] : indicator_variable ] |

      routine_parameter |

      local_variable |

   ?

}


character ::= see praedicate


string_function ::=

{



SUBSTRING ( expression FROM  startposition [FOR substring_length ][USING CODE_UNITS]) |
TRANSLATE ( expression USING [[ catalog .]INFORMATION_SCHEMA.] transname [DEFAULT character ] [ ,length ]) |
TRIM ([[LEADING |TRAILING | BOTH] [ character ] FROM] expression ) |
LOWER ( expression ) |
UPPER ( expression ) |
HEX_OF_VALUE ( expression2 ) |
VALUE_OF_HEX ( expression3 , data_type ) |
REP_OF_VALUE ( expression2 ) |
VALUE_OF_REP ( expression3 , data_type ) |
COLLATE ( expression USING { DUCET_WITH_VARS | DUCET_NO_VARS } [ ,length ]) |
NORMALIZE ( expression [,NFC | NFD [, length ]])

}



character ::= expression

length ::= unsigned_integer


time_function ::=

{  
   CURRENT_DATE | 
   CURRENT_TIME(3) |
   LOCALTIME(3) |
   CURRENT_TIMESTAMP(3) |
   LOCALTIMESTAMP(3) |
   DATE_OF_JULIAN_DAY ( expression )
}


time_literal ::=
{

   DATE ' year-month-day ' |
   TIME ' hour:minute:second '
   TIMESTAMP' jahr-monat-tag hour:minute:second '

}


row ::= see praedicate


digit ::= see unqual_name