Bom dia
Desta forma ele pegou somente o dia 18/12

select alert_date,substr(alert_text,1, 69) 
from system.alert_log where alert_date
between to_date('18-dec-2006', 'dd-mon-yyyy') and to_date('19-dec-
2006',
'dd-mon-yyyy');


ALERT_DAT SUBSTR(ALERT_TEXT,1,69)
--------- ------------------------------------------------------------
---------
18-DEC-06 Starting ORACLE instance (normal)
18-DEC-06 Dump file d:\oracle\sc7\saptrace\background\alert_sc7.log
18-DEC-06 ORACLE V9.2.0.4.0 - Production vsnsta=0
18-DEC-06 vsnsql=12 vsnxtr=3
18-DEC-06 Windows 2000 Version 5.2 Service Pack 1, CPU type 586
18-DEC-06 Starting ORACLE instance (normal)
18-DEC-06 Disable cache advisory with old cache parameters
18-DEC-06 LICENSE_MAX_SESSION = 0
18-DEC-06 LICENSE_SESSIONS_WARNING = 0
18-DEC-06 SCN scheme 2
18-DEC-06 LICENSE_MAX_USERS = 0
18-DEC-06 SYS auditing is disabled
18-DEC-06 Starting up ORACLE RDBMS Version: 9.2.0.4.0.
18-DEC-06 System parameters with non-default values:
18-DEC-06 processes                = 80
18-DEC-06 sessions                 = 96
18-DEC-06 timed_statistics         = TRUE


Existe alguma forma de não precisar inserir a data manualmente.
GOstaria de deixar o script configurado para trazer somente o dia 
anterior e o atual por exemplo hoje pegaria somente o dia 19/12 e 
20/12.

Grato
Rogério 

--- Em oracle_br@yahoogrupos.com.br, "Rafael Milanez - BusinessOn" 
<[EMAIL PROTECTED]> escreveu
>
> testa ai
> 
> select alert_date, alert_text
> from alert_log where alert_date 
> between  to_date('18-dec-2006', 'dd-mon-yyyy') and to_date('19-dec-
2006', 'dd-mon-yyyy')
> 
> 
>   ----- Original Message ----- 
>   From: Rogerio 
>   To: oracle_br@yahoogrupos.com.br 
>   Sent: Tuesday, December 19, 2006 4:13 PM
>   Subject: [oracle_br] Data no sql
> 
> 
>   Boa tarde pessoal,
>   Gostaria de saber como faço para pegar a data do dia ou um 
periodo 
>   por exemplo os dois ultimos dias.
>   Exemplo hoje é dia 19/12/2006 gostaria de fazer um select somente 
do 
>   periodo de 18/12 a 19/12
> 
>   select alert_date, substr(alert_text,1, 69)
>   from alert_log where alert_date = to_date('19-dec-2006', 'dd-mon-
>   yyyy');
> 
>   Tentei o select acima mas não retornou nada e na tabela tem os 
dados 
>   necessarios como no exemplo abaixo.
> 
>   ALERT_DAT SUBSTR
>   (ALERT_TEXT,1,69) 
>   --------- --------------------------------------------------------
--
>   --------- 
>   19-DEC-06 Successful open of redo thread 
>   1. 
>   19-DEC-06 MTTR advisory is disabled because 
FAST_START_MTTR_TARGET is 
>   not set 
>   19-DEC-06 SMON: enabling cache 
>   recovery 
>   19-DEC-06 SMON: enabling tx 
>   recovery 
>   19-DEC-06 Database Characterset is 
>   WE8DEC 
>   19-DEC-06 replication_dependency_tracking turned off (no async 
>   multimaster repl 
>   19-DEC-06 Completed: alter database 
>   open 
>   19-DEC-06 Starting ORACLE instance 
>   (normal) 
>   19-DEC-06 ALTER TABLESPACE PSAPROLL 
>   COALESCE 
>   19-DEC-06 Completed: ALTER TABLESPACE PSAPROLL 
>   COALESCE 
>   19-DEC-06 ALTER TABLESPACE SYSTEM 
>   COALESCE 
> 
>   ALERT_DAT SUBSTR
>   (ALERT_TEXT,1,69) 
>   --------- --------------------------------------------------------
--
>   --------- 
>   19-DEC-06 Completed: ALTER TABLESPACE SYSTEM COALESCE 
> 
>   O campo ALERT_DAT foi criado como Date na tabela.
>   Se alguém tiver alguma dica seria muito util.
>   Grato
>   Rogério
> 
> 
> 
>    
> 
> [As partes desta mensagem que não continham texto foram removidas]
>


Responder a