Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> effiecient query ?
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
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Big Planet
INET: bigplanet34_at_hotmail.com
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists --------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Fri Mar 15 2002 - 18:33:21 CST