Results 1 to 2 of 2

Thread: Commit

  1. #1
    Join Date
    May 2012
    Posts
    155

    Unanswered: Commit

    Hallo everyone,

    I am dealing with the commit-time:

    DECLARE GLOBAL TEMPORARY TABLE tablename (
    MYDATEID date not null
    ) ON COMMIT PRESERVE ROWS;

    As stated in the documentation, ON COMMIT PRESERVE ROWS means that the rows will be preserved when a COMMIT operation is performed.

    My question:
    So, if there is not explizitely COMMIT statement in my .sql-code, my table will still be exist? Or does it have something to do with "internal"-Commit, if any sql-operation is done? Like, if there is a SELECT statement in my sql-File, and after the operation of this SELECT statement, the Commit operation will be performed(implicitely).

    Thank you for the help.

    Regards,
    Ratna

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    DB2 does not have an "implicit-commit". The COMMIT must be explicitly sent to the database. This can be done by either having "Auto-Commit" turned on, or explicitly executing the COMMIT statement. How Auto-Commit is used depends on the client software being used.


    What the ON COMMIT PRESERVE ROWS clause does for you, is that if a COMMIT is executed, then the contents of the temporary table will not be deleted. But anything you do to the temporary table prior to a commit will be preserved.

    Andy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •