sorry, i resubmit to the list
On 7/18/07, Jaime Casanova <[EMAIL PROTECTED]> wrote:
On 7/18/07, Norm Garand <[EMAIL PROTECTED]> wrote:
> Thanks Jaime:
>
> I tried using the CASE function and it still didn't work.
>
> What I need to do is set a conditional, so that if the parameter is NULL,
then the this line is
> ignored completely and of course the opposite applies, if the value is
"something", then this line
> is included in the SELECT. I've just reworded and resubmitted my question and
of course, again, I
> didn't include the facts above. Thanks, for the response, anything is
appreciated.
>
ok, i will do your work...
CREATE OR REPLACE FUNCTION t(con_stock boolean)
RETURNS SETOF ttdinv001214 AS
$BODY$
select * from ttdinv001214
where substring(trim(t_item), 1, 3) = 'DPP'
and case $1 when true then t_stoc > 0 else 1 = 1 end;
$BODY$
LANGUAGE 'sql' VOLATILE;
note the "else 1=1" part, i could be used "else true" or something else
--
regards,
Jaime Casanova
"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
Richard Cook
--
Atentamente,
Jaime Casanova
"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
Richard Cook
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?
http://archives.postgresql.org