Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: SQL*Plus scripting

RE: SQL*Plus scripting

From: Rudy Zung <Rudy.Zung_at_efi.com>
Date: Wed, 8 Dec 2004 11:33:54 -0500
Message-ID: <87F7A09D4DAF4C46A1EC7BFBF85047F322E7D2@pghexmb02.efi.internal>

SQLPlus looks in 2 places for scripts to execute: 1) in your current working directory
2) in the SQLPath registry value
Relative pathnames are understood by SQLPlus, but they are relative to your current working directory.

So, for your dilemma: you can start DOS, cd to the directory that = contains
qaqa1.sql, then start the command line SQLPlus. Hereafter, SQLPlus will correctly understand the relative paths to @2\qaqa2.sql and = @2\3\qaqa3.sql;
it might also handle @@ relative paths correctly.

Alternatively, you can go change the shortcut to the GUI SQLPlusW to start in the directory where qaqa1.sql is located; otherwise, SQLPlusW starts in <ORACLE>/bin.

One final method is to go into your registry and change the value for HKLM\Software\Oracle\<HOME#>\SQLPATH to contain the absolute pathnames of all the directories in which you want your SQLPlusW to search for scripts to run. However, you should note that relative pathnames are still rooted at your current working directory. This means in your case, you will need your SQLPATH to look like:

   c:\script;c:\script\2;c:\script\2\3
Since you have all your directories set in the SQLPlus, in your script you can use just @qaqa1.sql, @qaqa2.sql, and @qaqa3.sql and rely on SQLPlus to find those scripts in your SQLPath.

...Rudy

-----Original Message-----
From: oracle-l-bounce_at_freelists.org =
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Gints Plivna
Sent: Wednesday, December 08, 2004 11:02 AM To: oracle-l_at_freelists.org
Subject: SQL*Plus scripting

So I'm stuck with the subj.
Oracle 9.2.0.5 on Linux, client (my box) MS Windoze XP

I have following directory structure and sql scripts just for example:

qaqa1.sql          level 1
2\qaqa2.sql        level 2
2\anotherqaqa2.sql level 2
2\3\qaqa3.sql      level 3

So I'd like to call from the root script qaqa1.sql one level below i.e. =
=3D

qaqa2.sql, and from qaqa2.sql one more below i.e. qaqa3.sql. But somehow =
=3D

I cannot force to do that, level 2 script cannot see level 3 script. I'v =
=3D

read docs, used @, @@ all possible combinations I could think of but no =
=3D

success.
Although I can force if I write in qaqa2.sql following @1\2\qaqa3.sql like it would be called directly from level 1 script. But =
=3D

this solution isn't an option because I need run root script that =3D contains many sublevels as well as sublevels separately.

Any solution?

TIA Output from SQL PLUS

19:36:15 gints_at_CMISMGR2> @qaqa
19:36:15 gints_at_CMISMGR2> @@2/qaqa2.sql
19:36:15 gints_at_CMISMGR2> PROMPT IN qaqa2.sql
IN qaqa2.sql
19:36:15 gints_at_CMISMGR2> @3/qaqa3.sql
SP2-0310: unable to open file "3/qaqa3.sql" 19:36:15 gints_at_CMISMGR2> @@3/qaqa3.sql
SP2-0310: unable to open file "3/qaqa3.sql" 19:36:15 gints_at_CMISMGR2> @2/3/qaqa3.sql
19:36:15 gints_at_CMISMGR2> PROMPT IN qaqa3 IN qaqa3
19:36:15 gints_at_CMISMGR2> @@2/3/qaqa3.sql 19:36:15 gints_at_CMISMGR2> PROMPT IN qaqa3 IN qaqa3
19:36:15 gints_at_CMISMGR2> @anotherqaqa2.sql SP2-0310: unable to open file "anotherqaqa2.sql" 19:36:15 gints_at_CMISMGR2> @@anotherqaqa2.sql 19:36:15 gints_at_CMISMGR2> PROMPT anotherqaqa2 anotherqaqa2

Gints Plivna
A/S =3D84SOFTEX LATVIA=3D94
Kr.Barona iela 13/15, R=3DEEga, LV-1011
tel: +371 7365111; fakss: +371 7365109
e-mail: g.plivna_at_softex.lv
WWW: http://www.softex.lv

--
http://www.freelists.org/webpage/oracle-l
--
http://www.freelists.org/webpage/oracle-l
Received on Wed Dec 08 2004 - 10:36:59 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US