FirebirdSQL logo

Literals

Literals are used to directly represent values in a statement.Examples of standard types of literals are:

integer        - 0, -34, 45, 0X080000000;
fixed-point    - 0.0, -3.14
floating-point - 3.23e-23;
string         - 'text', 'don''t!', Q'{don't!}';
binary string  - x'48656C6C6F20776F726C64'
date           - DATE '2018-01-19';
time           - TIME '15:12:56';
timestamp      - TIMESTAMP '2018-01-19 13:32:02';
boolean        - true, false, unknown
null state     - null

Details about literals for each data type are discussed in section Literals (Constants) of chapter Common Language Elements.

Operators and Special Characters

A set of special characters is reserved for use as operators or separators.

<special char> ::=
  any of <space> or "%&'()*+,-./:;<=>?|^{}

Some of these characters, alone or in combination, may be used as operators (arithmetical, string, logical), as SQL command separators, to quote identifiers, or to mark the limits of string literals or comments.

Operator Syntax
<operator> ::=
    <string concatenation operator>
  | <arithmetic operator>
  | <comparison operator>
  | <logical operator>

<string concatentation operator> ::= '||'

<arithmetic operator> ::= * | / | + | -

<comparison operator> ::=
    =  | <> | != | ~= | ^= | > | < | >= | <=
  | !> | ~> | ^> | !< | ~< | ^<

<logical operator> ::= NOT | AND | OR

For more details on operators, see Expressions.

Comments

Comments may be present in SQL scripts, SQL statements and PSQL modules.A comment can be any text, usually used to document how particular parts of the code work.The parser ignores the text of comments.

Firebird supports two types of comments: block (or bracketed) and in-line (or simple).

Syntax
<comment> ::= <block comment> | <single-line comment>

<block comment> ::=
  /* <character>[<character> ...] */

<single-line comment> ::=
  -- <character>[<character> ...]<end line>

Block comments start with the /* character pair and end with the */ character pair.Text in block comments may be of any length and can occupy multiple lines.

In-line comments start with a pair of hyphen characters, -- and continue until the first linebreak (end of line).

Example
CREATE PROCEDURE P(APARAM INT)
  RETURNS (B INT)
AS
BEGIN
  /* This text will be ignored during the execution of the statement
     since it is a comment
  */
  B = A + 1; -- In-line comment
  SUSPEND;
END