-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run script sentences atomically #376
Comments
I forgot that I'm working with an Oracle 11g database. |
By default it is used |
Thank you, @snuyanzin, but it seems tha doesn't works. Step 1: Create a test table an populate it with some values.create table MyTable(
id numeric(9,0) not null,
field varchar(200) not null,
constraint MyTable_PK primary key(id)
);
insert into MyTable(id, field) values (1, 'val1');
insert into MyTable(id, field) values (2, 'val2');
insert into MyTable(id, field) values (3, 'val3'); Step 2: In the next steps, I use the following command:
Step 3a: execute script and evaluate resultsWhen update MyTable set field = 'new1' where id = 1;
update MyTable set field = null where id = 2;
update MyTable set field = 'new3' where id = 3;
commit; then, this is the result:
and "field" is modified with "new1" value for "id=1" row! Step 3b: execute script and evaluate resultsWhen begin
update MyTable set field = 'new1' where id = 1;
update MyTable set field = null where id = 2;
update MyTable set field = 'new3' where id = 3;
commit;
exception
when others then
rollback;
end; this is the result:
|
I think that |
merged as 4a7f323 |
How can I run all sentences contained in a SQL script file atomically?
I have a file "myscript.sql" with several SQL sentences (insert, update, etc.) inside.
And I want that it will be executed atommically (all sentences inside a transaction).
I use the option:
--run=/path/to/file (run one script and then exit)
But, maybe it's needed to use any of the following options?:
--isolation=LEVEL (set the transaction isolation level)
--autoCommit=[true/false] (enable/disable automatic transaction commit)
The text was updated successfully, but these errors were encountered: