February 26, 2026: PostgreSQL 18.3, 17.9, 16.13, 15.17, and 14.22 Released!
Supported Versions: Current (18) / 17 / 16 / 15 / 14
Development Versions: devel
Unsupported versions: 13 / 12 / 11 / 10 / 9.6 / 9.5 / 9.4 / 9.3 / 9.2 / 9.1
VAR
VAR — define a variable
Synopsis
VAR varname IS ctype
Description
The VAR command assigns a new C data type to a host variable. The host variable must be previously declared in a declare section.
Parameters
varname #
A C variable name.
ctype #
A C type specification.
Examples
Exec sql begin declare section; short a; exec sql end declare section; EXEC SQL VAR a IS int;
Compatibility
The VAR command is a PostgreSQL extension.
Submit correction
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.