Firebird Documentation Index → Firebird 2.5 Release Notes → Procedural SQL (PSQL) → Borrow Database Column Type for a PSQL Variable |
Tracker reference CORE-1356.
This feature extends the implementation in v.2 whereby domains became available as “data types” for declaring variables in PSQL. Now it is possible to borrow the data type of a column definition from a table or view for this purpose.
Syntax Pattern
data_type ::= <builtin_data_type> | <domain_name> | TYPE OF <domain_name> | TYPE OF COLUMN <table or view>.<column>
TYPE OF COLUMN gets only the type of the column. Any constraints or default values defined for the column are ignored.
Examples
CREATE TABLE PERSON ( ID INTEGER, NAME VARCHAR(40) ); CREATE PROCEDURE SP_INS_PERSON ( ID TYPE OF COLUMN PERSON.ID, NAME TYPE OF COLUMN PERSON.NAME ) AS DECLARE VARIABLE NEW_ID TYPE OF COLUMN PERSON.ID; BEGIN INSERT INTO PERSON (ID, NAME) VALUES (:ID, :NAME) RETURNING ID INTO :NEW_ID; END
Firebird Documentation Index → Firebird 2.5 Release Notes → Procedural SQL (PSQL) → Borrow Database Column Type for a PSQL Variable |