Skip to content

Instantly share code, notes, and snippets.

@dfasolin
Created May 31, 2011 20:41
Show Gist options
  • Save dfasolin/1001242 to your computer and use it in GitHub Desktop.
Save dfasolin/1001242 to your computer and use it in GitHub Desktop.
Exemplo de Spool no Oracle
set linesize 1000
set pagesize 0
set trimspool on
set feedback off
set time off
set timing off
set echo off
select 'Inicio: ' || to_char(sysdate,'HH24:MI:SS') from dual;
set termout off
spool c:\ce_cupom_desconto.txt
select eq.num_orig_cli ||
lpad(nvl(cd.idt_bonificacao,0),12,'0') ||
nvl(replace(trim(to_char(cd.val_desconto,'000000d99')),'.',''),'00000000') ||
nvl(to_char(cd.dat_mov_pdv,'rrrrmmdd'),'00000000') ||
lpad(nvl(cd.idt_documento,0),13,'0') ||
nvl(replace(trim(to_char(cd.val_compra,'000000d99')),'.',''),'00000000')
from equi_cli eq
,cupom_desconto cd
where eq.idt_cli = cd.idt_cli
order by dat_mov_pdv;
spool off
set termout on
select 'Fim: ' || to_char(sysdate,'HH24:MI:SS') from dual;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment