Search Postgresql Archives

Re: setting local variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Elliott Prechter <elliottp@xxxxxxxxxxxxxxxxxx> 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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux