define logname=date column clogname new_value logname select 'prefix_'||to_char(sysdate, 'yyyymmdd') clogname from dual; spool '&logname'If there is a need to have also name of database included into filename then it can be read from global_name view:
define logname=date column clogname new_value logname select 'prefix_'||substr(global_name,1, decode(dot,0,length(global_name),dot-1))|| to_char(sysdate, 'yyyymmdd') clogname from (select global_name, instr(global_name, '.') dot from global_name); spool '&logname'Hope you find it useful.
I would also like to share an photo I made in Rome in February this year
To see more pictures you are welcome to follow Rome 1, Rome 2, Rome 3
Cheers, Paweł
7 comments:
Another useful tip is that "." is the variable delimiter, so &var1..log appends ".log" to variable name.
Hi,
Thats great this is the one i was looking for.
Gracias, era loq estaba buscando!!!
Gracias. Estaba buscando esta solucion hace tiempo!!! Thanks!
Exactly what I was looking for... Thanks a million Mr. Barut.
By the way, the photographs you took of Rome are just too good...
Cheers!!!
It's trick and useful!
Zs
col dt1 noprint new_value dt1
SELECT TO_CHAR (SYSDATE, 'yyyymmdd') || '.log' dt1 FROM DUAL;
spool C:\log_file_&dt1
sql commands
spool off
Post a Comment