Database column types

Variable defined with the LIKE keyword get the same data type of the column specified column in a database schema.

For example:
SCHEMA stores 
DEFINE cname LIKE customer.cust_name 
MAIN
  DEFINE cr RECORD LIKE customer.*
  ...
END MAIN

A SCHEMA statement must define the database name identifying the database schema files to be used.

The column data types are read from the schema file during compilation. Make sure that your schema files correspond exactly to the production database.

The database schema files must exist and must be located in one of the diretories specified in the FGLDBPATH environment variable.

When using database views, the column cannot be based on an aggregate function like SUM().

If LIKE references a SERIAL column, the variable will be defined with the INTEGER data type. If LIKE references an INT8, SERIAL8 or BIGSERIAL column, the variable will be defined with the BIGINT data type.

The table qualifier must specify owner if table.column is not a unique column identifier within its database, or if the database is ANSI-compliant and any user of your application is not the owner of table.

Database schema files must be generated with the fgldbsch tool before compiling the source module using a DEFINE LIKE instruction.