Re: capturing host variables
Date: 9 Oct 2001 04:12:17 -0700
Message-ID: <1e562f83.0110090312.6c71c348_at_posting.google.com>
traceable1_at_hotmail.com (traceable1) wrote in message news:<8551d8c9.0110080520.6926925a_at_posting.google.com>...
> I need to get the current OS directory from within SQL*Plus. I have a
> SQL*Plus script which calls several other SQL*Plus scripts. This
> script needs to be able to run from anywhere, but all of the scripts
> will be in the same directory (I just don't which one). So the user
> will run the main SQL*Plus script and I want wo preface the calls with
> the directory by way of a variable.
>
> Main script: call_ora.sql
> _at_{directory path}ora1.sql
> _at_{directory path}ora2.sql
>
> In windows, I know "CHDIR" will give me the current directory, but I
> don't know how to get it or use it in Oracle.
>
> Any help is very much appreciated!
> Thanks,
> Tracy
Hi,
Given the condition that the other scripts would be in the same
directory as the parent script, you could use the _at_@ command. The @@
command looks for the sepcified command file in the same path as the
command file from which it was called.
E.g. Main script: call_ora.sql
_at__at_ora1.sql
_at__at_ora2.sql
If this doesn't suit your rquirement, there is command called HOST that allows execution of the OS command. But I'm not sure of how you could get the return value from the command into the SQL PLUS session.
Hope this helps.
Regards,
Ram.
Received on Tue Oct 09 2001 - 13:12:17 CEST
