David-

I've thought of both dbms_sql and dummy conditions too.  Oracle Application reports 
use the dummy
conditions all the time.

I'm off to see if you can set cursor_sharing at the session level and not use bind 
params.

I'm assuming no one else has figured this out either due to the lack of response.

Ron Thomas
Hypercom, Inc
[EMAIL PROTECTED]
Each new user of a new system uncovers a new class of bugs. -- Kernighan


                                                                                       
                           
                      [EMAIL PROTECTED]                                                 
                           
                                               To:       [EMAIL PROTECTED]          
                           
                      09/20/02 01:28 AM        cc:                                     
                           
                      Please respond to        Subject:  RE: PL/SQL help               
                           
                      ORACLE-L                                                         
                           
                                                                                       
                           
                                                                                       
                           




Ron

We've run into this problem and haven't really found a satisfactory answer.
It sounds like a job for dbms_sql, but the docs say its slower than native
dynamic sql.  Has anyone tested this?  One other alternative I can think of
(but have never tried) is to use dummy conditions in the sql; something
like: -

c_sql := 'select col1 from atable where col2 = :1 and :2 is null and :3 is
null';

--
David Lord

> -----Original Message-----
> From: Ron Thomas [mailto:[EMAIL PROTECTED]]
> Sent: 19 September 2002 19:53
> To: Multiple recipients of list ORACLE-L
> Subject: PL/SQL help
>
>
>
> I am building a dynamic sql statement which will contain
> varying number of bind variables depending
> on user selection criteria.  As an example, the sql statement may be:
>
> c_sql := 'select col1 from  atable where col2 = :1' ;
>
> or it may be
>
> c_sql := 'select col1 from  atable where col2 = :1 and col2
> between :2 and :3' ;
>
> or it may be ... etc.  I am trying to avoid ugly code such as:
>
> IF case1 THEN
>   OPEN csr FOR c_sql USING var1 ;
> ELSIF case2 THEN
>   OPEN csr FOR c_sql USING var1, var2, var3 ;
> ELSIF .....
> END IF ;
>
> Once the sql statement is created, it will be opened/closed
> multiple times, so I want to use bind
> variables to avoid parsing.
>
> So I thought, hum, sounds like a job for EXECUTE IMMEDIATE,
> but in the various incarnations I tried,
> could not get it to work.  The FM have not been much help
> (still looking tho).
>
> What am I missing?
>
> Thanks,
> Ron Thomas
> Hypercom, Inc
> [EMAIL PROTECTED]
> Each new user of a new system uncovers a new class of bugs.
> -- Kernighan
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Ron Thomas
>   INET: [EMAIL PROTECTED]
>
> Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
> San Diego, California        -- Mailing list and web hosting services
> ---------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (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).
>


**********************************************************************
This message (including any attachments) is confidential and may be
legally privileged.  If you are not the intended recipient, you should
not disclose, copy or use any part of it - please delete all copies
immediately and notify the Hays Group Email Helpdesk at
[EMAIL PROTECTED]
Any information, statements or opinions contained in this message
(including any attachments) are given by the author.  They are not
given on behalf of Hays unless subsequently confirmed by an individual
other than the author who is duly authorised to represent Hays.

A member of the Hays plc group of companies.
Hays plc is registered in England and Wales number 2150950.
Registered Office Hays House Millmead Guildford Surrey GU2 4HJ.
**********************************************************************

--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Lord, David - CSG
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (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).




-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Ron Thomas
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (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).

Reply via email to