Help Center/ GaussDB/ Developer Guide(Distributed_V2.0-3.x)/ Application Development Guide/ ECPG-based Development/ Running SQL Commands/ Embedded SQL Commands/ VAR
Updated on 2025-08-19 GMT+08:00
VAR
Function
Assigns a new C data type to a host variable. The host variable must have been declared in a DECLARE segment.
- Exercise caution when using VAR. Using VAR to change the data type my cause the memory address to be invalid. As a result, the data variable is invalid and the value cannot be assigned.
- If the data type has been defined in the host variable DECLARE segment, you do not need to use the VAR statement.
Syntax
VAR varname IS ctype
Parameter Description
- varname
Name of a C variable.
- ctype
C type description.
Example
EXEC SQL BEGIN DECLARE SECTION;
short a;
EXEC SQL END DECLARE SECTION;
EXEC SQL VAR a IS int; Parent topic: Embedded SQL Commands
What is your overall rating for this page?
0
1
2
3
4
5
6
7
8
9
10
Very dissatisfiedVery satisfied
Thank you very much for your feedback. We will continue working to improve the documentation.
The system is busy. Please try again later.