Hi I am using Oracle 9i and Oracle's job scheduler to export data at specific intervals. I would like to add the date and timestamp to the file name for each file. I have been successful adding the date within the export, but not to the name. Here is what I have at this time. Thank you
set pagesize 0;
set timing off;
set heading off;
set trimspool on;
set feedback off;
alter session set nls_date_format='MMDDYYYY';
select to_char(sysdate,'MM-DD-YYYY') sdate from dual;
select TO_CHAR(sysdate) from dual;
spool G:\KNX_Export\KNX_SCHEDULED_SHIFTS.txt
select
(e."personnelID")||','||
Trim(To_Char(dp."opDate",'MM/DD/YYYY'))||','||
Trim(dbo.hh_mma(dp."actDrivBegTime"))||','||
Trim(dbo.hh_mma(dp."actDrivEndTime"))||','||
Trim(dp."dailyPieceFlags")||','||
Trim(dp."blockID")||','||
Trim(dp."boardID")||','||
Trim(dp."runNumber")
from "dailyPiece" dp, "employeeStatus" es, "employee" e
where dp."opDate" between SYSDATE -3 AND SYSDATE and
es."emp_SID" = dp."emp_SID" and es."dateEffective" <= dp."opDate" and es."dateEnd" >= dp."opDate"
and e."emp_SID" = dp."emp_SID"
order by e."personnelID", dp."opDate", dp."actDrivBegTime";
spool off;
set pagesize 0;
set timing off;
set heading off;
set trimspool on;
set feedback off;
alter session set nls_date_format='MMDDYYYY';
select to_char(sysdate,'MM-DD-YYYY') sdate from dual;
select TO_CHAR(sysdate) from dual;
spool G:\KNX_Export\KNX_SCHEDULED_SHIFTS.txt
select
(e."personnelID")||','||
Trim(To_Char(dp."opDate",'MM/DD/YYYY'))||','||
Trim(dbo.hh_mma(dp."actDrivBegTime"))||','||
Trim(dbo.hh_mma(dp."actDrivEndTime"))||','||
Trim(dp."dailyPieceFlags")||','||
Trim(dp."blockID")||','||
Trim(dp."boardID")||','||
Trim(dp."runNumber")
from "dailyPiece" dp, "employeeStatus" es, "employee" e
where dp."opDate" between SYSDATE -3 AND SYSDATE and
es."emp_SID" = dp."emp_SID" and es."dateEffective" <= dp."opDate" and es."dateEnd" >= dp."opDate"
and e."emp_SID" = dp."emp_SID"
order by e."personnelID", dp."opDate", dp."actDrivBegTime";
spool off;