Firebird 2.5 Language Reference
Revision History
| unspecified | 12 July 2025 |
Table of Contents
- 1. About the Firebird SQL Language Reference: for Firebird 2.5
- 2. SQL Language Structure
- 3. Data Types and Subtypes
- 3.1. Integer Data Types
- 3.2. Floating-Point Data Types
- 3.3. Fixed-Point Data Types
- 3.4. Data Types for Dates and Times
- 3.5. Character Data Types
- 3.6. Binary Data Types
- 3.7. Special Data Types
- 3.8. Conversion of Data Types
- 3.9. Custom Data Types — Domains
- 4. Common Language Elements
- 4.1. Expressions
- 4.2. Predicates
- 4.2.1. Assertions
- 4.2.2. Comparison Predicates
- 4.2.3. Existential Predicates
- 4.2.4. Quantified Subquery Predicates
- 5. Data Definition (DDL) Statements
- 5.1.
DATABASE - 5.2.
SHADOW - 5.3.
DOMAIN - 5.4.
TABLE- 5.4.1.
CREATE TABLE - 5.4.2.
ALTER TABLE- 5.4.2.1. Version Count Increments
- 5.4.2.2. The
ADDClause - 5.4.2.3. The
DROPClause - 5.4.2.4. The
DROP CONSTRAINTClause - 5.4.2.5. The
ALTER [COLUMN]Clause - 5.4.2.6. Renaming a Column: the
TOKeyword - 5.4.2.7. Changing the Data Type of a Column: the
TYPEKeyword - 5.4.2.8. Changing the Position of a Column: the
POSITIONKeyword - 5.4.2.9. The
DROP DEFAULTandSET DEFAULTClauses - 5.4.2.10. The
COMPUTED [BY]orGENERATED ALWAYS ASClauses - 5.4.2.11. Attributes that Cannot Be Altered
- 5.4.2.12. Examples Using
ALTER TABLE
- 5.4.3.
DROP TABLE - 5.4.4.
RECREATE TABLE
- 5.4.1.
- 5.5.
INDEX - 5.6.
VIEW - 5.7.
TRIGGER - 5.8.
PROCEDURE - 5.9.
EXTERNAL FUNCTION - 5.10.
FILTER - 5.11.
SEQUENCE(GENERATOR) - 5.12.
EXCEPTION - 5.13.
COLLATION - 5.14.
CHARACTER SET - 5.15.
ROLE - 5.16.
COMMENTS
- 5.1.
- 6. Data Manipulation (DML) Statements
- 6.1.
SELECT - 6.2.
INSERT - 6.3.
UPDATE - 6.4.
UPDATE OR INSERT - 6.5.
DELETE - 6.6.
MERGE - 6.7.
EXECUTE PROCEDURE - 6.8.
EXECUTE BLOCK
- 6.1.
- 7. Procedural SQL (PSQL) Statements
- 7.1. Elements of PSQL
- 7.2. Stored Procedures
- 7.3. Stored Functions
- 7.4. PSQL Blocks
- 7.5. Triggers
- 7.6. Writing the Body Code
- 7.6.1. Assignment Statements
- 7.6.2.
DECLARE CURSOR - 7.6.3.
DECLARE VARIABLE - 7.6.4.
BEGIN … END - 7.6.5.
IF … THEN … ELSE - 7.6.6.
WHILE … DO - 7.6.7.
LEAVE - 7.6.8.
EXIT - 7.6.9.
SUSPEND - 7.6.10.
EXECUTE STATEMENT - 7.6.11.
FOR SELECT - 7.6.12.
FOR EXECUTE STATEMENT - 7.6.13.
OPEN - 7.6.14.
FETCH - 7.6.15.
CLOSE - 7.6.16.
IN AUTONOMOUS TRANSACTION - 7.6.17.
POST_EVENT
- 7.7. Trapping and Handling Errors
- 8. Built-in Functions
- 8.1. Context Functions
- 8.2. Mathematical Functions
- 8.2.1.
ABS() - 8.2.2.
ACOS() - 8.2.3.
ASIN() - 8.2.4.
ATAN() - 8.2.5.
ATAN2() - 8.2.6.
CEIL(),CEILING() - 8.2.7.
COS() - 8.2.8.
COSH() - 8.2.9.
COT() - 8.2.10.
EXP() - 8.2.11.
FLOOR() - 8.2.12.
LN() - 8.2.13.
LOG() - 8.2.14.
LOG10() - 8.2.15.
MOD() - 8.2.16.
PI() - 8.2.17.
POWER() - 8.2.18.
RAND() - 8.2.19.
ROUND() - 8.2.20.
SIGN() - 8.2.21.
SIN() - 8.2.22.
SINH() - 8.2.23.
SQRT() - 8.2.24.
TAN() - 8.2.25.
TANH() - 8.2.26.
TRUNC()
- 8.2.1.
- 8.3. String Functions
- 8.3.1.
ASCII_CHAR() - 8.3.2.
ASCII_VAL() - 8.3.3.
BIT_LENGTH() - 8.3.4.
CHAR_LENGTH(),CHARACTER_LENGTH() - 8.3.5.
HASH() - 8.3.6.
LEFT() - 8.3.7.
LOWER() - 8.3.8.
LPAD() - 8.3.9.
OCTET_LENGTH() - 8.3.10.
OVERLAY() - 8.3.11.
POSITION() - 8.3.12.
REPLACE() - 8.3.13.
REVERSE() - 8.3.14.
RIGHT() - 8.3.15.
RPAD() - 8.3.16.
SUBSTRING() - 8.3.17.
TRIM() - 8.3.18.
UPPER()
- 8.3.1.
- 8.4. Date and Time Functions
- 8.5. Type Casting Functions
- 8.6. Bitwise Functions
- 8.7. UUID Functions
- 8.8. Functions for Sequences (Generators)
- 8.9. Conditional Functions
- 8.10. Aggregate Functions
- 9. Context Variables
- 9.1.
CURRENT_CONNECTION - 9.2.
CURRENT_DATE - 9.3.
CURRENT_ROLE - 9.4.
CURRENT_TIME - 9.5.
CURRENT_TIMESTAMP - 9.6.
CURRENT_TRANSACTION - 9.7.
CURRENT_USER - 9.8.
DELETING - 9.9.
GDSCODE - 9.10.
INSERTING - 9.11.
LOCALTIME - 9.12.
LOCALTIMESTAMP - 9.13.
NEW - 9.14.
'NOW' - 9.15.
OLD - 9.16.
ROW_COUNT - 9.17.
SQLCODE - 9.18.
SQLSTATE - 9.19.
'TODAY' - 9.20.
'TOMORROW' - 9.21.
UPDATING - 9.22.
'YESTERDAY' - 9.23.
USER
- 9.1.
- 10. Transaction Control
- 10.1. Transaction Statements
- 10.1.1.
SET TRANSACTION - 10.1.2.
COMMIT - 10.1.3.
ROLLBACK - 10.1.4.
SAVEPOINT - 10.1.5.
RELEASE SAVEPOINT - 10.1.6. Internal Savepoints
- 10.1.7. Savepoints and PSQL
- 10.1.1.
- 10.1. Transaction Statements
- 11. Security
- 11.1. User Authentication
- 11.2. SQL Privileges
- 11.2.1. The Object Owner
- 11.2.2. Statements for Granting Privileges
- 11.2.3. Statements for Revoking Privileges
- A. Supplementary Information
- B. Exception Codes and Messages
- C. Reserved Words and Keywords
- D. System Tables
- D.1.
RDB$BACKUP_HISTORY - D.2.
RDB$CHARACTER_SETS - D.3.
RDB$CHECK_CONSTRAINTS - D.4.
RDB$COLLATIONS - D.5.
RDB$DATABASE - D.6.
RDB$DEPENDENCIES - D.7.
RDB$EXCEPTIONS - D.8.
RDB$FIELDS - D.9.
RDB$FIELD_DIMENSIONS - D.10.
RDB$FILES - D.11.
RDB$FILTERS - D.12.
RDB$FORMATS - D.13.
RDB$FUNCTIONS - D.14.
RDB$FUNCTION_ARGUMENTS - D.15.
RDB$GENERATORS - D.16.
RDB$INDICES - D.17.
RDB$INDEX_SEGMENTS - D.18.
RDB$LOG_FILES - D.19.
RDB$PAGES - D.20.
RDB$PROCEDURES - D.21.
RDB$PROCEDURE_PARAMETERS - D.22.
RDB$REF_CONSTRAINTS - D.23.
RDB$RELATIONS - D.24.
RDB$RELATION_CONSTRAINTS - D.25.
RDB$RELATION_FIELDS - D.26.
RDB$ROLES - D.27.
RDB$SECURITY_CLASSES - D.28.
RDB$TRANSACTIONS - D.29.
RDB$TRIGGERS - D.30.
RDB$TRIGGER_MESSAGES - D.31.
RDB$TYPES - D.32.
RDB$USER_PRIVILEGES - D.33.
RDB$VIEW_RELATIONS
- D.1.
- E. Monitoring Tables
- F. Character Sets and Collation Sequences
- G. License notice
- H. Document History