Thread: execute
Hi every one,
I'm trying to do the follow:
declare
aCad text[][]
begin
...
execute 'aCad:=aCad array[['||var1||','||var2||']]'
...
end; language plpgsql
but I get the follow error:
sintax erro near to "aCad"
aCad := aCad || array[rCad.cmp,rSql.codfor]
^
I guess I should not use "execute" besides of insert, update, delete ... but how could I do in this case ?
Thanks every one.
--
Grato,
Mauricio Cruz
Sygecom Informática
51 3442-3975 / 3442-2345
On Thu, Apr 25, 2013 at 9:17 AM, Mauricio Cruz <cruz@sygecom.com.br> wrote: > execute 'aCad:=aCad array[['||var1||','||var2||']]' What are you going to do using this construction aCad:=aCad array[['||var1||','||var2||']] ? I can not understand the meaning. -- Kind regards, Sergey Konoplev Database and Software Consultant Profile: http://www.linkedin.com/in/grayhemp Phone: USA +1 (415) 867-9984, Russia +7 (901) 903-0499, +7 (988) 888-1979 Skype: gray-hemp Jabber: gray.ru@gmail.com
do you want append array[['||var1||','||var2||']] to aCad?
you can do this:
declare tmpa text[] := array[]::text[];
...
tmpa:= tmpa || var1 || var2;
aCad:= aCad || tmpa;
...
execute in plpgsql can ruan any pg sql command,but
aCad:=aCad array[['||var1||','||var2||']]
is not a command, it is a statement in plpgsql, a PART of plpgsql cmd.
On 2013-04-25, Mauricio Cruz <cruz@sygecom.com.br> wrote: > declare > > aCad > text[][] > > begin > > ... > > execute 'aCad:=aCad > array[['||var1||','||var2||']]' execute 'select array[['||var1||','||var2||']]' into acad; -- ⚂⚃ 100% natural