2. Embedded SQL for C : C Variables and Data Types : Variable Usage : How Function Arguments are Declared
 
Share this page                  
How Function Arguments are Declared
If you intend to use function arguments in ESQL statements, you must declare the variable to the ESQL/C compiler. In non-ANSI style C functions, you can declare function arguments directly.
Example: Function arguments usage (non-ANSI style functions)
void myfunct(arg1, arg2)

exec sql begin declare section;
     int arg1;

exec sql end declare section;
     int arg2;
In ANSI style functions, you cannot use the function argument variable directly. You must declare a local variable for use in ESQL statements, and copy the value from the function argument to the variable.
Example: Function arguments usage (ANSI style functions)
void myANSIfunct(int arg1, int arg2)

exec sql begin declare section;
     int localarg1;

exec sql end declare section;
     int localarg2;
     localarg1 = arg1;

/* Now use localarg1 in your ESQL statements */
...