Problem when dealing with Date

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
balajimadhav
Participant
Posts: 15
Joined: Thu Jul 06, 2006 8:59 am

Problem when dealing with Date

Post by balajimadhav »

Hi all,

my server job is a oracle -> transformer-> oracle stage. in source i have three columns as date,month(eg: JAN,DEC...format),year(all three of varchar2 datatype) but in target these three should be mapped to a date column in target. so i used a routine to map these source columns to target. but when it is inserted into the target table i am getting an error
"ORA-01858: a non-numeric character was found where a numeric was expected"

my requirement in short:
source
c1 c2 c3

eg: 10 MAR 2000

target

10-MAR-2000

(where c1,c2,c3 are column 1,2,3 respectively)

thanks in advance.
Balaji.
LNarayana
Participant
Posts: 5
Joined: Tue Jan 27, 2004 7:00 am
Contact:

Post by LNarayana »

Convert the target date in YYYY-MM-DD format which is compatible with Oracle.

Narayana
mcolen
Premium Member
Premium Member
Posts: 31
Joined: Wed Aug 11, 2004 8:59 am
Location: Florida

Date Problem

Post by mcolen »

Output format is YYYY-MM-DD 00:00:00 for Oracle dates. The way you have the date listed I would do an Iconv on the Input and Oconv to Oracle Format
meena
Participant
Posts: 430
Joined: Tue Sep 13, 2005 12:17 pm

Post by meena »

Hi balajimadhav ,
You have three columns(date,month,year) in the oracle table(source) and one column to be loaded in oracle table(target).

Code: Select all

my requirement in short: 
source 
c1 c2 c3 

eg: 10 MAR 2000 

target 

10-MAR-2000
Try doing a concatenation of the three columns.
output col=c1:"-":c2:"-"c3.

Check whether this works or not. And if you want to convert this to timestamp then concatenate the competele derivation with 00:00:00. I am not sure but trying to give an idea.
meena
Participant
Posts: 430
Joined: Tue Sep 13, 2005 12:17 pm

Post by meena »

And also try to use Iconv and Oconv as " mcolen" mentioned.
meena wrote:Hi balajimadhav ,
You have three columns(date,month,year) in the oracle table(source) and one column to be loaded in oracle table(target).

Code: Select all

my requirement in short: 
source 
c1 c2 c3 

eg: 10 MAR 2000 

target 

10-MAR-2000
Try doing a concatenation of the three columns.
output col=c1:"-":c2:"-"c3.

Check whether this works or not. And if you want to convert this to timestamp then concatenate the competele derivation with 00:00:00. I am not sure but trying to give an idea.

Thank you
balajimadhav
Participant
Posts: 15
Joined: Thu Jul 06, 2006 8:59 am

Post by balajimadhav »

meena wrote:And also try to use Iconv and Oconv as " mcolen" mentioned.
meena wrote:Hi balajimadhav ,
You have three columns(date,month,year) in the oracle table(source) and one column to be loaded in oracle table(target).

Code: Select all

my requirement in short: 
source 
c1 c2 c3 

eg: 10 MAR 2000 

target 

10-MAR-2000
Try doing a concatenation of the three columns.
output col=c1:"-":c2:"-"c3.

Check whether this works or not. And if you want to convert this to timestamp then concatenate the competele derivation with 00:00:00. I am not sure but trying to give an idea.

Thank you


Hi all,
thanks for your Suggestion. i concatenated all the three columns in the format yyyy-mm-dd but still i got the error and i did a Iconv and Oconv. i got the result as required.

thank you.
Balaji.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Concatinate as you specified, and have this funciton in oracle load stage.
to_date('10-MAR-2000','DD-MON-YYYY')
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Bottom line is it really doesn't matter what order you stick the pieces together in, or what delimiter you use - as long as it matches the format mask used in the OCI stage.

Best Practice is to stick with ISO formatted dates, those in YYYY-MM-DD format, and let the OCI stage automatically generate the appropriate sql for you. None of this pain-in-the-ass-to-maintain custom sql just for that. :evil:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply