I have a system which stores messges in database (
just like out email messges ) and table having fileds
like sent-to , from , cc, bcc , new_indicator (y/n) ,
draft_indiacator , receive-date , ...
I have to write a proc to seach messages based on
different criterian like , all messages from xyz or all messages with cc string
..% or messages before this date , messages after this date ..blah blah
different combinations . I have primary key in table .
Can someone suggest me how to write an efficient
query here .
I want to supply all possible
parameters in one proc and but some / all of which may be null , If all are null
I return a refcursor with all the data in table else i have to filter
for not null paramters . I can put lots of nvl's here but
query becomes very inefficient .
Is it good idea to build a dynamic query based on
supplied parameter .
TIA,
BigP
|