Adding - Between Concatenated Values

Hello,

I have a field where the date is entered as follows 20040628, this represents 28-06-2004. I need to use this in a condition so I need the 20040628 in the format of 28-06-2004.

So far I have managed to get the date in the following format 28062004
by doing the following,

substr(MIS_SOURCES_INFO.PARAMETERVALUE,7,2) ||
substr(MIS_SOURCES_INFO.PARAMETERVALUE,5,2) ||
substr(MIS_SOURCES_INFO.PARAMETERVALUE,1,4)

How can I now get the - into the number ?


Fiona :uk: (BOB member since 2002-12-16)

Try:

substr(MIS_SOURCES_INFO.PARAMETERVALUE,7,2) || '-'  ||
substr(MIS_SOURCES_INFO.PARAMETERVALUE,5,2) || '-'  ||
substr(MIS_SOURCES_INFO.PARAMETERVALUE,1,4) 

An easier way might be to use the To_Date function in Oracle etc.


Andreas :de: (BOB member since 2002-06-20)

Thankyou very much :mrgreen:


Fiona :uk: (BOB member since 2002-12-16)