sql - syntax error at or near create when creating a function -



sql - syntax error at or near create when creating a function -

so creating function in postgresql first time , having problem syntax

create or replace function uni() returns integer $$ declare mviews record; begin mviews in select id,universite_adi proaca.a loop insert proaca.universite (id,ad,ulke_id) values (mviews.id,mviews.universite_adi,1) end loop; homecoming 1; end; $$ language plpgsql; error: syntax error @ or near "create" line 2: $body$create or replace function uni() returns integer $$

the syntax error solved a_horse in comments:

missing ; terminate insert statement.

you don't need loop. plain sql

create or replace function uni() returns integer $$ insert proaca.universite (id, ad, ulke_id) select id, universite_adi, 1 proaca.a returning 1 ; $$ language sql;

sql postgresql

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -