You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-dev@db.apache.org by Chris Hyzer <mc...@yahoo.com> on 2008/07/30 22:27:11 UTC

commit after dml?

Hey,
When the script copies data to another table, and back, should it not commit after each step?  The reason is if the transaction fails or is rolled back after the table ddl has occurred, there will be data loss, right?
Thanks,
Chris
e.g.
##################   FROM:   ######################
CREATE TABLE GROUPER_ATTRIBUTES_
(
    ID VARCHAR2(128) NOT NULL,
    GROUP_ID VARCHAR2(128) NOT NULL,
    FIELD_NAME VARCHAR2(32) NOT NULL,
    VALUE VARCHAR2(1024) NOT NULL,
    hibernate_version_number NUMBER(38) DEFAULT 0,
    PRIMARY KEY (ID)
);
INSERT INTO GROUPER_ATTRIBUTES_ (ID,GROUP_ID,FIELD_NAME,VALUE,hibernate_version_number) SELECT ID,GROUP_ID,FIELD_NAME,VALUE,hibernate_version_number FROM GROUPER_ATTRIBUTES;
DROP TABLE GROUPER_ATTRIBUTES CASCADE CONSTRAINTS;

##################  TO:  ###########################
CREATE TABLE GROUPER_ATTRIBUTES_
(
    ID VARCHAR2(128) NOT NULL,
    GROUP_ID VARCHAR2(128) NOT NULL,
    FIELD_NAME VARCHAR2(32) NOT NULL,
    VALUE VARCHAR2(1024) NOT NULL,
    hibernate_version_number NUMBER(38) DEFAULT 0,
    PRIMARY KEY (ID)
);
INSERT INTO GROUPER_ATTRIBUTES_ (ID,GROUP_ID,FIELD_NAME,VALUE,hibernate_version_number) SELECT ID,GROUP_ID,FIELD_NAME,VALUE,hibernate_version_number FROM GROUPER_ATTRIBUTES;
COMMIT;
DROP TABLE GROUPER_ATTRIBUTES CASCADE CONSTRAINTS;



      

Re: commit after dml?

Posted by Thomas Dudziak <to...@gmail.com>.
On Wed, Jul 30, 2008 at 1:27 PM, Chris Hyzer <mc...@yahoo.com> wrote:
> Hey,
> When the script copies data to another table, and back, should it not commit after each step?  The reason is if the transaction fails or is rolled back after the table ddl has occurred, there will be data loss, right?

Databases usually don't support transactional DDL, which means that a
DDL statement will commit all currently open transactions for that
session.
In any case, DdlUtils currently assumes the connection to be
auto-commit (i.e. it does no explicit transaction) - this is
configurable via the data source. But feel to file an enhancement JIRA
to make DdlUtils insert COMMIT SQL into the generated SQL.

Tom