1

in ms sql I have the following code:

ALTER PROCEDURE [dbo].[xmlDictamen_Alta]
  @Xml text
as begin

declare @Id            integer
declare @DictamenId    numeric(18,0)
declare @DocumentoId   numeric(18,0)
declare @Descripcion   varchar(300)

begin

    set nocount on
    exec dbo.sp_xml_preparedocument @Id output, @Xml

    select 
        @DocumentId  = DocumentId,
        @Description = IsNull( Description, ''),
    from 
    OpenXml( @IdXml, '/Parameter', 2) with (
    DocumentId       numeric(18,0),
    Description      varchar(300)
    )

    exec dbo.sp_xml_removedocument @IdXml


/*
execute xmlDictamen_Alta
'
    <Parameter>
      <DocumentId>1328</DocumentId>
      <Description>Descripcion</Description>
    </Parameter>
'
*/

How would you port these stored procedure to postgres???

1 Answer 1

2

In PostgreSQl,the xml function is weak.But you could use plperU procedure to do this.

create or replace function proc_parse_xml(xml text) return setof tp_docs as $$

use XML::DOM;

my $pr = new XML::DOM::Parser;
my $xmldocs = $pr->parse(xml);

......

return;
 $$ language plperlU;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.