Unable to convert xpath value to date

From: saritha N <saritha(dot)0917(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Unable to convert xpath value to date
Date: 2013-10-03 07:35:12
Message-ID: CAMj0Pyt=NmRZ3giNxwRZZ43q3g-JrAjXcecRvtQ39XsX=S0eRg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I am getting an error while retrieving the values from xml and converting
into date format

when I execute this query
select history from KM_REL_FF_USR_DATA where USERID in (53008) and
SHARE_WORKING_GROUP =15683

output is
"<HISTORY TYPE="DATAENTRYTYPE" ><USERSUBMITEDDATA ID="1"
><DATAENTRYFIELDDATA ID="1" TYPE="DATAENTRYTYPE" ><DATA ID="1"
CREATED-DATE="09-09-2013" CREATED-TIME="12:00:00 am(am)"
MODIFIED-DATE="09-09-2013" MODIFIED-TIME="12:00:00 am(am)" > Enter what you
want to achieve from this programme&#058;
</DATA></DATAENTRYFIELDDATA></USERSUBMITEDDATA></HISTORY>"

from this I need to extract modified date and convert to date.I am using
this below query.But while executing this query I am getting error

select to_date(xpath('//DATA/@MODIFIED-DATE',(select history from
KM_REL_FF_USR_DATA where USERID in (53008) and SHARE_WORKING_GROUP
=15683))::text,'dd/mm/yyyy')

ERROR: invalid value "{0" for "dd"
DETAIL: Value must be an integer.

Please help me out to solve this issue.

Thanks & Regards,
Saritha

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Johann Spies 2013-10-03 08:08:59 Whole record returned in stead of field
Previous Message Jaime Casanova 2013-10-03 04:34:56 Re: Postgres replication question :- One master 2 slaves 9.0.10