Code:
CREATE OR REPLACE FUNCTION public.f_customerlogininfo
(
varchar,
varchar,
varchar
)
RETURNS SETOF public.v_customerlogininfo AS'
declare
p_schm alias for $1;
p_contact alias for $2;
p_status alias for $3; /* all - regardless of the status
true - true status will be displayed
false - false status will be displayed
*/
v_boolstatus boolean;
begin
if (p_status = ''all'') then
select * from v_customerlogininfo
where contact = p_contact;
else
if (p_status = ''true'') then
v_boolstatus := true;
else
v_boolstatus := false;
end if;
select * from v_customerlogininfo
where contact = p_contact
and status = v_boolstatus;
end if;
end
'LANGUAGE 'plpgsql'
Code:
select f_customerlogininfo('public', '09045612378', 'all');
Comment