‎2007 Oct 26 9:15 PM
Folks, I have a SAP Table that I want to delete all the data from but still want to keep the table definition.. I dont want to fetch the records and then delete as this is a huge table so want to use a truncate command. The issue is that program has no syntax errors but it would not delete the data at all. Here is the code I have used and I am on a DB2 system, can someone help what I am doing wrong?
DATA: exc_ref TYPE REF TO cx_sy_native_sql_error,
error_text TYPE string.
TRY.
EXEC SQL.
TRUNCATE TABLE S194
ENDEXEC.
CATCH cx_sy_native_sql_error INTO exc_ref.
error_text = exc_ref->get_text( ).
ENDTRY.
IF SY-SUBRC = 0.
commit work.
ELSE.
write : / error_text .
ENDIF.
Message was edited by:
Ram Gowda
‎2007 Oct 26 9:25 PM
‎2007 Oct 26 9:40 PM
You may want to Google TRUNCATE DB2. I'm not sure if you can do this, but there appear to be other options.
Rob