Re: plPerl subroutine

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: "FERREIRA William (COFRAMI)" <william(dot)ferreira(at)airbus(dot)com>
Cc: "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: plPerl subroutine
Date: 2005-03-16 15:09:21
Message-ID: 679ba9f1655ba9feacd96deb54d8bf19@mail.nih.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

My understanding is that pl/perl functions are simply anonymous
coderefs, so they can't call each other. What is it that you REALLY
want to do? (The code looks a bit like a toy example.)

Sean

On Mar 16, 2005, at 9:17 AM, FERREIRA William (COFRAMI) wrote:

> hi
>  
> is it possible to create subroutines with plPerl ?
>  
> i tried this :
> CREATE OR REPLACE FUNCTION adoc.CREATE_XML_FILE(docId int4, eleId
> int4, evo int4, fileName text, fileRelativeDir text)
>   RETURNS int4 AS
> $BODY$
>  my $theClob='';
>  
>  my $params = 'select
> adoc.GET_XML_FRAG('.$_[0].','.$_[1].','.$_[2].',\''.$theClob.'\','.0;
>  $params = $params.')';
>  
>  $theClob =  spi_exec_query($params);
>  elog NOTICE, $theClob;
>  
>  return 4;
> $BODY$
>   LANGUAGE 'plperl' VOLATILE;
>  
> CREATE OR REPLACE FUNCTION adoc.GET_XML_FRAG(docId int4, eleId int4,
> evo int4, clob text, indx int4)
>   RETURNS text AS
> $BODY$
>  my $t_clob = $_[3].'totototototototototot';
>  
>  return $t_clob;
> $BODY$
>   LANGUAGE 'plperl' VOLATILE;
> but the CREATE_XML_FILE doesn't display 'totototototototototot' but
> HASH(0xf03fa4)....
>  
> is it possible with this solution or does i need to create a module
> (including makefile, .pm, ...) ?
> if i must create a module, can you explain how to do ?
>  
>
> thanks

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marco Colombo 2005-03-16 15:17:51 Re: New user: Windows, Postgresql, Python
Previous Message Miroslav Šulc 2005-03-16 14:55:19 Re: psql file restore - problem with encoding