At 2:15 PM +0530 12/7/06, Lloyd wrote:
Hi,
 I am generating queries dynamically from my program based on the input.
The primary part of the query is always
select a from mytable where (b=0) and
based on the user input I add more where clauses to my query like
select a from mytable where (b=0) and (x=10)
but in one case there in no where clause to add, so my final query
become
select a from mytable where (b=0) and
and this is a syntax error.
Is there any option to add a null clause after the 'and' ?
Thanks,
  Lloyd

A better solution is to use leading 'and' rather than trailing 'and', so you should start off with:

  select a from mytable where (b=0)

... which is already valid syntax, and only add a bunch of "and <condition>" when you actually have the "<condition>".

-- Darren Duncan

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to