Run scripts by relative path in Oracle SQL Developer

Firstly, this question relates to Oracle SQL Developer 3.2 , not SQL * Plus or iSQL, etc. I did a bunch of searches, but did not find a direct answer.

I have several collections of scripts that I am trying to automate (and by the way, my SQL experience is pretty simple and mostly MS based). I am having a problem with a relative path. for example, suppose this setting:

scripts/A/runAll.sql
       | /A1.sql
       | /A2.sql
       |
       /B/runAll.sql
         /B1.sql
         /B2.sql

I would like to have a file scripts/runEverything.sqlsomething like this:

@@/A/runAll.sql
@@/B/runAll.sql

Scripts / A / runAll.sql:

@@/A1.sql
@@/A2.sql

where "@@", I'm going to, means relative path in SQL * Plus.

, . - '&1' . ..: /runEverything.sql:

@'&1/A/runAll.sql' '&1/A'
@'&1/B/runAll.sql' '&1/B'

, :

@'c:/.../scripts/runEverything.sql' 'c:/.../scripts'

, B/runAll.sql : c:/.../scripts/A/B.

, SQL Developer ?

+4
4

:

- SQL Developer .

- script, . runAll.sql( ) runAll.sql script .

  • . SQL :

    >

    " " > " " > " ".

    :

    "$ {file.dir}"

  • script :

    runAll.sql

    A1.sql

    A2.sql

    runAll.sql :

    @A1.sql;

    @A2.sql;

, SQL Developer "" script\runAll.sql.

( ) .

runAll.sql "script".

+7

SQL Developer , , , , , , (.. &1) start @. , @runAll script &1, , /A.

, script:

define path=&1
@'&path/A/runAll.sql' '&path/A'
@'&path/B/runAll.sql' '&path/B'

runAll.sql , , () path, , , .

, , ...

+1

. SQL, , .sql.

, file_name.sql

Ex: "A", A "A.sql"

0
source

you need to specify the file path as String, give the patch in double quote, it will work

**

For example, @ "C: \ Users \ Arpan Saini \ Zions R2 \ Reports and report notes \ Patch \ 08312017_Patch_16.2.3.17 \ DB Scripts \ snsp.sql";

**

0
source

Source: https://habr.com/ru/post/1542972/


All Articles