‎2009 Dec 31 11:36 AM
HI all,
I am getting an exception while inserting records using native SQL into CORP table.
PFB the code.
LOOP AT gi_hrp1001 INTO wa_hrp1001.
TRY.
EXEC SQL.
INSERT INTO misuser.Table_4
VALUES (wa_hrp1001-otype , wa_hrp1001-objid ).
ENDEXEC.
CATCH cx_sy_native_sql_error.
MESSAGE 'Connect - Error ' TYPE 'E'.
ENDTRY.
ENDLOOP.Please help.
Thanks & Regards
Nitesh
‎2009 Dec 31 11:00 PM
I see two issue with your Insert. 1) you need to specify the field names in the table, for example otype and objid. 2) You need to indicate in the VALUES that you're using host variables by using the prefix :.
I think the correct syntax is:
EXEC SQL.
INSERT INTO misuser.Table_4
(otype, objid)
VALUES (:wa_hrp1001-otype, :wa_hrp1001-objid)
ENDEXEC.
Good luck.
‎2010 Jan 06 12:48 PM