Scalable Database Server, HiRDB Version 8 UAP Development Guide
When you specify the -E option, the preprocessor can use variables that correspond to SQL data types as embedded variables regardless of where those variables are declared in the UAP source file. However, variables of the register storage class cannot be used as embedded variables.
The rules of the host language used to write the UAP source file determines the effective scope of a variable. Only UAP source files written in C or COBOL can use this function.
When this function is used, the following operations can be performed:
A usage example is shown as follows.
int fetchdata(long xprice){ char xpcode[5]; char xpname[17]; char xcolor[3]; long xstock; : EXEC SQL DECLARE CR3 CURSOR FOR SELECT PCODE,PNAME,COLOR,SQUANTITY FROM STOCK WHERE PRICE=:xprice; : EXEC SQL OPEN CR3 ; : /* heading */ printf(" ***** STOCK TABLE LIST *****\n\n"); printf(" PRODUCT CODE PRODUCT NAME COLOR PRICE CURRENT STOCK\n"); printf(" ---- ---------------- -- -------- --------\n"); EXEC SQL WHENEVER SQLERROR GOTO END; EXEC SQL WHENEVER NOT FOUND GOTO END; /* FETCH */ for(;;){ EXEC SQL FETCH CR3 INTO :xpcode,:xpname,:xcolor,:xstock; printf(" %4s %-16s %2s %8d %8d\n", xpcode, xpname, xcolor, xprice, xstock); } } END:
All Rights Reserved. Copyright (C) 2007, Hitachi, Ltd.