02-25-2013 6:08 PM
Hello guys,
Please help. We are using ORACLE DATABASE as backend.
1. I am selecting multiple records from SAP tables and want to insert records using NATIVE SQL, How can I do that any sample code?
2. We have created tables directly in ORACLE therefore using NATIVE SQL. These tables are not part of the SAP instance.
Please help with sample code. Any help will be appreciated.
Thanks,
James
02-25-2013 6:18 PM
First read some documentation like Native SQL in help.sap.com, also
02-25-2013 7:47 PM
02-25-2013 7:05 PM
Hi,
Plesae refer to the below link.Hope its helpful for u.
https://scn.sap.com/thread/1016531
Regards,
Santanu Mohapatra
07-08-2013 9:12 AM
Hi Jim,
General way inserting data using Native SQL is
EXEC SQL.
INSERT INTO <TABLENAME> (<FIELD1>, <FIELD2>, <FIELD3>)
VALUES (<VALUE1>,<VALUE3><VALUE3>)
ENDEXEC.
Since in your case there is a internal table we require to loop at the table into work area, and the content of the work area is passed to the value.
LOOP it_tab1 into wa_itab1.
INSERT INTO <TABLENAME> (<FIELD1>, <FIELD2>,....<FIELDN>)
VALUES (:wa_itab1-field1,:wa_itab1-field2,.....:wa_itab1-fieldN)
ENDEXEC.
ENDLOOP.
Also refer to below link