Re: SQL*PLus script for running external scripts

From: gazzag <gareth_at_jamms.org>
Date: Mon, 9 Feb 2009 07:44:00 -0800 (PST)
Message-ID: <7a90abc8-0533-4674-9dd3-eacdf8d3205f_at_p37g2000yqd.googlegroups.com>



On 9 Feb, 15:34, "�lvaro G. Vicario"
<alvaro.NOSPAMTH..._at_demogracia.com> wrote:
> ddf escribi�:
>
>
>
>
>
> > The _at_@ syntax says 'run this script from the same location as the
> > source script', so if you do, indeed, locate all of these in one
> > directory the _at_@ syntax will be what you need. �As an example:
>
> > The directory contents --
>
> > c:\sql\orcl\examples\tst>dir
> > �Volume in drive C has no label.
> > �Volume Serial Number is A08D-1EEA
>
> > �Directory of c:\sql\orcl\examples\tst
>
> > 02/09/2009 �07:55 AM � �<DIR> � � � � �.
> > 02/09/2009 �07:55 AM � �<DIR> � � � � �..
> > 02/09/2009 �07:55 AM � � � � � � � �76 master.sql
> > 02/09/2009 �07:51 AM � � � � � � � 138 script01.sql
> > 02/09/2009 �07:54 AM � � � � � � � 239 script02.sql
> > � � � � � � � �3 File(s) � � � � � �453 bytes
> > � � � � � � � �2 Dir(s) �21,441,359,872 bytes free
>
> > c:\sql\orcl\examples\tst>
>
> > The master.sql script --
>
> > set echo on
> > spool master.log
> > _at__at_script01.sql
> > _at__at_script02.sql
> > spool off
>
> > Executing master.sql --
>
> > SQL> _at__at_script01.sql
> > SQL> create table yakima(
> > � 2 � � � � �snerg � number,
> > � 3 � � � � �florpal varchar2(40)
> > � 4 �);
>
> > Table created.
>
> > SQL>
> > SQL>
> > SQL> alter table yakima
> > � 2 �add constraint yakima_pk
> > � 3 �primary key(snerg);
>
> > Table altered.
>
> > SQL>
> > SQL> _at__at_script02.sql
> > SQL> create table terpal(
> > � 2 � � � � �sming varchar2(80),
> > � 3 � � � � �yertz � number,
> > � 4 � � � � �oplama �number
> > � 5 �);
>
> > Table created.
>
> > SQL>
> > SQL> alter table terpal
> > � 2 �add constraint terpal_pk
> > � 3 �primary key(sming);
>
> > Table altered.
>
> > SQL>
> > SQL> alter table terpal
> > � 2 �add constraint terpal_fk
> > � 3 �foreign key(yertz)
> > � 4 �references yakima;
>
> > Table altered.
>
> > SQL>
>
> I've copied your example line by line (it works fine) and started
> modifying it. The issue happened to be blank lines. It's okay if I have:
>
> create table yakima(
> � � � � snerg � number,
> � � � � florpal varchar2(40)
> );
>
> But it won't work with:
>
> create table yakima(
> � � � � snerg � number,
>
> � � � � florpal varchar2(40)
> );
>
> SQL> create table yakima(
> � �2 � � � � �snerg � number,
> � �3
> SQL> � � � � florpal varchar2(40)
> SP2-0734: inicio "florpal va..." de comando desconocido - resto de la
> l�nea ignorado.
> SQL> );
> SP2-0042: comando desconocido ")" - resto de la l�nea ignorado.
>
> Can't you have blank lines in script files?
>
> --
> --http://alvaro.es- �lvaro G. Vicario - Burgos, Spain
> -- Mi sitio sobre programaci�n web:http://bits.demogracia.com
> -- Mi web de humor al ba�o Mar�a:http://www.demogracia.com

SQL*Plus isn't great on blank lines, to be honest. I tend to use "--" (comment) if I want to space out a script.

HTH -g Received on Mon Feb 09 2009 - 09:44:00 CST

Original text of this message