I'm new with PostgreSQL; I used to work with Toad for Oracle. I run the following code and can't make it work.
begin
for prueba in
(select * from a_userid)
loop
update a_userid set user_id2 = nextval('seq_userid')
where user_id = prueba.user_id;
commit;
end loop;
end;
The error is:
************ Error **********
ERROR: error de sintaxis en o cerca de «for»
SQL state: 42601
Character: 9
With Oracle it used to work that way. I don't know where the problem is. I also tried using:
LANGUAGE 'plpgsql';
at the end... but it didn't change at all.