Home » Infrastructure » Windows » Script File execution (Oracle, 10g, Windows)
Script File execution [message #350901] Sat, 27 September 2008 02:00 Go to next message
Diamond.Jegan
Messages: 3
Registered: September 2008
Location: India
Junior Member

I want to run a sql script file apart from Oracle. For example,
I'm running that script file from VB-Ado by the following code snipet

AdoConnectionObject.Execute "@" & scriptFileName

Above mentioned statement gives error while running as 'Invalid SQL Statements'.

Please help me for this problem.



By,
Diamond
Re: Script File execution [message #350903 is a reply to message #350901] Sat, 27 September 2008 04:10 Go to previous messageGo to next message
msmallya
Messages: 66
Registered: March 2008
Location: AHMEDABAD, GUJARAT
Member
Hi,

I think you cannot call sqlscriptfile (as .Execute @sqlfilenm), but from sqlprompt it is (@sqlfilenm). From VB it is like this :

strsql="select a,b,c from xyz"
adodbconn.execute(strsql)

Thanx and Regards,

MSMallya
Re: Script File execution [message #350921 is a reply to message #350901] Sat, 27 September 2008 12:00 Go to previous messageGo to next message
Michel Cadot
Messages: 57612
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
@ (or start or @@) is a SQL*Plus command not a SQL one.
You cannot execute a script in VB, you have to read and execute each statement of the script.

Regards
Michel
Re: Script File execution [message #351009 is a reply to message #350903] Sun, 28 September 2008 23:33 Go to previous messageGo to next message
Diamond.Jegan
Messages: 3
Registered: September 2008
Location: India
Junior Member

I have a Create View script in that script file. I want to execute implicitly i.e. without using SQLPlus Window. Fox example using DOS batch file. Is this possible?
Re: Script File execution [message #351032 is a reply to message #351009] Mon, 29 September 2008 01:16 Go to previous messageGo to next message
Michel Cadot
Messages: 57612
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I don't understand the question nor the relation with the previous one.
VB/ADO can execute a "create view" statement.

Regards
Michel
Re: Script File execution [message #351844 is a reply to message #351032] Fri, 03 October 2008 07:46 Go to previous messageGo to next message
Diamond.Jegan
Messages: 3
Registered: September 2008
Location: India
Junior Member

I have the following SQL code

Create View vu_TestView
as
--EMP MASTER
Select EmpCode,EmpName,SAL from TBLEMPMASTER

UNION

--EMPLOYEE TRANS
SELECT EMPCODE,'',SALARY FROM TBLEMPLOY_TRANS;


Consider this is a simple view. I've saved this file as TestScript.sql. What i want is I want to execute this script file externally. I've one suggesstion that is

"sqlplus user/password@schema @c:\TestScript.sql"

The above should be done in DOS mode by using cmd. But I got error at the time of execution. So I need to execute the script file execution such that way (DOS) without accessing Oracle IDE.



Re: Script File execution [message #351858 is a reply to message #351844] Fri, 03 October 2008 08:38 Go to previous messageGo to next message
Michel Cadot
Messages: 57612
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
So read the file and execute the statements that are in.
Just like SQL*Plus does it.

Regards
Michel
Re: Script File execution [message #352918 is a reply to message #351858] Fri, 10 October 2008 04:29 Go to previous messageGo to next message
Vairam_Jegan
Messages: 1
Registered: July 2005
Location: Chennai
Junior Member
I tried the script file execution in vb using FSO (File System Object). At that time also I got the same error. So I decided to run that script file apart from vb-ado and oracle. What I’m asking is like batch file (*.bat) execution. Do you have any idea about this script file execution through batch file?

[Updated on: Fri, 10 October 2008 04:59] by Moderator

Report message to a moderator

Re: Script File execution [message #353002 is a reply to message #352918] Fri, 10 October 2008 08:33 Go to previous message
msmallya
Messages: 66
Registered: March 2008
Location: AHMEDABAD, GUJARAT
Member
Hi,

I think you have not put "exit;" in your script. Also you have not posted error you have encountered.

say batch file test.bat will look like

sqlplus user/pwd@db @c:\testsc.sql

and sql script will look like

set termout off;
select col1 from abc;
exit;

I have given you only simple example how to call/execute script file from DOS command prompt.

Thanks and regards,

MSMallya
Previous Topic: OLE DB drivers for IA64
Next Topic: How to configure Oracle 10g for XP sample schemas
Goto Forum:
  


Current Time: Sun Apr 20 00:44:05 CDT 2014

Total time taken to generate the page: 0.08017 seconds