When a UAP is created, the labelling rules, SQL coding rules, and SQL syntax rules must be followed.
Labels must be assigned according to the C language rules. These types of labels cannot be used:
For naming embedded variables, indicator variables, and branching destination labels, the labeling and the C language rules must be followed.
EXEC SQL SQL-statement;
#define X USER.MEMBER
EXEC SQL
SELECT NAME INTO MANNAME FROM X;
EXEC SQL
SELECT MEM INTO :NAME FROM TABLE;
exec sql
select MEM into :NAME from TABLE;
exec SQL
SELECT MEM Into :NAME From TABLE;
EXEC SQL
BEGIN DECLARE SECTION;
...
EXEC SQL
END DECLARE SECTION;
EXEC SQL
SELECT... ;
EXEC SQL
BEGIN
DECLARE SECTION;
:
EXEC SQL
END
DECLARE SECTION;
EXEC \
SQL
SELECT ... ;
EXEC SQL
BEGIN DECLARE SECTION;
short SALES;
EXEC SQL
END DECLARE SECTION;
...
EXEC SQL
SELECT PRICE INTO :SALES
FROM TABLE;
short SALES,
QUANTITY;
short SALES; short QUANTITY;
Table 7-1 Items that can be described within an embedded SQL declare section
Described Item | Description within embedded declaration |
---|---|
Note | D |
C language instruction statement | ![]() |
C language control statement | ![]() |
SQL statement | ![]() |
Embedded variable declaration | D |
Indicator variable declaration | D |
short SALES, QUANTITY; 1
short XSALES, XQUANTITY; 2
Table 7-2 Locations where SQL statements can be described
Description location within a line | SQL statement description | |
---|---|---|
C language and instruction statement | Front | ![]() |
Middle | ![]() | |
Back | ![]() | |
C language control statement | Front | ![]() |
Middle | ![]() | |
Back | ![]() | |
Label | Front | ![]() |
Back | D | |
Comments | Front | D |
Middle | ![]() | |
Back | D | |
SQL statement* | Front | ![]() |
Middle | ![]() | |
Back | ![]() |
#include <afx.h>
EXEC SQL INCLUDE HIRDB_HEADERS ;