(Found this old thread after considerable searching. I couldn't figure out how to make the forum search for the string "@@" so apologies if I missed a more recent discussion on this.)
The Oracle SQL*Plus documentation on "@" vs "@@" seems pretty clear that they are different and that "@@" should search relative to the directory of the currently running script, but PL/SQL Developer doesn't appear to work that way.
Marco, I've seen you document the precedence of directories searched a couple times. I'm unclear about whether that's for "@" or "@@" or both. You've said the order is:
1. The default directory of PL/SQL Developer.
2. The directory of the calling script (if any).
3. The Command file directory specified in the preferences.
4. The directories specified in the SQLPATH Oracle registry key.
5. The directories specified in the ORACLE_PATH Oracle registry key.
If that's true of "@@" then as long as the script doesn't exist in the default directory (#1) then #2 should effectively cause "relative to the currently running script" to work which, I think, is compatible with SQL*Plus.
Does the searching consider relative folder paths if they are included in the script name?
I'm trying to construct a folder structure of scripts like:
main.sql
script1.sql
script2.sql
subdirectory/main.sql
subdirectory/script1.sql
subdirectory/script2.sql
...where a subdirectory can be a self-contained unit with its' own "main.sql" which can call other scripts in the same directory without qualifying them with any directory names.
So the starting, top-level "main.sql" script could be:
@@'script1.sql'
@@"subdirectory/main.sql"
@@'script2.sql'
And the script at "subdirectory/main.sql" could be:
@@'script1.sql'
@@'script2.sql'
Beginning execution at the top-level main.sql, it should execute the top-level "script1.sql" then dive into the subdirectory to execute the other "main.sql" which would call its' own "script1.sql" and "script2.sql".
After execution comes back out of the "subdirectory/script.sql" and returns to the top-level "script.sql", the final unqualified reference to "script2.sql" should execute the one in the original top-level directory.
Is this possible, should I use "@" or "@@" and is it compatible with the way SQL*Plus works?