how to proccess record returning null
От | te |
---|---|
Тема | how to proccess record returning null |
Дата | |
Msg-id | 1347563825521-5723932.post@n5.nabble.com обсуждение исходный текст |
Ответы |
Re: how to proccess record returning null
|
Список | pgsql-bugs |
Hi all, I am new to postgresql and I am trying to write a function which uses record (r) to select from table and then proccess that record value. CREATE OR REPLACE FUNCTION clean() RETURNS integer AS $$ DECLARE r record; result integer:= 0; BEGIN FOR r in select distinct(id) from temp loop IF r.id is null or r.id ='' THEN result := 555; else result := 999; end if; end loop; RETURN result; END; $$ LANGUAGE plpgsql; The problem here is 'r' is returning no records and I want to set result to 555 if r.id is null. The function is created successfully but the result select clean() is always '0'. I am unable to spot the problem. May be this is trivial but I am struggling for it. Can anybody suggest anything? -- View this message in context: http://postgresql.1045698.n5.nabble.com/how-to-proccess-record-returning-null-tp5723932.html Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.
В списке pgsql-bugs по дате отправления: