Valeu Chiappa , deu certo seu exemplo !!

Esta lista tem me ajudando em muitas coisas !! Valeu pessoal !!!

Sabedoria e alegria a todos

Tadeu Paz

----- Original Message ----- 
From: jlchiappa
To: oracle_br@yahoogrupos.com.br
Sent: Thursday, March 15, 2007 10:58 AM
Subject: [oracle_br] Re: sqlplus


O manual de user´s Guide do plus lista os comandos necessários que
mostrarei abaixo, a dica que te dou é vc os colocar, junto com a sua
query, num arquivo .SQL que vc executa sem entrar manualmente no
sqlplus (pois senão os ENTERs e barrinhas que vc dá pra executar
coisas no plus manualmente vão pro arq também)... Exemplo :

C:\>type gera_arq_emp.sql
set term off feedback off verify off pages 0 lines 500 trimspool on
head off
spool resultado.txt
select * from emp;
spool off
exit

C:\>sqlplus scott/[EMAIL PROTECTED] @gera_arq_emp.sql

SQL*Plus: Release 9.2.0.5.0 - Production on Qui Mar 15 10:57:21 2007

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Conectado a:
Oracle9i Enterprise Edition Release 9.2.0.5.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.5.0 - Production

Desconectado de Oracle9i Enterprise Edition Release 9.2.0.5.0 - 64bit
Production

With the Partitioning option
JServer Release 9.2.0.5.0 - Production

C:\>type resultado.txt
7369 SMITH CLERK 7902 17/12/1980
00:00:00
800 20
7499 ALLEN SALESMAN 7698 20/02/1981
00:00:00
1600 300 30
7521 WARD SALESMAN 7698 22/02/1981
00:00:00
1250 500 30
7566 JONES MANAGER 7839 02/04/1981
00:00:00
2975 20
7654 MARTIN SALESMAN 7698 28/09/1981
00:00:00
1250 1400 30
7698 BLAKE MANAGER 7839 01/05/1981
00:00:00
2850 30
7782 CLARK MANAGER 7839 09/06/1981
00:00:00
2450 10
7788 SCOTT ANALYST 7566 19/04/0087
00:00:00
3000 20
7839 KING PRESIDENT 17/11/1981
00:00:00
5000 10
7844 TURNER SALESMAN 7698 08/09/1981
00:00:00
1500 0 30
7876 ADAMS CLERK 7788 23/05/0087
00:00:00
1100 20
7900 JAMES CLERK 7698 03/12/1981
00:00:00
950 10 30
7902 FORD ANALYST 7566 03/12/1981
00:00:00
3000 20
7934 MILLER CLERK 7782 23/01/1982
00:00:00
1300 10

C:\>

[]s

Chiappa

--- Em oracle_br@yahoogrupos.com.br, "Thede" <[EMAIL PROTECTED]> escreveu
>
> Bom dia pessoal
>
> Tenho uma pergunta , que acredito que seja de facil resposta pelos
amigos.
>
> Como faço para que o resultado de um select dentro do SQL*PLUS saia
direto
> em um arquivo sem que este select me liste no prompt do SQL*PLUS.
>
> Parecido com o comando "ls > arquivo.txt" do UNIX .
>
> Pois meu select me traz muitas linhas e não quero ficar olhando
aquilo tudo
> rodando , então pretendo jogar direto no arquivo.
>
> Ja tentei usar o SPOOL , porem realmente ele joga direto no
arquivo , mas
> ele me lista o select !! que não é viavel.
>
> O que devo fazer ?
>
> Obrigado a todos !!
>
> Tadeu Paz
>


 


Responder a