dimecres, 6 de desembre del 2006

Oracle SQLPlus: ruta relativa

Com fem per cridar arxius sql (a1.sql, a2.sql...) des de un altre arxiu sql (b1.sql) de manera relativa?

SQL>@ruta_b1.sql;

i dins de b1.sql posem això:

@@a1.sql;
@@a2.sql;

suposant que a1, a2 i b1 estiguin en el amteix directori.
@@ "correspon" a la ruta de l'arxiu sql executat primer.

no se si queda clar. Aquí deixo un fragment en anglès que explica la diferència entre @ i @@.

What is the difference between @ and @@?

The @ (at symbol) is equivalent to the START command and is used to run SQL*Plus command scripts.

A single @ symbol runs a script in the current directory (or one specified with a full or relative path, or one that is found in you SQLPATH or ORACLE_PATH).

@@ will start a sqlplus script that is in the same directory as the script that called it (relative to the directory of the current script). This is normally used for nested command files.




link: http://orafaq.com/faqplus.htm#AT

Radio + not?es