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

Native SQL Error!

Former Member
0 Likes
1,185

Hi,

I do have the following code:

EXEC SQL.

INSERT INTO ath_empgroup

(employee_groupid,

name,

start_date,

end_date)

VALUES (:it_zauthoria_bridge-auth_grp,

:it_zauthoria_bridge-auth_name,

:it_zauthoria_bridge-beg_date,

:it_zauthoria_bridge-end_date)

ENDEXEC.

But whenever I run the code I get the following runtime error saying "An SQL Error Occur When Executing Native SQL"

Does anyone know what could be a possible problem? The it_zauthoria_bridge is an internal table that I use on my ABAP program and ath_empgroup is a table under SQL environment.

Thanks,

Val.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,143

a) What specific error message do you get?

b) why are you using native SQL for this?

Rob

8 REPLIES 8
Read only

Former Member
0 Likes
1,144

a) What specific error message do you get?

b) why are you using native SQL for this?

Rob

Read only

0 Likes
1,143

Hi Rob,

I am using native SQL because major part of my program is in ABAP and I need to store some data in a table that is in our repository system called Authoria. Also with native SQL I am able to have access to databases that are not in SAP environment.

I have changed my code a little bit as I realized the date had some issues.. However, now I am getting another error 'ORA-00936 - Missing Expression'. My code now looks like the following:

EXEC SQL.

INSERT INTO ath_empgroup

(employee_groupid,

name,

start_date,

end_date)

VALUES (:it_zauthoria_grp-auth_group,

:it_zauthoria_grp-auth_group,

to_date(:it_zauthoria_grp- beg_date,'YYYYMMDD',)

to_date(:it_zauthoria_grp-end_date,'YYYYMMDD' )

ENDEXEC.

Thanks!

Val.

Read only

0 Likes
1,143

>

> > VALUES (:it_zauthoria_grp-auth_group,

> :it_zauthoria_grp-auth_group,

> to_date(:it_zauthoria_grp- beg_date,'YYYYMMDD',)

> to_date(:it_zauthoria_grp-end_date,'YYYYMMDD' )

>

> ENDEXEC.

>

> Val.

The comma on the first TO_DATE line should be after the bracket, not before.

Read only

0 Likes
1,143

Hi Christine,

I had tried that before but I got an error saying "Missing Comma".. but now it is fine after I changed to what it is now. If you look at the line above it is exactly the same as what is in the brackets.. so I guess it is supposed to be that way. But it could also be that I am missing another comma.

Let me know if you dohave any other idea.

Thanks,

Val.

Read only

0 Likes
1,143

>

> Hi Christine,

>

> I had tried that before but I got an error saying "Missing Comma".. but now it is fine after I changed to what it is now. If you look at the line above it is exactly the same as what is in the brackets.. so I guess it is supposed to be that way. But it could also be that I am missing another comma.

>

> Let me know if you dohave any other idea.

>

> Thanks,

>

> Val.

No, I think you do need to move the comma. And you'll also need to add another closing bracket at the end to close the 'VALUES' open bracket.

Read only

0 Likes
1,143

Start by getting rid of the space in :it_zauthoria_grp- beg_date

Rob

Read only

0 Likes
1,143

Thank you Christine!! It worked you earned the maximum points!! I dont know how I missed that!

Read only

GrahamRobbo
SAP Mentor
SAP Mentor
0 Likes
1,143

Look in the trace files for the work process and you should see the text of the error message returned by the DBMS.

Cheers

Graham Robbo