Parsing an input parameter for the where clause or record select value

In my limited CR experience, I've always used a command database connection so that I can write my own SQL.  However, now I have to parse a  pipe delimited parameter to get my value for the where clause, so I'm selecting several tables and joining them through the Database Expert Links tab.  All works fine, but after doing that and then parsing the parameter with the below formula in the Select Expert, I notice that there is no where clause in the SQL query, and although the report eventually displays the proper values, it runs through thousands of records first.  Here is my Select Expert - Record formula:
StringVar array Parm1;
Parm1 := Split({?DATA_AREA}, "|");
{SO_ORDERS.CASE_ID} = Parm1[2]
If I change "Parm1[2]" on the last line to a valid Case ID, then there is a where clause in the SQL and the report generates immediately. 
It seems like the record select formula is applied AFTER all of the records (without a where clause) are searched when I use the parsed parameter value, but when I hard code a valid value, it places that into the where clause BEFORE the sql is executed.  Is there a way to get the parameter parsed first and then use that parsed value in the SQL where clause?
Thanks.
Bill

Yes crystal will run the query first to get 100% data and then applies record selection condition. To increase the performance you need to pass the where condition at the command level instead of report level. So you need to create a report using add command like this
select * from tablename where field={?Parameter}
{?Parameter} is a command level parameter.
Now insert this report as a subreport in another report which has no connection but has a parameter
{?DATA_AREA} and create a formula like this in the main report
Split({?DATA_AREA}, "|")[2]
Now right click on the subreport and go to change subreport links and add this formula from main report and link this to sub report parameter {?Parameter} without linking any database field from the subreport.
Now your subreport runs with the where clause to get the data.
Regards,
Raghavendra

