From: | Bhuvan A <bhuvansql(at)yahoo(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | inserting arrays from plpgsql. |
Date: | 2002-03-06 13:54:22 |
Message-ID: | Pine.LNX.4.20.0203061910050.15559-100000@Larry |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Bhuvan A | 2002-03-06 14:13:18 | assigning values to arrays in plpgsql |
Previous Message | Laszlo Tibor | 2002-03-06 10:46:28 | Re: getting pid of backend |