Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Dynamic Search Conditions using PL SQL

Re: Dynamic Search Conditions using PL SQL

From: Valentin Minzatu <valentinminzatu_at_yahoo.com>
Date: Tue, 12 Jun 2007 15:25:07 -0000
Message-ID: <1181661907.861770.227670@j4g2000prf.googlegroups.com>


On Jun 12, 3:57 am, Janaka Perera <janaka..._at_gmail.com> wrote:
> I want to create a stored procedure which has a dynamic "Where"
> condition. I don't want to create a dynamic query string in the
> runtime and execute it because then it will pass the SQL on the
> runtime which will reduce the performance. Therefore I need to compile
> the SQL's SELECT and JOIN statements and append the WHERE clause at
> runtime. Is there a way to do something like that using PL/SQL. Thanks
> in advance.
>
> The following code snippet describes the scenario.
>
> CREATE OR REPLACE Procedure GetCustomers (filterCriteria IN varchar2)
> IS
>
> -- filterCriteria " where customer_id = 11"
> BEGIN
>
> Open result For SELECT CUSTOMER_ID FROM C_CUSTOMER ||
> filterCriteria;
>
> ........................
> ............

Have you looked at VPD? It may help you as it dynamically appends where clause(s). Received on Tue Jun 12 2007 - 10:25:07 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US