I have updated some tables and before commit if I will give one DDL command means what will happen?
For example
CREATE TABLE test(fldname number(10));
insert into test (fldname) values (10);
insert into test (fldname) values (20);
After that without giving Commit statement, I issued one DDL command
CREATE TABLE test1( sno number(10))
What aobut the previous inserts? Is it committed or not? explain.
Answer:
I checked this and found the following 3 points.
Point No. 1:
If we give a DDL command with syntax error means it will not commit and gives the error. For example the following statement
CREATE TABLE test(fldname number(10), );
note that the comma, gives "invalid identifier.. " error and without committing the INSERT statements.
Point No. 2:
If the given DDL command executes without any error means it will auto commit the INSERT statements.
Point No. 3:
If we give a DDL command without any syntax error and that statement not execute also auto commit the INSERT statements and gives the exception of thee DDL statement. For example the following statement
CREATE TABLE test(fldname number(10) );
gives "name is already used by an existing object" exception after auto commiting the insert statements.
For example
CREATE TABLE test(fldname number(10));
insert into test (fldname) values (10);
insert into test (fldname) values (20);
After that without giving Commit statement, I issued one DDL command
CREATE TABLE test1( sno number(10))
What aobut the previous inserts? Is it committed or not? explain.
Answer:
I checked this and found the following 3 points.
Point No. 1:
If we give a DDL command with syntax error means it will not commit and gives the error. For example the following statement
CREATE TABLE test(fldname number(10), );
note that the comma, gives "invalid identifier.. " error and without committing the INSERT statements.
Point No. 2:
If the given DDL command executes without any error means it will auto commit the INSERT statements.
Point No. 3:
If we give a DDL command without any syntax error and that statement not execute also auto commit the INSERT statements and gives the exception of thee DDL statement. For example the following statement
CREATE TABLE test(fldname number(10) );
gives "name is already used by an existing object" exception after auto commiting the insert statements.
Comments