Bonjour,
J'ai besoin de faire, automatiquement si possible, un grand nombre d'insert dans une base.
Voici (quasiment) ma première function pl/pgsql, qui me sort :
ERROR: syntax error at end of input at character 8
CONTEXT: PL/pgSQL function "majmeta" line 18 at return
Voici ma fonction
(je l'appelle avec select majmeta('ctlf_000000001_1967_mon_54214_1');
est ce que quelqu'un pourrait m'aider ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 CREATE OR REPLACE FUNCTION "public"."majmeta" (text) RETURNS text AS ' DECLARE rec record; curs refcursor; metaid integer; BEGIN SELECT metanames.metaname_id INTO metaid FROM section_metaname_roles, metanames WHERE metanames.metaname_id=section_metaname_roles.metaname_id AND section_metaname_roles.section_id IN (SELECT section_id from sections WHERE code_role=\'issue\' and issue_id = $1) ; OPEN curs FOR SELECT section_id from sections where sections.issue_id = $1 and code_role != \'issue\' ; LOOP FETCH curs into rec; EXIT WHEN NOT FOUND; INSERT INTO section_metaname_roles VALUES(rec.section_id, metaid, 70); END LOOP; CLOSE curs; return; END; ' LANGUAGE 'plpgsql' ;
d'avance merci
Partager