Posted: Fri Sep 05, 2008 9:30 am Post subject: Помогите с Native SQL
Не работает данный SQL. В чем может быть проблема???
-------------------------------------
Code:
EXEC SQL.
OPEN CURSOR C FOR
select a1~NOM_CH_F, a1~summa
from ( select NOM_CH_F,sum(SUM_BUY) summa
from T_BUF
group by NOM_CH_F) a1
where a1~summa =0 .
ENDEXEC.
DO.
EXEC SQL.
FETCH NEXT CURSOR C INTO WA.
ENDEXEC.
IF sy-subrc <> 0.
EXEC SQL.
CLOSE C
ENDEXEC.
EXIT.
ENDIF.
ENDDO.
Сделал вот так.. как написано в доке.... тоже не работает, но уже другая ошибка...ORA-00933
-------------------------------------------------
Code:
DATA: d1 LIKE zzz_book_buy_h-nom_ch_f,
d2 LIKE zzz_book_buy_h-sum_buy.
******------------------------------------------------------*********
EXEC SQL.
OPEN C FOR
SELECT A1-NOM_CH_F, A1-SUMMA
FROM ( SELECT NOM_CH_F,SUM(SUM_BUY) AS SUMMA
from ZZZ_BOOK
GROUP BY NOM_CH_F) AS A1
WHERE A1-SUMMA =0
ENDEXEC.
DO.
EXEC SQL.
FETCH NEXT C INTO 1, 2
IF SY-SUBRC <> 0.
CLOSE C
EXIT.
ENDIF.
ENDEXEC.
ENDDO.
******------------------------------------------------------*********
WRITE: / 'Select One record'.
EXEC SQL.
SELECT CLIENT, NOM_CH_F, SUM_BUY INTO :CLIENT, :NOM_CH_F, :SUM_BUY
FROM Z_BOOK
ENDEXEC.
WRITE: / CLIENT, NOM_CH_F, SUM_BUY.
WRITE: / 'Select All records'.
EXEC SQL.
OPEN C FOR
SELECT CLIENT, NOM_CH_F, SUM_BUY FROM Z_BOOK
ENDEXEC.
DO.
EXEC SQL.
FETCH NEXT C INTO :CLIENT, :NOM_CH_F, :SUM_BUY
ENDEXEC.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
WRITE: / CLIENT, NOM_CH_F, SUM_BUY.
ENDDO.
EXEC SQL.
CLOSE C
ENDEXEC.
WRITE: / 'Select records with null sum'.
EXEC SQL.
OPEN C FOR
SELECT NOM_CH_F, SUM(SUM_BUY)
FROM Z_BOOK
WHERE SUM_BUY = 0
GROUP BY NOM_CH_F
ENDEXEC.
DO.
EXEC SQL.
FETCH NEXT C INTO :NOM_CH_F, :SUM_BUY
ENDEXEC.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
WRITE: / NOM_CH_F, SUM_BUY.
ENDDO.
EXEC SQL.
CLOSE C
ENDEXEC.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.