Re: Use environment variable in SQLPlus on Windows
Date: 2 Feb 2007 05:38:47 -0800
Message-ID: <1170423527.106278.324640_at_s48g2000cws.googlegroups.com>
On 25 ene, 21:04, "Gerard H. Pille" <g..._at_skynet.be> wrote:
> Matthias Langbein wrote:
> > Hi all,
> > is there a way to use a environment variable in SQL PLus? On Linux I
> > can use the $, but on Windows this doesn't work.
>
> > Example:
>
> > C:\> SET SQLOUT=C:\LOG\
> > C:\> SQLPLUS scott/tiger
>
> > SQL> SPOOL ${SQLOUT}TEST.LOG
> > SQL> PROMPT A
> > A
> > SQL> SPOOL OFF
> > SQL> EXIT
>
> > This saves me the Log file in the current directory with the file name
> > ${SQLOUT}TEST.LOG, but I want the log file with the name TEST.LOG
> > stored in the directore C:\LOG
>
> > Any help??
>
> > THX, Langi
>
> The normal syntax on Whinedoze is %SQLOUT%, but I didn't say this will work from within SQL*Plus.
>
> Stick to Linux.
>
> Gerard
Actually it does work:
D:\>SET DUMMY=D:\BASURA\ D:\>SQLPLUS xxxxxxx_at_yyyyyy.zzzzzz
SQL*Plus: Release 9.2.0.8.0 - Production on Vie Feb 2 14:33:31 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Introduzca la contraseña:
Conectado a:
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> spool %DUMMY%prueba.txt
SQL> select sysdate from dual;
SYSDATE
02/02/07
SQL> spool off;
SQL> quit
Desconectado de Oracle Database 10g Enterprise Edition Release
10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
D:\>cd basura
D:\basura>dir
El volumen de la unidad D es DATOS
El número de serie del volumen es: 7C84-6B91
Directorio de D:\basura
02/02/2007 14:32 <DIR> . 02/02/2007 14:32 <DIR> .. 02/02/2007 14:33 299 prueba.txt
D:\basura>
HTH. Cheers.
Carlos. Received on Fri Feb 02 2007 - 14:38:47 CET
