Re: xml question

From: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: xml question
Date: 2014-04-29 00:08:30
Message-ID: 1398730110430-5801819.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

David Ekren wrote
> I am new to this forum. I need to return the value 1 between the
> orientationId tags in this xml string within the function below. I still
> get errors. I'm sure I am doing something wrong. Any help would be
> appreciated.
>
>
> CREATE FUNCTION Davidxml9(v_clipId integer, v_orientationId varchar(1024),
> OUT clipId int, OUT orientationId varchar(1024)) AS $$
> BEGIN
> clipId := v_clipId;
> orientationId := xpath('/Rows/Row/orientationId[1]/text()', content)
> FROM (SELECT v_orientationId ::xml AS orientationId);
>   
> END;
> $$ LANGUAGE plpgsql;
> GO
>
> SELECT Davidxml9(1,'
> <Rows>
> <Row>
> <orientationId>
> 1
> </orientationId>
> </Row>
> </Rows>
> ')

1. Try solving your xpath problem without using a custom function.
2. Go and read the documentation on writing plpgsql functions a couple of
times. What you have written here has at least six major problems.

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/xml-question-tp5801793p5801819.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Noel 2014-04-29 06:59:14 SQL query runs fine on one platform (FreeBSD), but hangs on another (Windows)
Previous Message Adrian Klaver 2014-04-28 21:40:07 Re: problems with permissions