Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Commit question in SQL*PLUS
On Thu, 15 Aug 2002 23:02:51 GMT, Daniel Morgan
<dmorgan_at_exesolutions.com> wrote:
>abc_at_iom.com wrote:
>
>> New to Oracle, here.
>>
>> If I enter a batch of commands in SQL*PLUS, I want to have them all
>> execute if the script is ok, or NONE executed if there's an error.
>> Right now it looks like only the non-error lines of the script get
>> executed. I'm looking for All-or-none.
>>
>> Thanks.
>
>I tried looking over your shoulder but I just couldn't see well enough
>to be sure what you are doing.
>
>Post the script so that we have some idea what you are refering to.
>
>Daniel Morgan
>
That's Ok, Dan, I haven't showered in a week since I started learning
this stuff. You wouln't WANT be looking over my shoulder at this
present moment <g>
Well it's not so important to understand the commands I was typing. It's more the situation that happened to me and how to prevent it.
In SQLPlus, here's the gist of what I did:
ALTER TABLE FOO ADD (NEWCOLUMN VARCHAR(10));
UPDATE FOO SET NEWCOLUMN= OLDCOLUMN;
ALTER TABLE FOO DROP (OLDCOLUMN);
Now, If statement #2 fails because of some dumb typo (which it did),
I've just lost my data (which I did).
In MSSQL, when you type a series of statements as a batch and run it, if there is a compile error/syntax error in one of the statements, the whole batch fails and doesn't execute. How can I get SQL*Plus to behave that way?
Thanks. Received on Thu Aug 15 2002 - 22:31:45 CDT