pass XML as an argument and INSERT (key/value pairs) in postgresql - Mailing list pgsql-general

From cesitarps
Subject pass XML as an argument and INSERT (key/value pairs) in postgresql
Date
Msg-id 1310832875860-4594251.post@n5.nabble.com
Whole thread Raw
List pgsql-general
hola amigos encontre este procedimiento pero quisiera pasarlo a postgresql ,
su ayuda sera de mucha importancia porfavor se los agradecere.

¿ como seria en postgresql ....?

create procedure ParseXML (@InputXML xml)
as
begin
    declare @MyTable table (
        id int,
        value int
    )

    insert into @MyTable
        (id, value)
        select Row.id.value('@id','int'), Row.id.value('@value','int')
            from @InputXML.nodes('/Rows/Row') as Row(id)

    select id, value
        from @MyTable
end
go

/* Create the XML Parameter */
declare @XMLParam xml
set @XMLParam = '<Rows>
                     <Row id="1" value="100" />
                     <Row id="2" value="200" />
                     <Row id="3" value="300" />
                 </Rows>'

/* Call the stored procedure with the XML Parameter */
exec ParseXML @InputXML = @XMLParam


--
View this message in context:
http://postgresql.1045698.n5.nabble.com/pass-XML-as-an-argument-and-INSERT-key-value-pairs-in-postgresql-tp4594251p4594251.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

pgsql-general by date:

Previous
From: Michael Nolan
Date:
Subject: Re: Slow query with sub-select
Next
From: - -
Date:
Subject: Re: Slow query with sub-select