On 7/17/07, Norm Garand <[EMAIL PROTECTED]> wrote:
In the WHERE portion of the SELECT statment, I'd like to insert the IF statement shown below. I've tried single and double quotes and the pipeline for concatenation, but nothing seems to work. Any suggestions or resolutions would be greatly appreciated. Please feel free to contact me directly.
use CASE baan=# create function t(con_stock boolean) returns setof ttdinv001214 as $$ baan$# select * from ttdinv001214 baan$# where substring(trim(t_item), 1, 3) = 'DPP' baan$# and case $1 when true then t_stoc > 0 else t_stoc = 0 end; baan$# $$ language sql; CREATE FUNCTION -- 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 ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match