‎2012 Jan 07 7:32 PM
Hello Experts,
Please help me.
I have a program where I try insert data in a external database ( Oracle ), the program run normally without erros, but the data is not commited in oracle.
Is it possible de connection have a property to set some type of authorization to INSERT and UPDATE ??
see below the code:
EXEC SQL.
CONNECT TO :CONNECTION
ENDEXEC.
if sy-subrc = 0.
EXEC SQL.
SET CONNECTION :CONNECTION
ENDEXEC.
EXEC SQL.
INSERT INTO AGRICOLA.TESTE(DATA, TESTE) VALUES(SYSDATE, :sy-uname)
ENDEXEC.
EXEC SQL.
COMMIT
ENDEXEC.
EXEC SQL.
SET CONNECTION DEFAULT
ENDEXEC.
EXEC SQL.
DISCONNECT :CONNECTION
ENDEXEC.
endif.
‎2012 Jan 08 2:30 AM
Hi ,
I think this problem might be due to the Data types,
Instead of sending system variable directly itself, you try to make it as char then try..
‎2012 Jan 09 1:38 PM
Thanks for your time my friend, but still doesn't work
I change the command for "UPDATE", but there isn't success
EXEC SQL.
UPDATE AGRICOLA.TESTE SET TESTE = 'W' WHERE TESTE = 'A'
ENDEXEC.
‎2012 Jan 09 1:50 PM
Try to add error management in your code like following sample :
DATA: lo_ref TYPE REF TO cx_sy_native_sql_error,
lv_text TYPE string.
* ...
TRY.
" ...
EXEC SQL.
INSERT INTO AGRICOLA.TESTE(DATA, TESTE) VALUES(SYSDATE, :sy-uname)
ENDEXEC.
" ...
CATCH cx_sy_native_sql_error INTO lo_ref.
lv_text = lo_ref->get_text( ).
MESSAGE lv_text TYPE 'I'. " or 'E'.
ENDTRY.Regards,
Raymond
‎2012 Jan 09 2:36 PM
check your return code after each call, not just the first one. And put out a different message for each.
Rob
Edited by: Rob Burbank on Jan 9, 2012 9:37 AM