hi all,
i have created a function. i got the problem. it doesn't show the out put if i put between condition. but it works perfectly when used only ">" condition only in the date
ie
create or repl...
...
..
to_char('||quot e_ident(date_ty pe)||',''yyyy-mm-dd'')
> '||from_date ;
....
....
....
the function is
CREATE OR REPLACE FUNCTION fnGetUser(date, date, text )
RETURNS SETOF user_report AS
$BODY$
declare
from_date alias for $1;
to_date alias for $2;
date_type alias for $3;
query refcursor;
r user_report%row type;
begin
open query for execute 'SELECT
id_no,
entry_dt,
name,
tel
from tbl_user
where to_char('||quot e_ident(date_ty pe)||',''yyyy-mm-dd'')
between '||from_date||' and ''||to_date;
loop
fetch query into r;
if not found then return ;
else
return next r;
end if;
end loop;
close query;
return;
end;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
also when i used "<"(lesser than) condition, it doesn't show the result as well.
so i want to know how to use the "between" condition to check the date.
TIA
i have created a function. i got the problem. it doesn't show the out put if i put between condition. but it works perfectly when used only ">" condition only in the date
ie
create or repl...
...
..
to_char('||quot e_ident(date_ty pe)||',''yyyy-mm-dd'')
> '||from_date ;
....
....
....
the function is
CREATE OR REPLACE FUNCTION fnGetUser(date, date, text )
RETURNS SETOF user_report AS
$BODY$
declare
from_date alias for $1;
to_date alias for $2;
date_type alias for $3;
query refcursor;
r user_report%row type;
begin
open query for execute 'SELECT
id_no,
entry_dt,
name,
tel
from tbl_user
where to_char('||quot e_ident(date_ty pe)||',''yyyy-mm-dd'')
between '||from_date||' and ''||to_date;
loop
fetch query into r;
if not found then return ;
else
return next r;
end if;
end loop;
close query;
return;
end;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
also when i used "<"(lesser than) condition, it doesn't show the result as well.
so i want to know how to use the "between" condition to check the date.
TIA
Comment