Home » Infrastructure » Windows » Batch file v/s SQL developer (11g)
Batch file v/s SQL developer [message #564356] Thu, 23 August 2012 01:50 Go to next message
vibo
Messages: 21
Registered: August 2012
Junior Member
Hi,

I have a particular sql code which works perfectly fine on sql developer. But if I run the same sql code through a batch file it does not get executed. It does not throw an error too. Could you please help.

SQL code - clean_tables.sql
   begin
    execute immediate 'drop table external_tables';
    execute immediate 'drop table security';
    exception
    when others then
    null;
  end;


Batch file - Clean.bat
set ORACLE_SID=orcl
set ORACLE_HOME=C:\oracle\product\11.2.0\dbhome_1
set PATH=C:\oracle\product\11.2.0\dbhome_1\BIN

sqlplus security/password@orcl <c:\Report\clean_tables.sql

pause



Please help
VIBO
Re: Batch file v/s SQL developer [message #564359 is a reply to message #564356] Thu, 23 August 2012 02:24 Go to previous messageGo to next message
flyboy
Messages: 1751
Registered: November 2006
Senior Member
Hi,
run the PL/SQL block in sqlplus and you will immediately see the reason. There is no excuse for not doing it - you are already invoke it from the script.

And yes, Michel already told you it:
Quote:
A PL/SQL block ends with a "/" to be executed.

I do not see any "/" in CLEAN_TABLES.SQL content.
By the way,
Quote:
There is no error (as you ignore them)

what if EXTERNAL table does not exist and SECURITY table does? Maybe you will benefit from reading this article: http://www.orafaq.com/wiki/WHEN_OTHERS
(just surprised Michel did not reference it)
Re: Batch file v/s SQL developer [message #564360 is a reply to message #564359] Thu, 23 August 2012 02:31 Go to previous message
vibo
Messages: 21
Registered: August 2012
Junior Member
@flyboy - Thank you.

Previous Topic: Oracle 11g Installation process window 2008 Server R2 64 Bit.
Next Topic: PL/SQL with Batch file
Goto Forum:
  


Current Time: Thu Apr 24 20:38:43 CDT 2014

Total time taken to generate the page: 0.06538 seconds