Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Inserting data into SQL tables

0 Likes
1,981

Hi All,

i got one new requirement form customer , there is one report which will insert the some data into our custom (Z/Y table) table . while saving the data into custom table we need to update the same records into SQL table which is having the same fields . and i have tried with eith below Code to isert the data into SQL table .

EXEC SQL.

         INSERT INTO  CCEC_POD

                      (Material_dc_no,

                       service_dc_no,

                       plant_code,

                       DC_qty,

                       pod_qty,

                       pump_code,

                       pod_number,

                       pod_date,

                       customer_code,

                       project_code,

                       material_order_no,

                       dc_type,

                       created_on)

                values ('111122121' , '124578965' , '1000' , '100','100' ).

       ENDEXEC.



and after executing the abouve code it was giving dump in ST22 .



Runtime Errors         DBIF_DSQL2_SQL_ERROR

Exception              CX_SY_NATIVE_SQL_ERROR

Date and Time          08.09.2016 11:11:34

Short Text

     An SQL error occurred when executing Native SQL.

What happened?

     The error 947 occurred in the current database connection "DEFAULT".

kindly help on this . is there any connections need to check before executing the report .

Regards,

Raju.

4 REPLIES 4
Read only

Former Member
0 Likes
1,165

Hi Raju

Have you defined a connection so that you're program knows which system it should be talking with?

Take a look at the coding example here...it is not specific to your issue but has a better flow which includes the Connection Definition.

cl_sql_statement code sample | SCN

Regards

Arden

Read only

0 Likes
1,165

Hi Arden,

Thanks for  quick Replay .....

how to do that connection ? where to do that ? can you give the step by step process for the same . it will help for me.

Regards,

Appala Raju,

Read only

Former Member
0 Likes
1,165

Hi Raju!

try this command:

         INSERT INTO  CCEC_POD

                      (Material_dc_no,

                       service_dc_no,

                       plant_code,

                       DC_qty,

                       pod_qty)

                values ('111122121' , '124578965' , '1000' , '100','100')

or this:

         INSERT INTO  CCEC_POD

                      (Material_dc_no,

                       service_dc_no,

                       plant_code,

                       DC_qty,

                       pod_qty,

                       pump_code,

                       pod_number,

                       pod_date,

                       customer_code,

                       project_code,

                       material_order_no,

                       dc_type,

                       created_on)

                values ('111122121' , '124578965' , '1000' , '100','100','','','','','','','','')

Regards,

János

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,165

Your values list doesn't match your fields list.  So database disagree and raise error (Is this Oracle, ORA-00947 not enough values?)

Also is this table in the same database than your ECC (DEFAULT connection?) else did you use some EXEC SQL. CONNECT TO dbs [AS con]. ENDEXEC. ?

Regards,

Raymond