pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bhuvan A <bhuvansql@yahoo.com>
To: pgsql-sql@postgresql.org
Subject: inserting arrays from plpgsql.
Date: Wed, 6 Mar 2002 19:24:22 +0530 (IST)
Message-ID: <Pine.LNX.4.20.0203061910050.15559-100000@Larry> (raw)


Dear all,

i am trying to insert an array from a plpgsql function. But it didnt
work and i didnt know where i am wrong. hope to get some lights.

my need is something like this..

create table po
(
  comp_code text,
  po_no text,
  po_details text[]
);
     
create table xx
(
  comp_code text,
  po_no text,
  po_line1 text,
  po_line2 text
);

and my function is..

create function ftest()
returns opaque as 'declare

  array_params po.po_details%type;

begin
  array_params := {new.po_line1, new.po_line2};
  insert into po values 
	(comp_code, po_no, params)  
  values
	(new.comp_code, new.po_no, array_params);

return new;
end;'
language 'plpgsql';

create trigger ttest after insert on xx for each row execute
procedure ftest();

----

my need is not exactly the same, but very similar.
Will be very happy, if I get some lights!
          
Regards,
Bhuvaneswaran.





Message-ID: <Pine.LNX.4.20.0203061910050.15559-100000@Larry>
Permalink:  ../Pine.LNX.4.20.0203061910050.15559-100000@Larry/
Also on:    postgresql.org/message-id/Pine.LNX.4.20.0203061910050.15559-100000@Larry

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bhuvansql@yahoo.com
  Subject: Re: inserting arrays from plpgsql.
  In-Reply-To: <Pine.LNX.4.20.0203061910050.15559-100000@Larry>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox