Another comment: In the last load attempt using `date '+%m-%d-%y'`, the date 01-03-05 was generated by ksh but then rejected by Oracle when sqlldr ran.
Main Topics
Browse All TopicsHi,
I am trying to insert a column of type date into Oracle via a ksh script. In my ksh script, I set and formatted the date variable as `date '+%m%d%y'` but Oracle did not accept this date format. Ideally, I would like to insert BOTH the date and time info into this single Oracle columns.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
being that i have no idea how you are trying to insert this date, i'm not sure if this will help. however, it can't hurt so here goes. using hp unix and oracle 8.1.7 i'm able to insert the unix system date and time kind of like the way you describe above as follows. however, i'm not sure why you couldn't just select sysdate from dual and insert a date/time that way. please clarify your question and we can try to help more.
------start code file test.ksh-------
# Environment variables
DBINSTANCE=database
LOGON_NAME=username
LOGON_PASSWD=pswd
inst $DBINSTANCE
# Start sqlplus, log in to database, and initiate error log file
sqlplus -s $LOGON_NAME/$LOGON_PASSWD << SQLCMDS
SET heading off
SET termout on
SET trimspool on
SET feedback off
SET serveroutput on
EXEC DBMS_OUTPUT.ENABLE (1000000);
ALTER SESSION SET NLS_DATE_FORMAT = 'MMDDYYHHMISS';
insert into test_table values(to_date( '`date '+%m%d%y%H%M%S'`', 'MMDDYYHH24MISS'));
commit;
EXIT
SQLCMDS
exit;
Business Accounts
Answer for Membership
by: jmohsinPosted on 2005-01-03 at 13:10:47ID: 12947220
A comment. Please note that this insert is being done via the ksh script using sqlldr. I tried `date '+%m-%d-%y'` and that did not work either.