×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Add Date and Time Stamp File Name

Add Date and Time Stamp File Name

Add Date and Time Stamp File Name

(OP)
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;

RE: Add Date and Time Stamp File Name

Try this:

CODE

-- etc --
col  timstmp new_value timstmp
break on report
select to_char(sysdate,'YYYY-MM-DD-HH24-MI') timstmp from dual;
spo G:\KNX_Export\KNX_SCHEDULED_SHIFTS_&&timstmp..txt
-- etc -- 

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

RE: Add Date and Time Stamp File Name

(OP)
Thank you LKBrwnDBA, you made it look so easy. It's exactly what I needed.

RE: Add Date and Time Stamp File Name

IAmTrying, Please click on LKBrownDBA's " Like this post? Star it!" to let him know how much you appreciate his "exactly what I needed" help.

santaMufasa
(aka Dave of Sandy, Utah, USA)
“People may forget what you say, but they will never forget how you made them feel."

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close