> Couple problems that I can see. First, that test should be:
> IF $2 = ''tigris'' then
Thank you.
> Second, you'll need to add a "return;" line after the "END IF" for the
> cases where there is no match. In fact, you can just move the one from
> within the IF...END IF to outside it.
Ok, that explained an error I saw, but the function wasn't finished. This
is how the final result looks:
create or replace function get_dns2(varchar(40), varchar(40)) returns
setof holder as
'
declare
r holder%rowtype;
begin
IF ($2 = ''tigris'') then
for r in select \'Acc-Dns-Server-Pri\', op, value FROM radreply
where username = $1 and attribute =
\'Ascend-Client-Primary-DNS\' loop
return next r;
end loop;
for r in select \'Acc-Dns-Server-Sec\', op, value FROM radreply
where username = $1 and attribute =
\'Ascend-Client-Secondary-DNS\' loop
return next r;
end loop;
ELSE
for r in select Attribute, op, value FROM radreply
WHERE username = $1 loop
return next r;
end loop;
END IF;
return;
end
'
language 'plpgsql';
Thanks for the help!
Max!