Home » SQL & PL/SQL » SQL & PL/SQL » date conversion
icon10.gif  date conversion [message #221170] Sat, 24 February 2007 12:23 Go to next message
Messages: 48
Registered: February 2007
i am working on datawarehousing domain and our company uses oracle 9i database.In my schema i am having a table time_dim which is having 3 columns fis_date,week_code,mth_code and is populated till 2008.For each date week_code and month_code is populated.How this is populated even i dont know.
i want to pass an environment variable of string type as 20070506.it should compare with fis_date and return me the month and week code.i am able to write the query and its running fine for sysdate.but when i pass the string type parameter its showing error as invalid format.
select week_code,mth_code from time_dim where fis_date=$datadate
$datadate is an environment variable for ab initio tool.datadate is string type.i have tried all to_date,to_char functions but not able to resolve this problem.fis_date is in date format and datadate is in string format.pass the varibale as 20070506 or something like this..

Re: date conversion [message #221177 is a reply to message #221170] Sat, 24 February 2007 13:29 Go to previous message
Messages: 25577
Registered: January 2009
Location: SoCal
Senior Member
>.i have tried all to_date,to_char functions but not able to resolve this problem
You may have tried some.
If in fact you had tried ALL correctly, your problem would be solved.
Use TO_CHAR as documented in the fine SQL Reference Manual found at http://tahiti.oracle.com
Previous Topic: Unix Timestamps/Partitioning
Next Topic: Where to go from here?
Goto Forum:

Current Time: Mon Aug 21 11:02:08 CDT 2017

Total time taken to generate the page: 0.04156 seconds