Bonjour,
je dois convertir une fonction existante sous Oracle vers Postgres 10. Le souci est qu'il me sort une erreur au niveau du IF. Si quelqu'un a une idée sur le problème parce que la je sèche.
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
24
25
26
27
28
29 CREATE OR REPLACE FUNCTION test (val IN int, offs IN int, minVal IN int, maxVal IN int) RETURNS INT AS $$ DECLARE Offset int; newOffset int; newVal int; range int; BEGIN range:=maxval-minval+1; newOffset:=(offs/abs(offs))*(abs(offs) % range); newVal:=val-minVal; Offset:=newVal+newOffset; if Offset > range then Offset:=Offset; end if; if Offset<0 then Offset:=range+offset; end if; Offset:=Offset+minVal; return Offset+minVal; END; $$ LANGUAGE plpgsql; ERROR: syntax error at or near ">"
Partager