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 query

Former Member
0 Likes
347

I want to reduce the database hit for the external database so i'm trying to use cursor. I'm following the F1 help syntax. But problem is it is giving Dump in the FETCH NEXT statement. Please help.

EXEC SQL.

OPEN C1 FOR SELECT SAP_MASTNR, ANK_MASTNR FROM

NOVARTIS.TABLE_ADRESS@ANKD WHERE ANK_MASTNR IN :wa_datlt ;

ENDEXEC.

DO.

EXEC SQL.

FETCH NEXT C1 INTO :wa ;

ENDEXEC.

IF SY-SUBRC <> 0.

EXIT.

ENDIF.

ENDDO.

EXEC SQL.

CLOSE C1

ENDEXEC.

2 REPLIES 2
Read only

Former Member
0 Likes
325

Hi Phani,

if you are using Oracle, the correct syntax should be "fetch cursor_name into variable".

I hope it helps. BR,

Alvaro

Read only

Former Member
0 Likes
325

Hi Even then it is giving dump. And one more thing the value in the wa_datlt contains this ( '005236' , '36587' , '36587' ).

If i skip that where clause or if the variable wa_datlt contains single value it is working fine. What could be the reason?