Home » SQL & PL/SQL » SQL & PL/SQL » DML written on a script autocommits after a DDL in the same script without any commit statements? (oracle,10g,xp)
DML written on a script autocommits after a DDL in the same script without any commit statements? [message #605058] Tue, 07 January 2014 04:11 Go to next message
evivek
Messages: 6
Registered: December 2013
Location: mumbai
Junior Member

Hi i have written a script
------------------------------
create table test1(id number);
create table test2(id number);
-------------------------------

then written a script
-------------------------------
insert into test1 values(1);

alter table test2 add val varchar2(20);

insert into test1 values(2);

---------------------------------------

i had open two session of sqlplus
in the first one i run th eabove scrpt
and without commit

when i check in the scond session test1 table have the entry 1 but not 2

why running any ddl auto commit the dml statement excuted previously in that session ????????





Re: DML written on a script autocommits after a DDL in the same script without any commit statements? [message #605059 is a reply to message #605058] Tue, 07 January 2014 04:15 Go to previous messageGo to next message
dariyoosh
Messages: 538
Registered: March 2009
Location: France
Senior Member
Alter table is DDL and does auto commit. This is how it works in oracle.

[Updated on: Tue, 07 January 2014 04:16]

Report message to a moderator

Re: DML written on a script autocommits after a DDL in the same script without any commit statements? [message #605065 is a reply to message #605058] Tue, 07 January 2014 04:28 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

All DDL internally starts with a commit statement.

Regards
Michel
Re: DML written on a script autocommits after a DDL in the same script without any commit statements? [message #605085 is a reply to message #605065] Tue, 07 January 2014 05:07 Go to previous message
evivek
Messages: 6
Registered: December 2013
Location: mumbai
Junior Member

thanks dariyoosh and michel
Previous Topic: Dynamic Column List in Select query
Next Topic: duplicate column
Goto Forum:
  


Current Time: Wed Apr 24 20:56:18 CDT 2024