popup [message #298742] |
Thu, 07 February 2008 07:29 |
oracle_coorgi
Messages: 188 Registered: September 2006 Location: INDIA-karnataka
|
Senior Member |
|
|
hi
is it right place to post the topic ...? ok...
after running the script in command prompt(windows),is it possible to get a popup message
saying YES to commit and NO to rollback
thanxs
|
|
|
|
|
Re: popup [message #298843 is a reply to message #298838] |
Fri, 08 February 2008 00:19 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Here's one way to do that: once you start SQL*Plus session, you have to finish the job (i.e. rollback when you're still in SQL*Plus); otherwise, Oracle will COMMIT by default upon terminating the session.
This is the script: at the beginning, I'm inserting a record into the 'DEPT' table (Scott's schema); you'd put your statements here.
Now we'll have to decide whether to COMMIT or ROLLBACK. To do that, spool the answer into a file and run it.
-- FAQ.SQL
insert into dept values (0, 'Little', 'Foot');
prompt <C> to 'commit', <R> to 'rollback'
prompt
accept odg prompt 'What will you do? ';
set termout off;
set verify off;
set heading off;
set pause off;
set echo off;
column action newline;
spool todo.sql
select decode (upper('&&odg'), 'C', 'commit;', 'rollback;') action
from dual;
spool off;
set termout on;
@todo
undefine odg;
And here is the SQL*Plus session, just to illustrate how it looks like:SQL> select * From dept;
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
SQL> @faq
1 row created.
<C> to 'commit', <R> to 'rollback'
What will you do? r
Rollback complete.
SQL> select * From dept;
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
SQL> @faq
1 row created.
<C> to 'commit', <R> to 'rollback'
What will you do? c
Commit complete.
SQL> select * From dept;
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
0 Little Foot
SQL>
As of the right place to put your question to ... well, it definitely isn't "Server Administration" forum. There are plenty of them you could put it in (from Newbies via SQL Tools to Homework or even Windows).
I'll move it to SQL Tools one (as it deals with "how to" in SQL*Plus).
|
|
|
|
Re: popup [message #298866 is a reply to message #298860] |
Fri, 08 February 2008 01:21 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Pop-up? I don't know. What's the difference?
However, if you find that out, do share it with the rest of us.
|
|
|