From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Elliott Prechter <elliottp(at)privatefundmgt(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: setting local variable |
Date: | 2011-04-24 21:23:09 |
Message-ID: | 17828.1303680189@sss.pgh.pa.us |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Elliott Prechter <elliottp(at)privatefundmgt(dot)com> writes:
> I have a function which looks like this:
> ...
> declare _object bigint;
> begin
> set _object = insert into object (object_type,name) values
> ('type1','test object');
> insert into ref (object,refname) values (_object,'test object reference');
> end;
> ...
> However I get a syntax error on the line 'set _object = insert ....'
In plpgsql it's just "variable := value", no SET keyword. However,
you've got more problems than that: INSERT doesn't return a value.
It's not at all clear what you expect that to do.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | John R Pierce | 2011-04-25 00:40:22 | Re: Need to replace SAN, best method with least downtime? (8.4.4) |
Previous Message | Tom Lane | 2011-04-24 21:16:37 | Re: Extract (Recover) data from a cluster built on a different architecture (ARM). |