Hi ,
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 condotion.
I can write a if else conditon to build the query . But it will be diffrent queries.
like
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 dependng on the condition i add or dont add the where clause - I dont write a separate query)
Can the same be done inside a sybase store proc and how?
Any reply will be appreciated?
Regards
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 condotion.
I can write a if else conditon to build the query . But it will be diffrent queries.
like
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 dependng on the condition i add or dont add the where clause - I dont write a separate query)
Can the same be done inside a sybase store proc and how?
Any reply will be appreciated?
Regards