Home » Other » Client Tools » @@ confusion (SQL*Plus: Release 10.2.0.3.0, winXP)
@@ confusion [message #500912] Thu, 24 March 2011 08:28 Go to next message
xerces8
Messages: 3
Registered: March 2011
Junior Member
Hi!

I have a script test\a.sql with the line:

@@ extra/foo.sql

The files are:
test\a.sql
test\extra\foo.sql

If I am in the map "test", I can run the script by:
sqlplus _login_data_ @ a.sql

and it works. It also works if I use single @ in the script.

But if I am a directory higher, I get this:

sqlplus _login_data_ @ test\a.sql

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



Isn't the difference between @ and @@ that the later should work in cases like this? That it looks for the referenced script relative to the position of the first script?
Re: @@ confusion [message #500914 is a reply to message #500912] Thu, 24 March 2011 08:34 Go to previous messageGo to next message
LKBrwn_DBA
Messages: 487
Registered: July 2003
Location: WPB, FL
Senior Member
According to the fine SQL*PlusĀ® User's Guide and Reference, this is how it works:
Quote:
@@ file_name[.ext] [arg...]

Runs a script. This command is almost identical to the @ (at sign) command. When running nested scripts it looks for nested scripts in the same path or url as the calling script. The @@ command functions similarly to @ and START.


[Updated on: Thu, 24 March 2011 08:45] by Moderator

Report message to a moderator

Re: @@ confusion [message #500928 is a reply to message #500914] Thu, 24 March 2011 09:48 Go to previous messageGo to next message
xerces8
Messages: 3
Registered: March 2011
Junior Member
Yes, by reading this and the example on that page, I understand that it should work as I expect it in the first post, but it does not.
It looks in the current directory instead, it seems.


In other words, how can I can I call other scripts in my script, without hardcoding the absolute path to them? Put them all in same directory?
Re: @@ confusion [message #500929 is a reply to message #500928] Thu, 24 March 2011 09:53 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
in some cases for some client SQL_PATH environmental variable may be used to locate SQL files.
Re: @@ confusion [message #500945 is a reply to message #500929] Thu, 24 March 2011 10:56 Go to previous message
Michel Cadot
Messages: 68728
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
SQLPATH without '_'.

Regards
Michel
Previous Topic: Issue with PL/SQL Developer Version 8.0.4.1514
Next Topic: wait tab in toad
Goto Forum:
  


Current Time: Sun Dec 22 05:08:39 CST 2024