From: | cesitarps <plicanhpc(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | pass XML as an argument and INSERT (key/value pairs) in postgresql |
Date: | 2011-07-16 16:14:35 |
Message-ID: | 1310832875860-4594251.post@n5.nabble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2011-07-16 16:55:35 | Re: Table dublicates values |
Previous Message | Tom Lane | 2011-07-16 15:58:22 | Re: Slow query with sub-select |