Firebird 4.0 Language Reference
Revision History
unspecified | 2 October 2024 |
Table of Contents
- 1. About the Firebird 4.0 Language Reference
- 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. Boolean Data Type
- 3.7. Binary Data Types
- 3.8. Array Types
- 3.9. Special Data Types
- 3.10. Conversion of Data Types
- 3.11. Custom Data Types — Domains
- 3.12. Data Type Declaration Syntax
- 4. Common Language Elements
- 4.1. Expressions
- 4.2. Predicates
- 4.2.1. Conditions
- 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.1.1. Character Columns
- 5.4.1.2. Setting a
DEFAULT
Value - 5.4.1.3. Domain-based Columns
- 5.4.1.4. Identity Columns (Autoincrement)
- 5.4.1.5. Calculated Fields
- 5.4.1.6. Defining an Array Column
- 5.4.1.7. Constraints
- 5.4.1.8.
SQL SECURITY
Clause - 5.4.1.9. Replication Management
- 5.4.1.10. Who Can Create a Table
- 5.4.1.11.
CREATE TABLE
Examples - 5.4.1.12. Global Temporary Tables (GTT)
- 5.4.1.13. External Tables
- 5.4.2.
ALTER TABLE
- 5.4.2.1. Version Count Increments
- 5.4.2.2. The
ADD
Clause - 5.4.2.3. The
DROP
Clause - 5.4.2.4. The
DROP CONSTRAINT
Clause - 5.4.2.5. The
ALTER [COLUMN]
Clause - 5.4.2.6. Renaming a Column: the
TO
Clause - 5.4.2.7. Changing the Data Type of a Column: the
TYPE
Clause - 5.4.2.8. Changing the Position of a Column: the
POSITION
Clause - 5.4.2.9. The
DROP DEFAULT
andSET DEFAULT
Clauses - 5.4.2.10. The
SET NOT NULL
andDROP NOT NULL
Clauses - 5.4.2.11. The
COMPUTED [BY]
orGENERATED ALWAYS AS
Clauses - 5.4.2.12. Changing Identity Columns
- 5.4.2.13. Changing SQL Security
- 5.4.2.14. Replication Management
- 5.4.2.15. Attributes that Cannot Be Altered
- 5.4.2.16. Who Can Alter a Table?
- 5.4.2.17. 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.
FUNCTION
- 5.10.
EXTERNAL FUNCTION
- 5.11.
PACKAGE
- 5.12.
PACKAGE BODY
- 5.13.
FILTER
- 5.14.
SEQUENCE
(GENERATOR
) - 5.15.
EXCEPTION
- 5.16.
COLLATION
- 5.17.
CHARACTER SET
- 5.18. Comments
- 5.1.
- 6. Data Manipulation (DML) Statements
- 6.1.
SELECT
- 6.1.1.
FIRST
,SKIP
- 6.1.2. The
SELECT
Columns List - 6.1.3. The
FROM
clause - 6.1.4. Joins
- 6.1.5. The
WHERE
clause - 6.1.6. The
GROUP BY
clause - 6.1.7. The
WINDOW
Clause - 6.1.8. The
PLAN
Clause - 6.1.9.
UNION
- 6.1.10.
ORDER BY
- 6.1.11.
ROWS
- 6.1.12.
OFFSET
,FETCH
- 6.1.13.
FOR UPDATE [OF]
- 6.1.14.
WITH LOCK
- 6.1.15.
INTO
- 6.1.16. Common Table Expressions (
)WITH … AS … SELECT
- 6.1.1.
- 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. Packages
- 7.6. Triggers
- 7.7. Writing the Body Code
- 7.7.1. Assignment Statements
- 7.7.2. Management Statements in PSQL
- 7.7.3.
DECLARE VARIABLE
- 7.7.4.
DECLARE .. CURSOR
- 7.7.5.
DECLARE FUNCTION
- 7.7.6.
DECLARE PROCEDURE
- 7.7.7.
BEGIN … END
- 7.7.8.
IF … THEN … ELSE
- 7.7.9.
WHILE … DO
- 7.7.10.
BREAK
- 7.7.11.
LEAVE
- 7.7.12.
CONTINUE
- 7.7.13.
EXIT
- 7.7.14.
SUSPEND
- 7.7.15.
EXECUTE STATEMENT
- 7.7.16.
FOR SELECT
- 7.7.17.
FOR EXECUTE STATEMENT
- 7.7.18.
OPEN
- 7.7.19.
FETCH
- 7.7.20.
CLOSE
- 7.7.21.
IN AUTONOMOUS TRANSACTION
- 7.7.22.
POST_EVENT
- 7.7.23.
RETURN
- 7.8. Trapping and Handling Errors
- 8. Built-in Scalar Functions
- 8.1. Context Functions
- 8.2. Mathematical Functions
- 8.2.1.
ABS()
- 8.2.2.
ACOS()
- 8.2.3.
ACOSH()
- 8.2.4.
ASIN()
- 8.2.5.
ASINH()
- 8.2.6.
ATAN()
- 8.2.7.
ATAN2()
- 8.2.8.
ATANH()
- 8.2.9.
CEIL()
,CEILING()
- 8.2.10.
COS()
- 8.2.11.
COSH()
- 8.2.12.
COT()
- 8.2.13.
EXP()
- 8.2.14.
FLOOR()
- 8.2.15.
LN()
- 8.2.16.
LOG()
- 8.2.17.
LOG10()
- 8.2.18.
MOD()
- 8.2.19.
PI()
- 8.2.20.
POWER()
- 8.2.21.
RAND()
- 8.2.22.
ROUND()
- 8.2.23.
SIGN()
- 8.2.24.
SIN()
- 8.2.25.
SINH()
- 8.2.26.
SQRT()
- 8.2.27.
TAN()
- 8.2.28.
TANH()
- 8.2.29.
TRUNC()
- 8.2.1.
- 8.3. String and Binary Functions
- 8.3.1.
ASCII_CHAR()
- 8.3.2.
ASCII_VAL()
- 8.3.3.
BASE64_DECODE()
- 8.3.4.
BASE64_ENCODE()
- 8.3.5.
BIT_LENGTH()
- 8.3.6.
BLOB_APPEND()
- 8.3.7.
CHAR_LENGTH()
,CHARACTER_LENGTH()
- 8.3.8.
CRYPT_HASH()
- 8.3.9.
HASH()
- 8.3.10.
HEX_DECODE()
- 8.3.11.
HEX_ENCODE()
- 8.3.12.
LEFT()
- 8.3.13.
LOWER()
- 8.3.14.
LPAD()
- 8.3.15.
OCTET_LENGTH()
- 8.3.16.
OVERLAY()
- 8.3.17.
POSITION()
- 8.3.18.
REPLACE()
- 8.3.19.
REVERSE()
- 8.3.20.
RIGHT()
- 8.3.21.
RPAD()
- 8.3.22.
SUBSTRING()
- 8.3.23.
TRIM()
- 8.3.24.
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. Special Functions for
DECFLOAT
- 8.11. Cryptographic Functions
- 8.12. Other Functions
- 9. Aggregate Functions
- 10. Window (Analytical) Functions
- 11. Context Variables
- 11.1.
CURRENT_CONNECTION
- 11.2.
CURRENT_DATE
- 11.3.
CURRENT_ROLE
- 11.4.
CURRENT_TIME
- 11.5.
CURRENT_TIMESTAMP
- 11.6.
CURRENT_TRANSACTION
- 11.7.
CURRENT_USER
- 11.8.
DELETING
- 11.9.
GDSCODE
- 11.10.
INSERTING
- 11.11.
LOCALTIME
- 11.12.
LOCALTIMESTAMP
- 11.13.
NEW
- 11.14.
'NOW'
- 11.15.
OLD
- 11.16.
RESETTING
- 11.17.
ROW_COUNT
- 11.18.
SQLCODE
- 11.19.
SQLSTATE
- 11.20.
'TODAY'
- 11.21.
'TOMORROW'
- 11.22.
UPDATING
- 11.23.
'YESTERDAY'
- 11.24.
USER
- 11.1.
- 12. Transaction Control
- 12.1. Transaction Statements
- 12.1.1.
SET TRANSACTION
- 12.1.2.
COMMIT
- 12.1.3.
ROLLBACK
- 12.1.4.
SAVEPOINT
- 12.1.5.
RELEASE SAVEPOINT
- 12.1.6. Internal Savepoints
- 12.1.7. Savepoints and PSQL
- 12.1.1.
- 12.1. Transaction Statements
- 13. Security
- 13.1. User Authentication
- 13.2. SQL Statements for User Management
- 13.3. SQL Privileges
- 13.4.
ROLE
- 13.5. Statements for Granting Privileges
- 13.5.1.
GRANT
- 13.5.1.1. The
TO
Clause - 13.5.1.2. The
WITH GRANT OPTION
Clause - 13.5.1.3. The
GRANTED BY
Clause - 13.5.1.4. Privileges on Tables and Views
- 13.5.1.5. The
EXECUTE
Privilege - 13.5.1.6. The
USAGE
Privilege - 13.5.1.7. DDL Privileges
- 13.5.1.8. Database DDL Privileges
- 13.5.1.9. Examples of Granting Database DDL Privileges
- 13.5.1.10. Assigning Roles
- 13.5.1.1. The
- 13.5.1.
- 13.6. Statements for Revoking Privileges
- 13.7. Mapping of Users to Objects
- 13.8. Database Encryption
- 13.9. SQL Security
- 14. Management Statements
- A. Supplementary Information
- B. Exception Codes and Messages
- C. Reserved Words and Keywords
- D. System Tables
- D.1.
RDB$AUTH_MAPPING
- D.2.
RDB$BACKUP_HISTORY
- D.3.
RDB$CHARACTER_SETS
- D.4.
RDB$CHECK_CONSTRAINTS
- D.5.
RDB$COLLATIONS
- D.6.
RDB$CONFIG
- D.7.
RDB$DATABASE
- D.8.
RDB$DB_CREATORS
- D.9.
RDB$DEPENDENCIES
- D.10.
RDB$EXCEPTIONS
- D.11.
RDB$FIELDS
- D.12.
RDB$FIELD_DIMENSIONS
- D.13.
RDB$FILES
- D.14.
RDB$FILTERS
- D.15.
RDB$FORMATS
- D.16.
RDB$FUNCTIONS
- D.17.
RDB$FUNCTION_ARGUMENTS
- D.18.
RDB$GENERATORS
- D.19.
RDB$INDICES
- D.20.
RDB$INDEX_SEGMENTS
- D.21.
RDB$LOG_FILES
- D.22.
RDB$PACKAGES
- D.23.
RDB$PAGES
- D.24.
RDB$PROCEDURES
- D.25.
RDB$PROCEDURE_PARAMETERS
- D.26.
RDB$PUBLICATIONS
- D.27.
RDB$PUBLICATION_TABLES
- D.28.
RDB$REF_CONSTRAINTS
- D.29.
RDB$RELATIONS
- D.30.
RDB$RELATION_CONSTRAINTS
- D.31.
RDB$RELATION_FIELDS
- D.32.
RDB$ROLES
- D.33.
RDB$SECURITY_CLASSES
- D.34.
RDB$TIME_ZONES
- D.35.
RDB$TRANSACTIONS
- D.36.
RDB$TRIGGERS
- D.37.
RDB$TRIGGER_MESSAGES
- D.38.
RDB$TYPES
- D.39.
RDB$USER_PRIVILEGES
- D.40.
RDB$VIEW_RELATIONS
- D.1.
- E. Monitoring Tables
- F. Security tables
- G. Character Sets and Collation Sequences
- H. License notice
- I. Document History