I previously ask about converting strings to dates and formatting them.. split string based on character position in ORACLE 11g SQL
Here is the solution I have come up with where WKENDING is VARCHAR2 and RYEAR is date The WKENDING has data that looks like '523'(mmdd) and RYEAR is '2012'..
UPDATE OB_SEL_LST84_AGG_WKEND SET WKENDYEAR = (TO_DATE((TO_DATE(substr(WKENDING,3,2)),'dd')||(TO_DATE(substr(WKENDING,0,1)),'mon')||(TO_DATE(TO_CHAR(RYEAR)),'yyyy')),'dd-mon-yyyy');
I am now getting an error 'ORA-00907: missing right parenthesis', I've double checked the parenthesis a couple of times and they look right to me.. any help would be great.. thanks!
UPDATE - After looking at the syntax of what I have above I thought that maybe there are too many TO_DATE attempted conversions going on. So, I shortened it to this..
UPDATE OB_SEL_LST84_AGG_WKEND SET WKENDYEAR = (TO_DATE((substr(WKENDING,3,2))||(substr(WKENDING,0,1))||TO_CHAR(RYEAR)),'dd-mon-yyyy');
I'm still getting the missing parenthesis error though.. ARGH!