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
dr46014
Messages: 48
Registered: February 2007
Member
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
BlackSwan
Messages: 25039
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: unwarp
Next Topic: Split the name into seperate columns
Goto Forum:
  


Current Time: Tue Dec 06 02:53:22 CST 2016

Total time taken to generate the page: 0.10254 seconds