Hello,
I do not know if I am posting in the correct forum. I am facing a task of extracting data from an Oracle 9i database every 6 hours and afterwards sending the same data by FTP to a remote site.
Is it feasible to accomplished all the task in Oracle as a job? Or, should I run the script in Oracle, place the data in a directory, and have an auto FTP client (FTPAuto Pro) pull the data every hours and transfer? I am still facing a problem of having the date in the SQL script roll to the current_day-1. Can the script be written to roll the date?
Here is the script:
set pagesize 0;
set heading off;
set trimspool on;
set feedback off;
alter session set nls_date_format='YYYYMMDD';
spool DailyPiece_RTO.log
select
distinct(b."badge")||','||
a."opDate"||','||
ltrim(rtrim(a."blockRoute"))||','||
a."actDrivBegTime"||','||
a."actDrivEndTime"||','||
c."lastName"||','||
c."firstName"||','||
ltrim(rtrim(a."vehicleID"))||','||
ltrim(rtrim(a."blockID"))||','||
ltrim(rtrim(a."runNumber"))||','||
a."division"
from "dailyPiece" a,"employeeStatus" b,"employee" c
where a."opDate" between '20040118' and '20040119'
and a."vehicleID" is not null
and a."emp_SID"=b."emp_SID"
and b."emp_SID"=c."emp_SID";
spool off;
;
Thanks
I do not know if I am posting in the correct forum. I am facing a task of extracting data from an Oracle 9i database every 6 hours and afterwards sending the same data by FTP to a remote site.
Is it feasible to accomplished all the task in Oracle as a job? Or, should I run the script in Oracle, place the data in a directory, and have an auto FTP client (FTPAuto Pro) pull the data every hours and transfer? I am still facing a problem of having the date in the SQL script roll to the current_day-1. Can the script be written to roll the date?
Here is the script:
set pagesize 0;
set heading off;
set trimspool on;
set feedback off;
alter session set nls_date_format='YYYYMMDD';
spool DailyPiece_RTO.log
select
distinct(b."badge")||','||
a."opDate"||','||
ltrim(rtrim(a."blockRoute"))||','||
a."actDrivBegTime"||','||
a."actDrivEndTime"||','||
c."lastName"||','||
c."firstName"||','||
ltrim(rtrim(a."vehicleID"))||','||
ltrim(rtrim(a."blockID"))||','||
ltrim(rtrim(a."runNumber"))||','||
a."division"
from "dailyPiece" a,"employeeStatus" b,"employee" c
where a."opDate" between '20040118' and '20040119'
and a."vehicleID" is not null
and a."emp_SID"=b."emp_SID"
and b."emp_SID"=c."emp_SID";
spool off;
;
Thanks