Similar Messages

  • Values from a Multi-Select in the where clause of a Select statement

    I have a web page that solicits query parameters from the user.
    The selections that the user makes will populate the WHERE clause of a Select statement.
    One of the controls on the page is a multi-select control.
    When this page posts, I would like to execute a Select statement wherein the selected values from this control appear in the .. Column IN ( <list here> ) portion of the WHERE clause.
    This is an extremely common scenario, but I cannot seem to locate a how-to or message thread that addresses this specific case.
    I have an idea that it may involve dynamic SQL or Execute Immediate, but cannot seem to pin down the answer.
    Any help would be greatly appreciated!

    anonymous - As illustrated here: Re: Search on a typed in list of values
    Scott

  • Using if logic in the where clause of a select statement

    I have a select clause. And in the select clause there is a variable all_off_trt that can be 'Y' or 'N'.
    In the where clause I want to make it so that if a form variable is checked and all_off_trt is 'Y' then
    exclude it else if the form variable isn't checked then select it no matter what all_off_trt is.
    Is there any way to include either and if statement or a case statement within the where clause to acheive this? If not is there another way of doing it?
    Basically I am looking for a case statement like this
    case
    when all_off_trt = 'Y' and mail_para.code = 'Y' then false
    else true
    end
    Message was edited by:
    Tugnutt7

    Ok, so that really doesn't solve my problem. I have 3 different fields that I need to do that with. Each combining in a select statement to print an email list, as well as other thing limiting the where clause.
    This is currently what I have, tested and working 100%.
    cursor email_cur is
         select unique p.email,s.all_off_trt,s.all_deceased,s.no_enroll
    from participant p, trialcom t, ethics s
    where p.status='A'
    and p.surname=t.surname
    and p.initials=t.initials
    and s.trial_cd = t.tricom
    and s.centre = t.centre
    and p.email is not null
    and (t.centre in (select code from mail_parameters where user_name=user and mail_para='CENTRE')
    or 'XX' in (select code from mail_parameters where user_name=user and mail_para='CENTRE'))
    and (t.tricom in (select code from mail_parameters where user_name=user and mail_para='TRIAL')
    or 'XX' in (select code from mail_parameters where user_name=user and mail_para='TRIAL'))
    and (t.role in (select code from mail_parameters where user_name=user and mail_para='ROLE')
    or 'XX' in (select code from mail_parameters where user_name=user and mail_para='ROLE'))
    and (p.country in (select code from mail_parameters where user_name=user and mail_para='COUNTRY')
    or 'XX' in (select code from mail_parameters where user_name=user and mail_para='COUNTRY'))
    and (t.represent in (select code from mail_parameters where user_name=user and mail_para='REPRESENT')
    or 'XX' in (select code from mail_parameters where user_name=user and mail_para='REPRESENT'));
    This is in a program unit that runs when a button is clicked. At the end of that I need to add on the 3 case statements that help further narrow down the selection of emails to be printed. Then it prints the emails selected from this statement into a file. So it has to be done right in the select statement. The three table variables are the all_off_trt, all_deceased, and no_enroll. The form has 3 checkboxes. One for each, that when checked (giving the variable associated with the checkboxes a value of 'Y') excludes all emails that have a 'Y' in the coresponding table variable.

  • Re: [iPlanet-JATO] How to make an OR in the WHERE clause of a SELECT

    Harry,
    If you get a reference to your model, you can set the
    whereClauseOverride with exactly the string you want to use. Keep in
    mind that you are dealing with a the raw SQL where clause, therefore,
    you must use the actual table column names and not the model's logical
    field names as they could be different.
    QueryModelBase queryModel = (QueryModelBase)getModel(PersonModel.class);
    // you must add the "WHERE" as well
    String whereClause = "WHERE firstName LIKE '%max' OR lastName LIKE '%max%'";
    queryModel.setWhereClauseOverride(whereClause);
    Keep in mind that this will override all where criteria: static and
    dynamic where criteria. Static criteria can be declared in your model
    class: setStaticWhereCriteriaString(STATIC_WHERE_CRITERIA).
    You could optionally get the entire SQL statement and replace the
    __WHERE__ token yourself with a string replace technique. In fact, if
    you want to add an ORDER BY, you will need to get the SQL and append to
    the end.
    queryModel.getSelectSQL();
    Hope this helps. Let me know if you have any questions
    craig
    hlamer wrote:
    Hi,
    if I add criterias to my model
    with "SelectQueryModel.addUserWhereCriterion()" they will be concated
    with AND.
    How can I add a criteria with OR?
    I want something like:
    SELECT personId, firstName, lastName
    FROM Person
    WHERE firstName LIKE "%max"
    OR lastName LIKE "%max%"
    Thanks.
    Harry
    For more information about JATO, including download information, please visit:
    http://developer.iplanet.com/tech/appserver/framework/index.jsp

    Rewritten your query wuth tags as well
    &#123;code&#125;select  "P_CIRCUITS_FIBER"."PORTS_1",
            "P_CIRCUITS_FIBER"."PORTS_2",
            CASE WHEN CPORT.ID = (select REGEXP_SUBSTR(ports_1,'[^,]+',1,1) from p_circuits_fiber)
                 THEN "CPORT"."PORT_NO" END PORT_NO_1,
            CASE WHEN CPORT.ID = (select REGEXP_SUBSTR(ports_2,'[^,]+',1,1) from p_circuits_fiber)
                 THEN "CPORT"."PORT_NO" END PORT_NO_2
    from    "CPORT",
            "P_CIRCUITS_FIBER"
    where   p_circuits_fiber.fiber_id = :P4000_CIRCUIT_NO
    and     (select REGEXP_SUBSTR(ports_1,'[^,]+',1,1) from p_circuits_fiber) = "CPORT"."PORT_NO"  "PORT_NO_1"
    and     (select REGEXP_SUBSTR(ports_2,'[^,]+',1,1) from p_circuits_fiber) = "CPORT"."PORT_NO"  "PORT_NO_2"&#123;code&#125;
    Now we can see two columns references which should not be there.
    I even not sure to understand why those two conditions are in the WHERE clause. But for sure, CPORT.ID cannot be equal to two values unless they are same.
    Is there only one row in p_circuits_fiber ?
    Nicolas.

  • How to pass the parameter in the where clause of the select statement

    Hi All,
    Iam getting one of the value from the Input otd and using this value i need to query one of the tables in oracle database and selected the table using the oracle eway otd like shown below .
    otdRISKBLOCK_1.getRISKBLOCK().select() .
    where clause in side the select takes a string parameter as Iam getting the string parameter from the input otd and passing this to where clause by creating a string literal after deployment it is giving an error saying "ORA-00920: invalid relational operator".
    can any one throw some input on this .
    Thanks in Advance
    Srikanth

    You will see this error if the search condition was entered with an invalid or missing relational operator.
    You need to include a valid relational operator such as
      =, !=, ^=, <>, >, <, >=, <=, ALL, ANY, [NOT] BETWEEN, EXISTS, [NOT] IN, IS [NOT] NULL, or [NOT] LIKE in the condition. in the sql statement.
    Can you throw some more light on how are you designing your project?

  • Add a parameter in the where clause in mdx

    I need check for a value from a Dimension and filter in the MDX Query as below...
    select {[Measures].[AMOUNT]} ON COLUMNS,
      {([Organisation Structure].[ALL Organisation Structures], [Account Detail].[ALL Account Details], [Monthly Calendar].[ALL Monthly Calendars])} ON ROWS
    from [Annu]
    where Filter([useridentity].[All Users].Children, (InStr([useridentity].[All Users].CurrentMember.Properties("Caption"), "14,1") > 0.0))
    From the above query, we are checking if the ALL Users value is 14,1 then it is filtering but I want to pass the value as parameter something like where Filter([useridentity].[All Users].Children, (InStr([useridentity].[All Users].CurrentMember.Properties("Caption"),
    @value) > 0.0)) and @value should be assigned the values from one of the dimensional attributes..
    Thanks in advance...
    RamarajuC

    Hi Ramaraju ,
    I am adding an example on AW to make it easier to solve your problem .. Please notice the @datasrc you need to insert, all the quote marks and the strtomember function in case you need to ..
    EXEC sp_addlinkedserver
    @server='OLAP_LINKED',
    @srvproduct='',
    @provider='MSOLAP.4', -- For SQLServer 2008 R2
    @datasrc='YourServarName', -- Can be localhost if you're working on the server
    @catalog='Adventure Works DW 2008R2 SE'
    declare @EPN varchar(100)
    declare @sql varchar(2000)
    set @EPN = '[Ship Date].[Fiscal].[Fiscal Year].&[2008]'
    set @sql = 'SELECT * FROM OPENQUERY(OLAP_LINKED,''Select {[Measures].[Internet Sales Amount] } on columns, {[Product].[Product Categories].[All Products]} on rows from [Adventure Works] where STRTOMEMBER('''''+@EPN+''''') '')'
    EXEC (@sql)
    I hope we are on our way toward the solution :)
    Regards, David .

  • UPDATE using a second table for the Where Clause

    Hi There,
    Hoep someone can help me!
    I am attempting to update a field in Tbl.1 to a known value. However, i want to use another table to specify WHICH records to update.
    in this case i want to use table early_provider to obtain the value 'HCR' then pass that to the UPDATE clause in order to SET early_provisions.type_name = 'HOMC'
    I hope this makes sense.
    UPDATE EARLY_PROVISIONS eps
    SET TYPE_NAME = (SELECT *
    FROM EARLY_PROVIDER ep
    WHERE PROVIDER_TYPE = 'HCR'
    WHERE EP.PROVIDER_ID = EPS.PROVIDER_ID);
    I need to be able to include the field value 'HOMC in this statement but am not sure how, or if i am barking up the wrong tree.
    Much appreciated in advance
    PFG

    PFGMcAvoy wrote:
    Karthick_Arp
    Thanks. this seems to only update 15 rows of which already exist in the table early_provisions and filed type_name!
    I should be selecting about 200 recordsd from early_provider that have the provider_type = 'HCR'
    ??I don't know your data. So i cant answer that. But for what you asked i think thats the correct UPDATE statement. So i think you have to investigate your data to find what is going on.

  • Using ROWID in the WHERE clause of a SELECT statement

    hi all,
    my team is trying to select a value from a table using the rowid as the selection criterion
    e.g. select column_name from table_name where rowid > 'AAA112BBBCCC12A'
    this query does not appear to return accurate results e.g. it return rows instead of two. my questions are:
    1. is this a legitimate approach?
    2. should we convert the row id to varchar2? if so how should this be done?
    thanks!

    SQL> select rowid,ename
      2  from emp;
    ROWID              ENAME
    AAAs8KAA+AAAVXCAAA KING
    AAAs8KAA+AAAVXCAAB BLAKE
    AAAs8KAA+AAAVXCAAC CLARK
    AAAs8KAA+AAAVXCAAD JONES
    AAAs8KAA+AAAVXCAAE SCOTT
    AAAs8KAA+AAAVXCAAF FORD
    AAAs8KAA+AAAVXCAAG SMITH
    AAAs8KAA+AAAVXCAAH ALLEN
    AAAs8KAA+AAAVXCAAI WARD
    AAAs8KAA+AAAVXCAAJ MARTIN
    AAAs8KAA+AAAVXCAAK TURNER
    AAAs8KAA+AAAVXCAAL ADAMS
    AAAs8KAA+AAAVXCAAM JAMES
    AAAs8KAA+AAAVXCAAN MILLER
    AAAs8KAA+AAAVXCAAO erwer
    15 rows selected.
    SQL> select ename from emp where rowid = 'AAAs8KAA+AAAVXCAAH';
    ENAME
    ALLEN
    SQL> select ename from emp where rowid > 'AAAs8KAA+AAAVXCAAH';
    ENAME
    WARD
    MARTIN
    TURNER
    ADAMS
    JAMES
    MILLER
    erwer
    7 rows selected.1) using rowid to access a record is the quickest way so it is legitimate
    however using > has no real purpose as you point out you cannot get any meaningful results returned.
    2) No real need to convert however beware storing values in tables as Oracle does not guarantee to preserve the format in different versions so upgrading from 9i to 10g would invalidate your data.

  • How to construct the where clause for a nested xml target file

    Post Author: jlpete72
    CA Forum: Data Integration
    I'm having some problems getting the desired results creating a multi-level nested xml file.  Specifically, it does not seem that the where clause in the child schemas respects values from parent schemas.  I'm sure I'm constructing something incorrectly, but am running out of ideas. 
    I am working with the classic company/order/line hierarchy and there are three levels of output schemas in my target xml file, one for company, order header and order line information.
    For testing, I have hardcoded a restriction at the order header line to deal with only one order.  But unless I hardcode values into the where clause at the order line level of the schema, all values are returned for orders belonging to the company defined in the company level.
    I'm trying a where clause at the order line level similar to:
    order_line.customer = order_header.customer and order_line.order_num = order_header.order_num
    If the customer has more than one order in the data file, then all orders for that customer are placed in the detail for the order header.  Only if I hard code the order number in the where clause do I get only the lines for the order specified in the header section.  Not very practical. 
    What am I missing?

    An External Parsed Entity could be used to reference a schema.
    In your DTD:
    <!ENTITY datamodules SYSTEM "file:///c:/Datamodules/Datamodules.xsd">
    Refer the external entity in xml document:
    <datamodules>&datamodules;</datamodules>

  • Time's error with a metric for DashBoard in the WHERE Clause - @Prompt

    Hello,
    I have a problem with a measure in Universe. In the WHERE clause I have the typical @Prompt to interact with DashBoard:
    "Fact.Time_Key between @Prompt('BEGIN_DATE','D',,mono,free) And @Prompt('END_DATE','D',,mono,free)" *
    *Fact.Time_Key is a Date Field
    I check many options to solve the problem, which is: "The conversion of char data type to smalldatetime data type result in an out-of-range smalldatetime value." For example I saw many forums, I check the regional settings with IT and I also change the prm file that my universe's connection use but it still doesn't work.
    So I believe that the date format of my field (Fact.Time_Key) is different to @Prompt date format
    Any Suggestion?
    Regards
    Romá

    Hi Roman,
    I am not sure but I thought there was also a 'BEGIN_DATETIME' option
    Regards
    Alan

  • Error witth a parameter in a WHERE clause

    Hi experts I have the following code from an abap programa
    I have done a conection with Sql
    And I want to do a SELECT.. WHERE one value from a column in the table is the same that the ones I write like an input parameter... but when is done the comparation
    appears the 207 error from Sql I don't know how to fix it
    Please help me ¡¡
    REPORT  Z_CONEXBD_ARACELI2.
    DATA: c_copi TYPE FLIGHTS-COPILOT.
    DATA: c_pilot TYPE FLIGHTS-PILOT.
    DATA: c_id TYPE FLIGHTS-ID.
    DATA: con_name LIKE dbcon-con_name VALUE 'CON'.
    *Here is the  declaration of the parameter
    PARAMETERS: P_PILOT LIKE FLIGHTS-PILOT.
    EXEC SQL.
      SET CONNECTION :con_name
    ENDEXEC.
    IF sy-subrc <> 0.
      Connection not yet opened.
      EXEC SQL.
        CONNECT TO :con_name
      ENDEXEC.
      endif.
    Do something on connection 'con_name'
    EXEC SQL.
    select PILOT, COPILOT, ID
    into :c_pilot, :c_copi, :c_id
    from FLIGHTS
    *Here is the where clause comparing with the parameter P_PILOT
    Where PILOT = P_PILOT
    ENDEXEC.
    *Commit the changes on 'con_name'
    EXEC SQL.
    COMMIT
    ENDEXEC.
    EXEC SQL.
    SET CONNECTION :con_name
    ENDEXEC.
    EXEC SQL.
    DISCONNECT :con_name
    ENDEXEC.
    WRITE: /5 'CATALOGO DE VUELOS'.
    WRITE: /5 :c_copi, :c_pilot, :c_id.
    Thank you very much
    Edited by: ARACELI GONZALEZ on Jun 9, 2008 3:51 AM

    Hi , I think this is a post for abap programmers.
    Antonio.

  • JSP, Data Web Bean, BC4J: Setting the where clause of a View Object at run time

    Hi,
    I am trying to develop a data web bean in which the where clause of a View Object will be set at run time and the results of the query then displayed.
    My BC4J components are located in one project while the coding for the data web bean is in another project. I used the following code bu t it does not work. Could you please let me know what I am doing wrong?
    public void populateOSTable(int P_EmpId)
    String m_whereString = "EmpView.EMP_ID = " + P_EmpId;
    String m_OrderBy = "EmpView.EMP_NAME";
    oracle.jbo.ApplicationModule appModule = null;
    ViewObject vo = appModule.findApplicationModule("EMPBC.EMPAppModule").findViewObject("EMPBC.EMPView");
    vo.setWhereClause(m_whereString);
    vo.setOrderByClause(m_OrderBy);
    vo.executeQuery();
    vo.next();
    String empName numAttrs = vo.getAttribute(EmpName);
    System.out.println(empName);
    Thanks.

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by JDev Team (Laura):
    Here is how I have usually done mine:
    1. In the JSP, use a RowsetNavigator bean to set the where clause and execute the query.
    2. Use a custom web bean to process the results of the query (print to HTML).
    for example:
    <jsp:useBean class="oracle.jbo.html.databeans.RowsetNavigator" id="rsn" scope="request" >
    <%
    // get the parameter from the find form
    String p = request.getParameter("p");
    String s = request.getParameter("s");
    // store the information for reference later
    session.putValue("p", p);
    session.putValue("s", s);
    // initialize the app module and view object
    rsn.initialize(application,session, request,response,out,"wt_bc_WT_bcModule.wtjoinView");
    // set the where clause string
    String theclause = "presname = '" + p + "' AND slideno=" + s;
    // set the where clause for the VO
    rsn.getRowSet().getViewObject().setWhereClause(theclause);
    rsn.getRowSet().getViewObject().executeQuery();
    rsn.getRowSet().first();
    %>
    </jsp:useBean>
    <jsp:useBean class="wt_bc.walkthruBean" id="wtb" scope="request" >
    <%
    // initialize the app module and VO
    wtb.initialize(application,session, request,response,out,"wt_bc_WT_bcModule.wtjoinView");
    wtb.render();
    %>
    In this case, the render method of my custom web bean mostly gets some session variables, and prints various content depending on the session variable values.
    Hope this helps.
    </jsp:useBean><HR></BLOCKQUOTE>
    Laura can you give the code of your walkthru bean? i wna't to initialize a viewobject, set the where clause and give that viewobject back to initialize my navigatorbar.
    Nathalie
    null

  • How do I modify the WHERE clause in my SQL query?

    This seems like such a straight-forward part of the report design, but I'm fairly new to Crystal Reports and I only have experience with modifying reports someone else has already written.  In this particular case, I just need to modify the WHERE clause of the SQL query.  I can select Show SQL Query and see what statement is being used to select data, but I can't find where to modify it since it's grayed out.  I see how to change the selection criteria, parameters, grouping, etc...just not the WHERE clause.  The report is linked to a database used for reporting with a table created and populated by a stored procedure.  I don't need to modify the stored procedure because the data I want to filter by is currently in the table--I just don't know how to filter by what I need.  Here's part of the query:
    SELECT "rpt_dist"."startdate", "rpt_dist"."transtype", "rpt_dist"."laborcode", "rpt_dist"."crewid", "rpt_dist"."regularhrs" FROM   "Reporting"."dbo"."rpt_dist" "rpt_dist"
    WHERE  (rpt_dist."transtype" <> 'WORK' AND rpt_dist."transtype" <> 'WMATL') AND rpt_dist."laborcode" LIKE 'S%' AND (rpt_dist."crewid" = 'HOUS' OR rpt_dist."crewid" = 'HOUS2' ...
    I would like to add another crewid to the WHERE clause.  Thanks for any input.

    1.Open the report in the crystal designer
    2.Go to the field explorer(if hidden go to view menu->field explorer)
    3.Rt. click on the database fields->choose database expert
    4.Now you will see 2 columns-Available DataSource  and Selected Tables
    5.Rt. click on the object(ex.command) available in the Selected Tables column->Choose Edit command
    6.A new Modify Command window will appear,here you can edit your SQL Query
    I get to step 4 and I see the two columns including my database and the report table, but there is no command object available.  If I right-click on my table, I can just view the Properties. ??
    As for the other tip to modify the record selection:  I don't see anywhere the other crewid values are set and if I add the one I'm missing, it doesn't modify the existing SQL Query and when I preview the report it throws off the results so that no data displays??
    I'm using Crystal Reports 11.5 if that makes a difference.  Thanks again.

  • Query in the where clause is not allowed

    Hi all,
    I have a table m_vehicle that stores 1 or more than 1 rows of data for each person. But the partner's schema requires that 0 or 1 vehicle license plate data be sent with the xml file. I have the following nested select statement inside a bigger one and it does not work,
    select xmlelement("VehicleLicensePlate",
         (case when mv.lic_plate_state is not null then
              xmlelement("PlateState", mv.lic_plate_state)
         end), -- end of plate state
         (case when mv.lic_plate_no is not null then
              xmlelement("PlateNumber", xmlelement("ID", mv.lic_plate_no))
         end),
         (case when mv.lic_plate_year is not null then
              xmlelement("PlateExpiryYear", mv.lic_plate_year)                                                  
         end)
         ).extract('/*')
    from m_vehicle mv where mv.mni_id = 1083650
    and mv.seq_no = (select max(mv2.seq_no) from m_vehicle mv2
    where mv2.mni_id = mv.mni_id) and mv.lic_plate_no is not null
    But it works when I run it alone and gets the latest row for the person. It does not work either if I join this table with other tables. My root element select is from dual because I have to supply lots of SOAP and other artifacts in the xml. Is it because I have this root select from dual that the query in the where clause does not work? How do I make it work so that I get 0 or one row only from the table? My solution was to write a function that returns each part of the license plate data using dymanic sql and call it in the xmlelement function. It works but I would like to use plain sql instead.
    Thanks.
    Ben

    By the way, the error I get is this,
    ERROR:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00216: invalid character 3 (0x3)
    Error at line 1
    ORA-06512: at "SYS.XMLTYPE", line 111
    Ben

  • Function-based Index and an OR-condition in the WHERE-clause

    We have some problems with functin-based indexes and
    the or-condition in a where-clause.
    (We use oracle 8i (8.1.7))
    create table TPERSON(ID number(10),NAME varchar2(20),...);
    create index I_NORMAL_TPERSON_NAME on TPERSON(NAME);
    create index I_FUNCTION_TPERSON_NAME on TPERSON(UPPER(NAME));
    The following two statements run very fast on a large table
    and the execution-plan asure the usage of the indexes
    (-while the session is appropriate configured and the table is analyzed):
    1)     select count(ID) FROM TPERSON where upper(NAME) like 'MIL%';
    2)     select count(ID) from TPERSON where NAME like 'Mil%' or (3=5);
    In particular we see that a normal index is used while the where-clause contains
    an OR-CONDITION.
    But if we try the similarly select-statement
    3)     select count(ID) FROM TPERSON where upper(NAME) like 'MIL%' or (3=5);
    the CBO will not use the function-index.
    (This behavior we only expect with views but not with indexes.)
    We ask for an advice like an hint, which enable the CBO-usage
    of function-based indexes in connection with OR.
    This problem seems to be artificial because it contains this dummy logic:
         or (3=5).
    This steams from an prepared statement, where this kind of boolean
    flag reduce the amount of different select-statements needed for
    covering the hole business-logic, while using bind-variables for the
    concrete query-parameters.
    A more realistic (still boild down) version of our prepared select-statement run in
    SQL Plus:
    define x_name = 'MIL%';
    define x_firstname = '';
    select * FROM TPERSON
    where (upper(NAME) like '&x_name' or ( '&x_name' = ''))
    and (upper(FIRSTNAME) like '&x_firstname' or ('&x_firstname' = ''))
    and ...;
    In particular we dont refernce the tablecolumn , but the QUERY-Parameter
    yield the second boolean value in the or-condition.
    The problem is that this condition ('&x_name' = '') dont use any index.
    thanks a lot for spending your time with this problem

    Try
    SELECT /*+ RULE */
    as your hint. I don't have the book with me, but this last weekend I read a section about your very problem. The book was a Oracle Press gold cover about Oracle 8i Performance tuning. If you e-mail me I can quote you the chapter when I get home Friday.

Maybe you are looking for

  • TM on 2 differnt usb hard drives

    I thought I had come up with a great back up plan: 1) I have one usb hard drive at work where I run TM every hour. 2) Once a week take my computer home, connect it to another usb hard drive and change TM preferences to run on that disk. 3) When I get

  • Who can tell me about his forms2adf experience?

    Hello! Why is forms2adf not part of the evaluation version? This makes no sense to me. It is hard for me to convince my chef, to buy a software and I can't even tell him, if we will need it or not. All the reports and demos on forms2adf look very nic

  • "Audio File "Recording#27.aif" not found" Error Message- Please HELP!

    Hi Everyone- I was opening a podcast today to finish editing it and I got this error message, "Audio File "Recording#27.aif" Not Found" - and, naturally, when I opened the project, half of a phone interview was missing (or, rather, it shows up as pur

  • Slow query due to large table and full table scan

    Hi, We have a large Oracle database, v 10g. Two of the tables in the database have over one million rows. We have a few queries which take a lot of time to execute. Not always though, it that seems when load is high the queries tend to take much long

  • Remove Publish my free/busy information option

    Is there a way to remove the "Publish my free/busy information" option from the options page in webaccess ? Using Webaccess 802HP1 /Tobias