Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle sqlplus: relative paths starting at position of script

When I have two sql-files, one of them in a sub-directory

main_test.sql
sub/sub_test.sql

and sub_test.sqlcalls @../main_test.sql (or @@../main_test.sql) then this works fine when executing it from the sub-directory

sub> sqlplus xxx @ sub_test.sql

But when I call

sub> cd ..
> sqlplus xxx @ sub/sub_test.sql

this results in

SP2-0310: unable to open file "../main_test.sql"

since the path is evaluated from my working directory, not the directory of the sql-file I call.

Is there a way to use relative paths starting from the directory of file containing the call?

like image 863
Peter Lang Avatar asked Dec 15 '09 10:12

Peter Lang


1 Answers

Shame the 'file' url isn't supported - since this actually works very well when using 'http://' paths !

I set up 'sub_test\sub_test.sql' to contain the double-ats:

@@../main.sql

put the whole directory structure under a Tomcat webapps/ROOT context and it works if you call like this:

SQL> @http://host:port/sub_test/sub_test.sql

Probably a bit of overkill setting up a web-server I guess ?? (Also works with FTP apparently - not tried it).

like image 78
monojohnny Avatar answered Oct 05 '22 18:10

monojohnny