You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: function/ts/updatelakeparam.sql
+28-26Lines changed: 28 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -5,34 +5,36 @@ CREATE OR REPLACE FUNCTION ts.updatelakeparam(_siteid integer,
5
5
RETURNS void
6
6
LANGUAGE plpgsql
7
7
AS $function$
8
-
DECLARE
8
+
DECLARE
9
9
10
-
_lakeparameterid int := (SELECTlp.lakeparameteridFROMndb.lakeparametertypesAS lp WHERElp.lakeparameter= _lakeparameter);
11
-
_nparam int := (SELECTCOUNT(*) AS count FROMndb.lakeparametersAS lp WHERElp.siteid= _siteid GROUP BYlp.lakeparameteridHAVINGlp.lakeparameterid= lakeparameterid);
12
-
/* If nparam is not null, then the LakeParameter is already in Neotoma */
10
+
_lakeparameterid int := (
11
+
SELECTlp.lakeparameterid
12
+
FROMndb.lakeparametertypesAS lp
13
+
WHERElp.lakeparameter= _lakeparameter);
14
+
_nparam int := (
15
+
SELECTCOUNT(*) AS count
16
+
FROMndb.lakeparametersAS lp
17
+
WHERElp.siteid= _siteid
18
+
GROUP BYlp.lakeparameterid
19
+
HAVINGlp.lakeparameterid= lakeparameterid);
13
20
14
-
BEGIN
21
+
/* If nparam is not null, then the LakeParameter is already in Neotoma */
15
22
16
-
IF _value IS NOT NULL THEN
17
-
IF _nparam IS NOT NULL THEN /* parameter in Neotoma, need to change */
18
-
UPDATEndb.lakeparametersAS lp
19
-
SET value = value WHERE (siteid = _siteid) AND (lp.lakeparameterid= _lakeparameterid);
0 commit comments