Stored procedure to insert data into Postgresql -


i have following stored procedure or function defined in postgresql database:

    create or replace function insert_val(int)     $body$     begin       in 1..10 loop         insert test (val)         values($23);       end loop;    end;    $body$ language 'plpgsql' volatile; 

i want insert data inside of loop, error:

syntaxfehler bei »begin«

is maybe missed in function?

i don't understand error message since it's not in english, can see few problems in code

create or replace function insert_val(in val int) returns void   $body$     begin       in 1..10 loop         insert test (val)         values($23);       end loop;    end;    $body$ language 'plpgsql' volatile; 

you missing return type, missing as , have forgotten name in argument.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -