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 i
Sorry I didnt mention it.
temp is a table name.
FOR r in select distinct(id) from temp
There are no distinct id's in table 'temp', so record 'r' has null values.
So I guess the control is not going inside the loop.
Any suggestions?
--
View this message in context:
http://postgresql.10456
What I want to do is,
CREATE OR REPLACE FUNCTION clean()
RETURNS void AS $$
DECLARE
r record;
BEGIN
FOR r in select distinct(id) from temp
loop
If r.id is null or r.id ='' Then
Insert into table_1 select