I have a requirement like this . I have some 10 conditions in the where clause . And if some arguments are null , then the condition is not to be included in the where condition.
I can write a if else condition to build the query . But it will be different queries.
If ( condition)
some sql query
else if ( some other condition)
some other sql .
Is it possible to build the query dynamically and execute the query in the end like I do in java ( where a single query does the job and depending on the condition I add or don't add the where clause - I don't write a separate query)
Can the same be done inside a Sybase store proc and how?
Any reply will be appreciated?