1.2.11

SAP Note 21299 - ORA-00932 during EXEC SQL on VARC field

Symptom:

SQL error 932 occurs during a SELECT operation on a field of a table with type VARC within an EXEC SQL statement.
Also occurs during a SELECT * INTO :wa when the table contains a VARC field.

Cause and prerequisites

Due to historical reasons, VARC fields with a length of more 255 characters are portrayed in the DB as type LONG RAW. However, type C is always used in ABAP.

Solution
In this case, the generated ABAP type cannot be used. Instead, you have to explicitly declare a field with ABAP type X and specify this type during selection.
Example:
WRONG:
EXEC SQL PERFORMING APPEND_VRSXTAB.
SELECT CLUSTD FROM VRSX INTO :VRSX-CLUSTD
WHERE RELID = 'VI'
ENDEXEC.

RIGHT:
DATA CLUHELP(255) TYPE X.
EXEC SQL PERFORMING APPEND_VRSXTAB.
SELECT CLUSTD FROM VRSX INTO :CLUHELP
WHERE RELID = 'VI'
ENDEXEC.

No comments:

Post a Comment