Created On: 29 March 2011
Problem:
The AcuSQL -Pr precompile option causes an error when using an indicator variable to insert null data: Incorrect syntax near ‘@P3’. This is an example of the indicator variable usage that causes the error:
EXEC SQL
INSERT INTO TABLEONE (TABLE_CODE, DATA_FIELD)
VALUES (:table-code, :data-field :myind)
END-EXEC.
There is no such precompile error without the -Pr option but it must be used because of other SQL in the program.
In versions prior to 8.0 there was no error when precompiling. However, at runtime it didn’t insert a null. Instead, the column contained an asterisk.
EXEC SQL
INSERT INTO TABLEONE (TABLE_CODE, DATA_FIELD)
VALUES (:table-code, :data-field :myind)
END-EXEC.
There is no such precompile error without the -Pr option but it must be used because of other SQL in the program.
In versions prior to 8.0 there was no error when precompiling. However, at runtime it didn’t insert a null. Instead, the column contained an asterisk.
Resolution:
To resolve the precompile error remove the space between the data item and the indicator variable.
Instead of
:data-field :myind
Use
:data-field:myind
Instead of
:data-field :myind
Use
:data-field:myind
Old KB# 33796