I have a small vbscript to load data and process it using sqlldr and sqlplus. I have 2 questions about sqlplus usage though:

1) Can I exec a stored procedure without using an .sql script file? e.g. sqlplus user/pass@server @exec proc_myname

2) Can I use .sql script files on a shared UNC path? e.g. sqlplus user/pass@server @\server\path\script.sql

I've tried playing around and at the moment am working around the problem by using a local temp directory to store the sql files. But I'm curious if there's another/better way.

Thanks

有帮助吗?

解决方案

Can I exec a stored procedure without using an .sql script file?

Yes. I don't know VisualBasic good enough but the basic principle is that you create the child process for sqlplus and then send the commands via stdin (i.e. you have your script write to standard input of the child process).

Can I use .sql script files on a shared UNC path?

If the path is correct, then that should work. You can also try I/O redirection:

sqlplus user/pass@server < \\server\path\script.sql

The drawback of this approach is that the error messages won't include the .sql script name.

其他提示

Re your second question:

Running a script from a UNC path works for me without drive mapping or I/O redirection:

sqlplus /nolog "@\\server\path\file.sql"

sqlplus version 12.2.0.1
The quotes and '@' are important, apparently.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top