Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Using Substitution Variables Dynamically in File Names
Sorry, I should have provided more info on the variables.
/*
##############################################
#
# COMMON VARIABLES
#
##############################################
*/
var companyid varchar2(11);
begin
select &companyid into :companyid from dual;
end;
/
set pages 9999
set linesize 160
set feedback off
column tm new_value file_time noprint
select to_char(sysdate,'YYYYMMDD') tm from dual;
col sn noprint new_value company_name
select scompanyname sn from tblcompany where ncompanyid= :companyid
spool /home/utils/companyReports/&&company_name.&file_time..txt
prompt -- &&company_name --;
What results is as follows:
The file does not spool which I suspect is because the &&company_name.&file_time..txt does not result in a valid file name. The file_time variable does work though. Received on Wed Oct 17 2007 - 06:25:38 CDT
![]() |
![]() |