Problem executing a query with AND and OR statements

I have no idea what is the correct way to implement this part. If the user enters more than one keyword. Then I need to check it using the clause WHERE and AND in my sql statements. Obviously, the attempt I make below does not work. Here is the code, I appreciate the help:
import java.io.*;
import java.sql.*;
import java.util.*;
public class simpleTest {
    public static void main(String[] args) throws IOException {
            int rows = 0;
            int count = 0;
            int i = 0;
            String[] wordList = new String[50];
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        try {
            Class.forName("com.mysql.jdbc.Driver").newInstance();
        } catch (Exception ex) {System.out.println("No driver");}
     try {
            Connection conn =
          DriverManager.getConnection("jdbc:mysql://localhost/cop4610webs",
          "root", "anatoly");
            // Do something with the Connection
            System.out.println("Enter a string: ");           
            String word = reader.readLine();
            StringTokenizer words = new StringTokenizer(word);
            while(words.hasMoreTokens())
               wordList[count++] = words.nextToken();
            System.out.println("Enter the logic");
            String logic = reader.readLine();
            Statement stmt = null;
         ResultSet rs = null;
             stmt = conn.createStatement();
            if(logic.equalsIgnoreCase("exact"))
             rs = stmt.executeQuery("SELECT pageName FROM pages WHERE pageContent ='"+word+"'");
             ResultSetMetaData metaData = rs.getMetaData();
             System.out.println("Results of SELECT");
            rs.last(); //move to last row
            rows = rs.getRow(); //check rows returned
            System.out.println(rows);
            rs.beforeFirst(); //move back to beginning
            if(rows != 0)
            rs.next();
             System.out.println(rs.getObject(1) );
            while ( rs.next() ) {
               System.out.println(rs.getObject(1) );
            else
                  if(logic.equalsIgnoreCase("all"))
           while(i < count)
             rs = stmt.executeQuery("SELECT pageName FROM pages WHERE pageContent ='"+wordList[i]+"'" + "AND" +"'"+wordList[i+1]+"'");
           i++;
             System.out.println("Results of SELECT");
            rs.last(); //move to last row
            rows = rs.getRow(); //check rows returned
            System.out.println(rows);
            rs.beforeFirst(); //move back to beginning
            if(rows != 0)
            rs.next();
             System.out.println(rs.getObject(1) );
            while ( rs.next() ) {
               System.out.println(rs.getObject(1) );
            rs.close();
             } catch (SQLException ex) { // handle any errors
            System.out.println("SQLException: " + ex.getMessage());
            System.out.println("SQLState: " + ex.getSQLState());
            System.out.println("VendorError: " + ex.getErrorCode());
}

rs = stmt.executeQuery("SELECT pageName FROM pages WHERE pageContent ='"+wordList[i]+"'" + "AND" +"'"+wordList[i+1]+"'");should be:
rs = stmt.executeQuery("SELECT pageName FROM pages WHERE pageContent ='"+wordList[i]+"'" + " AND " +"'"+wordList[i+1]+"'");(spaces around the "and")

Similar Messages

  • Wrong result for query with like and %

    I have a strange problem with query with like and %.
    When I run this script:
    ALTER SESSION SET NLS_SORT = 'BINARY_CI';
    ALTER SESSION SET NLS_COMP = 'LINGUISTIC';
    -- SELECT * FROM NLS_SESSION_PARAMETERS;
    -- drop table test1;
    CREATE TABLE TEST1(K1 NVARCHAR2(80));
    INSERT INTO TEST1 VALUES ('gsdk');
    INSERT INTO TEST1 VALUES ('ąxyz');
    INSERT INTO TEST1 VALUES ('ŁFa');
    INSERT INTO TEST1 VALUES ('ła');
    INSERT INTO TEST1 VALUES ('Śab');
    INSERT INTO TEST1 VALUES ('Śrrrb');
    commit;
    select * from TEST1 where k1 like N'Ł%';
    I get this:
    K1
    ŁFa
    ła
    Śab <- WRONG
    Śrrrb <- WRONG
    4 rows selected
    When i change datatype to varchar2 this code work correct.
    Is this a bug or what ?
    The execution plan:
    PLAN_TABLE_OUTPUT
    SQL_ID d3d64aupz4bb5, child number 2
    select * from TEST1 where k1 like N'Ł%'
    Plan hash value: 4122059633
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | | | 2 (100)| |
    |* 1 | TABLE ACCESS FULL| TEST1 | 1 | 82 | 2 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    1 - filter((NLSSORT("K1",'nls_sort=''BINARY_CI''')>=HEXTORAW('014200'
    ) AND NLSSORT("K1",'nls_sort=''BINARY_CI''')<HEXTORAW('01610100') ))
    Note
    - dynamic sampling used for this statement (level=2)

    DATABASE NLS CONFIGURATION:
    NLS_CHARACTERSET AL32UTF8
    NLS_NCHAR_CHARACTERSET     AL16UTF16
    NLS_COMP     BINARY
    NLS_SORT     BINARY
    Oracle version 11.2.0.2.0

  • Need complex query  with joins and AGGREGATE  functions.

    Hello Everyone ;
    Good Morning to all ;
    I have 3 tables with 2 lakhs record. I need to check query performance.. How CBO rewrites my query in materialized view ?
    I want to make complex join with AGGREGATE FUNCTION.
    my table details
    SQL> select from tab;*
    TNAME TABTYPE CLUSTERID
    DEPT TABLE
    PAYROLL TABLE
    EMP TABLE
    SQL> desc emp
    Name
    EID
    ENAME
    EDOB
    EGENDER
    EQUAL
    EGRADUATION
    EDESIGNATION
    ELEVEL
    EDOMAIN_ID
    EMOB_NO
    SQL> desc dept
    Name
    EID
    DNAME
    DMANAGER
    DCONTACT_NO
    DPROJ_NAME
    SQL> desc payroll
    Name
    EID
    PF_NO
    SAL_ACC_NO
    SALARY
    BONUS
    I want to make  complex query  with joins and AGGREGATE  functions.
    Dept names are : IT , ITES , Accounts , Mgmt , Hr
    GRADUATIONS are : Engineering , Arts , Accounts , business_applications
    I want to select records who are working in IT and ITES and graduation should be "Engineering"
    salary > 20000 and < = 22800 and bonus > 1000 and <= 1999 with count for males and females Separately ;
    Please help me to make a such complex query with joins ..
    Thanks in advance ..
    Edited by: 969352 on May 25, 2013 11:34 AM

    969352 wrote:
    why do you avoid providing requested & NEEDED details?I do NOT understand what do you expect ?
    My Goal is :
    1. When executing my own query i need to check expalin plan.please proceed to do so
    http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_9010.htm#SQLRF01601
    2. IF i enable query rewrite option .. i want to check explain plan ( how optimizer rewrites my query ) ? please proceed to do so
    http://docs.oracle.com/cd/E11882_01/server.112/e16638/ex_plan.htm#PFGRF009
    3. My only aim is QUERY PERFORMANCE with QUERY REWRITE clause in materialized view.It is an admirable goal.
    Best Wishes on your quest for performance improvements.

  • Sql query with conditions and calculations???

    Hi,
    how I can build a query with conditions and calculations?
    E.g. I've got this table
    Start          | End     |     Working Place     |     Mandatory
    01-JAN-13 | 11-JAN-13 |     Office           |          1
    14-JAN-13 | 25-JAN-13 |     Home Office      |     0
    04-MRZ-13| 15-MRZ-13 |     Office           |          0
    11-FEB-13 | 22-FEB-13 |     Office           |          1
    Now if column working place=Office and column mandatory=0
    the new column "price" has to calculate: (End-Start)* $25.00
    and if working place=Office and column mandatory=1
    the "price" column has to calculate: (End-Start)* $20.60
    else $0.00
    I tried it with the case statement but I didn't know how
    to calculate my values and display it to the virtual column "price".
    Something like
    case
    when Working_Place = 'Office' and Mandatory=1
         then ...
    else '0.00'
    end as PRICE
    Or is it not possible?
    Edited by: DB2000 on 12.03.2013 05:09

    Use CASE:
    select  start_dt,
            end_dt,
            working_place,
            mandatory,
            case
              when working_place = 'Office' and mandatory = 0 then (end_dt - start_dt) * 25
              when working_place = 'Office' and mandatory = 1 then (end_dt - start_dt) * 20.60
              else 0
            end price
      from  tbl
    START_DT  END_DT    WORKING_PLA  MANDATORY      PRICE
    01-JAN-13 11-JAN-13 Office               1        206
    14-JAN-13 25-JAN-13 Home Office          0          0
    04-MAR-13 15-MAR-13 Office               0        275
    11-FEB-13 22-FEB-13 Office               1      226.6
    SQL> SY.

  • CAML Query with 10 AND conditions

    Hello,
    I need some help with a CAML query. This particular query needs to have 10 AND conditions. Quite frankly, with all the nesting it is driving me a little nuts:
    What I have is:
    <Query>
    <Where>
    <And>
    <And>
    <And>
    <And>
    <And>
    <And>
    <And>
    <And>
    <And>
    <Eq><FieldRef Name='Column1' LookupId='TRUE' /><Value Type='Text'>10341</Value></Eq>
    <Eq><FieldRef Name='Column2' LookupId='TRUE' /><Value Type='Text'>9539</Value></Eq>
    </And>
    <Eq><FieldRef Name='Column3' LookupId='TRUE' /><Value Type='Text'>183</Value></Eq>
    </And>
    <Eq><FieldRef Name='Column4' LookupId='TRUE' /><Value Type='Text'>35</Value></Eq>
    </And>
    <IsNull><FieldRef Name='Column5' /></IsNull>
    </And>
    <Eq><FieldRef Name='Column6' LookupId='TRUE' /><Value Type='Text'>4387</Value></Eq>
    </And>
    <Eq><FieldRef Name='Column7' LookupId='TRUE' /><Value Type='Text'>4204</Value></Eq>
    </And>
    <Eq><FieldRef Name='Column8' LookupId='TRUE' /><Value Type='Text'>36</Value></Eq>
    </And>
    <Eq><FieldRef Name='Column9' LookupId='TRUE' /><Value Type='Text'>213</Value></Eq>
    </And>
    <IsNull><FieldRef Name='Column10' /></IsNull>
    </And>
    </Where>
    </Query>
    I have added this into my ItemAdding Event Receiver as it will basically do a check for duplicate items based on the 10 columns. 
    If anyone can help guide me in this, it would be much appreciated. I have been using a CAML Query Builder to help.

    http://webcache.googleusercontent.com/search?q=cache:xji7jOxa5_EJ:aasai-sharepoint.blogspot.com/2013/02/caml-query-with-multiple-conditions.html+&cd=3&hl=en&ct=clnk&gl=in
    http://stackoverflow.com/questions/6203821/caml-query-with-nested-ands-and-ors-for-multiple-fields
    Since you are not allowed to put more than two conditions in one condition group (And | Or) you have to create an extra nested group (MSDN). The expression
    A AND B AND C looks like this:
    <And>
    A
    <And>
    B
    C
    </And>
    </And>
    Your SQL like sample translated to CAML (hopefully with matching XML tags ;) ):
    <Where>
    <And>
    <Or>
    <Eq>
    <FieldRef Name='FirstName' />
    <Value Type='Text'>John</Value>
    </Eq>
    <Or>
    <Eq>
    <FieldRef Name='LastName' />
    <Value Type='Text'>John</Value>
    </Eq>
    <Eq>
    <FieldRef Name='Profile' />
    <Value Type='Text'>John</Value>
    </Eq>
    </Or>
    </Or>
    <And>
    <Or>
    <Eq>
    <FieldRef Name='FirstName' />
    <Value Type='Text'>Doe</Value>
    </Eq>
    <Or>
    <Eq>
    <FieldRef Name='LastName' />
    <Value Type='Text'>Doe</Value>
    </Eq>
    <Eq>
    <FieldRef Name='Profile' />
    <Value Type='Text'>Doe</Value>
    </Eq>
    </Or>
    If this helped you resolve your issue, please mark it Answered

  • Internal Error while executing a query with varaints in BEX

    HI All,
    I am executing a query which has 4 variants. when I use the first 3 variants the query is working fine.....but when I try to execute the same query for the 4th variant....the system is giving an error message called Internal Error.....
    when I executed the same query with same variant...in RSRT transaction code...I was able to see the results....
    The error messages that I am getting as follows...
    <Internal Error> receiving from the BW Server Failed. BW server raised exception SYSTEM_FAILURE. DO you want to see more information...
    when I selected YES....I got the following message
    Error in a ABAP statement when processing an Internal Table.table.
    Error Group
    RFC_ERROR_SYSTEM_FAILURE
    when clicked on the OK button the following message is displayed....
    <Internal Error> Can not determine text elements for the current query.
    Can any one explain me what went wrong...is there any thing that I need to do in the BEX settings...are there any patches that needs to be installed...or any OSS notes available for this sort of errors...?
    Advance in thanks
    Dilse...
    Hash

    Hi Harish,
    Execute the query in RSRT and check whether you have any short dump is in ST22. This would give a clear idea at what might have gone wrong.
    Another thing is to check whether the code for the variable is fine in the user exit.
    Hope this helps.
    Bye
    Dinesh

  • ADF how can i execute a query with parameters when the page renders

    hi
    i am using ADF web 11g
    i need to execute a query with parameters when the page renders
    thanks

    hello,
    I'm a fan of Java code, I really am.
    But when you use ADF, you decided to move to a more declarative environment.
    So why not do it declarative, the adf way?
    In your pagedef insert a action binding.
    This can be anything, a call to the application module, a call on the iterator(Like executeWithparams, etc.)
    Create an invokeAction in your pagedef and set the condition.
    This example refreshes(Action 2 is execute query) the data.
    First the method binding:
        <action IterBinding="PersoonIterator" id="Execute" InstanceName="LSAppModuleDataControl.Persoon"
                DataControl="LSAppModuleDataControl" RequiresUpdateModel="true" Action="2"/>And the invoke action
        <invokeAction Binds="Execute" id="refreshData"/>This always refreshes the data on page entry, but anything is possible, you can set condictions for the invokeAction.
    -Anton
    PS Yes I know that pagedefs become backing beans in the end and yes that is Java code, but if you wanna play the ADF way, the goal is the reduction of Java code and the increased performance of declarative programming.

  • Auth Error in BW while executing a query with Company hierarchy

    Hi All,
    I have an issue in BW Reporting auth objects.. Hope to get resolved here.
    We are using BI 7.0. However We  are still using the Reporting auth objects for fiield level security. We are having a problem while executing a query with company code hierarchy ,which is built on a multiprovider.
    The Background is as below
    Multiprovider: ZM_CD01 with 5 infocubes
    Query: Has 0COMP_CODE as free characteristics with display hierarchy for Japan (Node APSC_012 is fixed value)
    Node APSC_012 has 4070,4076,407A,408A,9830 company code values under it.
    Reporting Auth Objects:
    Z0COMPCODE: (for flat values)
    4070,4076,407A,408A,407M,407P,8236, :
    ZHCOMPCODE: (For tree structure)
    4070,4076,407A,408A,407M,407P,8080, :
    APSC_MGMT_HIER (Nodes: APSC_012,APSC019)
    Both the reporting authorization objects are checked for multi provider ZM_CD01 in RSSM
    While executing the query the following Auth error is received.
    You do not have authorization to read object  "Z0COMPCODE" authorization on '0COMP_CODE'
    When I change the values for Z0COMPCODE to * it works fine. No Auth error.
    Please help me resolve this issue. It is very critical now as the user needs to execute some important reports.
    Thanks in Advance.
    Ramkumar C

    Hi Chandra,
    Try the following:
    1. Go to tcode RSSM
    2. Enter the cube ZM_CD01 (all the other cubes) then click change.
    3. Afterwards, u201Cunchecku201D ALL Authorization Objects under this cube. (Repeate the same for all the cubes)
    4. Click Save.
    This will resolve the issue.
    Rgds,
    Raghu

  • Need help in optimizing the query with joins and group by clause

    I am having problem in executing the query below.. it is taking lot of time. To simplify, I have added the two tables FILE_STATUS = stores the file load details and COMM table that is actual business commission table showing records successfully processed and which records were transmitted to other system. Records with status = T is trasnmitted to other system and traansactions with P is pending.
    CREATE TABLE FILE_STATUS
    (FILE_ID VARCHAR2(14),
    FILE_NAME VARCHAR2(20),
    CARR_CD VARCHAR2(5),
    TOT_REC NUMBER,
    TOT_SUCC NUMBER);
    CREATE TABLE COMM
    (SRC_FILE_ID VARCHAR2(14),
    REC_ID NUMBER,
    STATUS CHAR(1));
    INSERT INTO FILE_STATUS VALUES ('12345678', 'CM_LIBM.TXT', 'LIBM', 5, 4);
    INSERT INTO FILE_STATUS VALUES ('12345679', 'CM_HIPNT.TXT', 'HIPNT', 4, 0);
    INSERT INTO COMM VALUES ('12345678', 1, 'T');
    INSERT INTO COMM VALUES ('12345678', 3, 'T');
    INSERT INTO COMM VALUES ('12345678', 4, 'P');
    INSERT INTO COMM VALUES ('12345678', 5, 'P');
    COMMIT;Here is the query that I wrote to give me the details of the file that has been loaded into the system. It reads the file status and commission table to show file name, total records loaded, total records successfully loaded to the commission table and number of records that has been finally transmitted (status=T) to other systems.
    SELECT
        FS.CARR_CD
        ,FS.FILE_NAME
        ,FS.FILE_ID
        ,FS.TOT_REC
        ,FS.TOT_SUCC
        ,NVL(C.TOT_TRANS, 0) TOT_TRANS
    FROM FILE_STATUS FS
    LEFT JOIN
        SELECT SRC_FILE_ID, COUNT(*) TOT_TRANS
        FROM COMM
        WHERE STATUS = 'T'
        GROUP BY SRC_FILE_ID
    ) C ON C.SRC_FILE_ID = FS.FILE_ID
    WHERE FILE_ID = '12345678';In production this query has more joins and is taking lot of time to process.. the main culprit for me is the join on COMM table to get the count of number of transactions transmitted. Please can you give me tips to optimize this query to get results faster? Do I need to remove group and use partition or something else. Please help!

    I get 2 rows if I use my query with your new criteria. Did you commit the record if you are using a second connection to query? Did you remove the criteria for file_id?
    select carr_cd, file_name, file_id, tot_rec, tot_succ, tot_trans
      from (select fs.carr_cd,
                   fs.file_name,
                   fs.file_id,
                   fs.tot_rec,
                   fs.tot_succ,
                   count(case
                            when c.status = 'T' then
                             1
                            else
                             null
                          end) over(partition by c.src_file_id) tot_trans,
                   row_number() over(partition by c.src_file_id order by null) rn
              from file_status fs
              left join comm c
                on c.src_file_id = fs.file_id
             where carr_cd = 'LIBM')
    where rn = 1;
    CARR_CD FILE_NAME            FILE_ID           TOT_REC   TOT_SUCC  TOT_TRANS
    LIBM    CM_LIBM.TXT          12345678                5          4          2
    LIBM    CM_LIBM.TXT          12345677               10          0          0Using RANK can potentially produce multiple rows to be returned though your data may prevent this. ROW_NUMBER will always prevent duplicates. The ordering of the analytical function is irrelevant in your query if you use ROW_NUMBER. You can remove the outermost query and inspect the data returned by the inner query;
    select fs.carr_cd,
           fs.file_name,
           fs.file_id,
           fs.tot_rec,
           fs.tot_succ,
           count(case
                    when c.status = 'T' then
                     1
                    else
                     null
                  end) over(partition by c.src_file_id) tot_trans,
           row_number() over(partition by c.src_file_id order by null) rn
    from file_status fs
    left join comm c
    on c.src_file_id = fs.file_id
    where carr_cd = 'LIBM';
    CARR_CD FILE_NAME            FILE_ID           TOT_REC   TOT_SUCC  TOT_TRANS         RN
    LIBM    CM_LIBM.TXT          12345678                5          4          2          1
    LIBM    CM_LIBM.TXT          12345678                5          4          2          2
    LIBM    CM_LIBM.TXT          12345678                5          4          2          3
    LIBM    CM_LIBM.TXT          12345678                5          4          2          4
    LIBM    CM_LIBM.TXT          12345677               10          0          0          1

  • SQL query with JSP and WML-parameters

    Hey,
    Could you help me?
    I'm trying to do the following. WML deck card 1 send parameter to same WML deck's card help. I try to read the parameter with JSP in card help by putting the parameter to SQL query, but it doesn't work. I can read the parameter with WML in card help. I can also print the value of the parameter with JSP if I generate WML with JSP.
    /*parameter sending from card 1 to card help*/
    out.println("<go href='#helpcard'>");
    out.println("<setvar name='valittukurssi' value='$(valittukurssi)'/>");
    /*parameter read with WML in card help */
    <p>Valitse kurssi.
    $valittukurssi</p>
    /'parameter read with JSP by generating WML with JSP*/
    out.println("<p>$valittukurssi</p>");
    /* SQL query with JSP */
    ResultSet uudettulokset = uusilause.executeQuery("select * from kurssi where lyhenne='$valittukurssi'");
    Thanks,
    Rampe

    You're problem is easy to fix. You're confusing WML variables with JSP variables. See below:
    >
    /*parameter sending from card 1 to card help*/
    out.println("<go href='#helpcard'>");
    out.println("<setvar name='valittukurssi'
    value='$(valittukurssi)'/>");
    Above you set a var that will work on the phone, not in JSP.
    /*parameter read with WML in card help */
    <p>Valitse kurssi.
    $valittukurssi</p>
    Yes the above does display the parameter, because it is a client side WML var, but you cannot use this variable in the JSP code (that's why your SWL fails).
    /'parameter read with JSP by generating WML with
    JSP*/
    out.println("<p>$valittukurssi</p>");Here's you're problem, the above line is EXACTLY the same as the one before it. When the container parses through this JSP code it translates the above line to:
    <p>$valittukurssi</p> on the WML page and the CLIENT uses it's local variable to display it.
    What you need and want is to have a variable that can be used in JSP code and output to your WML page. Here's how it's done:
    out.println("<go href='#helpcard'>");
    String some_name = "valittukurssi";
    out.println("<setvar name='"+some_name+"'
    value='$("+some_name+")'/>");
    //note that you may have to escape the ( and ) with a \
    //so we displayed the variable above into the WML page, now we can use it in the SQL query:
    /* SQL query with JSP */
    ResultSet uudettulokset =
    uusilause.executeQuery("select * from kurssi where
    lyhenne='"+some_name+"'");//the end of the command is: " ' " ) ;
    Frank Krul
    Got Node?

  • Tuning SQL query with SDO and Contains?

    I'trying to optimize a query
    with a sdo_filter and an intermedia_contains
    on a 3.000.000 records table,
    the query look like this
    SELECT COUNT(*) FROM professionnel WHERE mdsys.sdo_filter(professionnel.coor_cart,mdsys.sdo_geometry(2003, null, null,mdsys.sdo_elem_info_array(1,1003,4),mdsys.sdo_ordinate_array(809990,2087279,778784,2087279,794387,2102882)),'querytype=window') = 'TRUE' AND professionnel.code_rubr ='12 3 30' AND CONTAINS(professionnel.Ctx,'PLOMBERIE within Nom and ( RUE within Adresse1 )',1)>0
    and it takes 15s on a bi 750 pentium III with
    1.5Go of memory running under 8.1.6 linux.
    What can i do to improve this query time?
    null

    Hi Vincent,
    We have patches for Oracle 8.1.6 Spatial
    on NT and Solaris.
    These patches include bug fixes and
    performance enhancements.
    We are in the process of making these patches
    avaialble in a permanent place, but until then, I will temporarily put the patches on:
    ftp://oracle-ftp.oracle.com/
    Log in as anonymous and use your email for
    password.
    The patches are in /tmp/outgoing in:
    NT816-000706.zip - NT patch
    libordsdo.tar - Solaris patch
    I recommend doing some analysis on
    individual pieces of the query.
    i.e. time the following:
    1)
    SELECT COUNT(*)
    FROM professionnel
    WHERE mdsys.sdo_filter(
    professionnel.coor_cart,
    mdsys.sdo_geometry(
    2003, null, null,
    mdsys.sdo_elem_info_array(1,1003,4),
    mdsys.sdo_ordinate_array(
    809990,2087279,
    778784,2087279,
    794387,2102882)),
    'querytype=window') = 'TRUE';
    2)
    SELECT COUNT(*)
    FROM professionnel
    WHERE CONTAINS(professionnel.Ctx,
    'PLOMBERIE within Nom and ( RUE within Adresse1)',1) >0;
    You might want to try reorganizing the entire
    query as follows (no promises).
    If you contact me directly, I can try to
    help to further tune the SQL.
    Hope this helps. Thanks.
    Dan
    select count(*)
    FROM
    (SELECT /*+ no_merge */ rowid
    FROM professionnel
    WHERE mdsys.sdo_filter(
    professionnel.coor_cart,
    mdsys.sdo_geometry(
    2003, null, null,
    mdsys.sdo_elem_info_array(1,1003,4),
    mdsys.sdo_ordinate_array(809990,2087279,
    778784,2087279,
    794387,2102882)),
    'querytype=window') = 'TRUE'
    ) a,
    (SELECT /*+ no_merge */ rowid
    FROM professionnel
    WHERE CONTAINS(professionnel.Ctx,
    'PLOMBERIE within Nom and
    ( RUE within Adresse1)',1) >0
    ) b
    where a.rowid = b.rowid
    and professionnel.code_rubr ='12 3 30';
    **NOTE** Try this with no index on code_rubr
    null

  • Problem processing RAW images with Lion and 3.1.3

    Images that have "This photo was adjusted using an earlier version of Apple's RAW processing.  Attempting to send to a plug-in or Photoshop results in a dialog "Editing Error This image cannot be rendered for editing because Aperture does not support the image format."  Images that were previously processed with the current version of RAW processing work correctly.

    There is another discussion for problem with raw and the new 10.7.3.1 : my Raw from Panasonic GH2 are green and Aperture says : treatment with old version
    I find the solution to correct my RAW : they are green because of the bad WB applied by Aperture.
    I put here the solution but I have to correct manually and ask to treatment in the RAW windows for each picture. If it doesn't work, I correct manually the WB.
    https://discussions.apple.com/thread/3942768?start=0&tstart=0
    We have to report this bug to Apple.

  • Query with characteristics and NO Key figures

    Hi Everyone,
    I need to create a query with 3 char ... customer segment, customer type, climate zone. All are characteristics and there are no key figures.
    I went through the forum reading similar posts but couldn't figure out the best way.
    It can be done using Replacement path, Create formula variable with replacement path of your characteristic. Some posts also talked about writing some code.
    Like to know the best way of making this query.
    Can you please give me step by step procedure.
    Thanks,
    Kumar.

    I thought, if there are no key figures the query designer might give an error while saving, like "no key figures defined" or something like that. Thats why I came up with the question.
    I still have to document the detail requirement of user and he is not available. So just figuring out all the possibilities.

  • Execute Broadcaster direct with URL and variables

    Hi,
    is it possible to execute an broaadcaster with an existing setting as an URL command like <SAP_BW_URL CMD='START_BROADCASTER >.
    But i want execute the broadcaster direct in the same like the button below without any user action. It would be very nice to change the variable settings in the same way.
    Brg,
    Frank

    Hi,
    is it possible to execute an broaadcaster with an existing setting as an URL command like <SAP_BW_URL CMD='START_BROADCASTER >.
    But i want execute the broadcaster direct in the same like the button below without any user action. It would be very nice to change the variable settings in the same way.
    Brg,
    Frank

  • URGENT!Problem running a Query with a Subquery that includes the same table

    Hello all,
    Currently we are working over Oracle Database 10g Release 2 (10.2.0.3) Patch Set1.
    We have registered a schema called ICRI and we have created two VIEW over this schema to work in some occasions.
    CREATE OR REPLACE VIEW "ICRI_RELACIONAL_VIEW"
    (IDICRI, NOMBRERECURSO, VERSIONRECURSO) AS
    SELECT extractValue(value(i), '/ICRI/ID/text()'),
           extractValue(value(i), '/ICRI/NombreRecurso/text()'),
           extractValue(value(i), '/ICRI/VersionRecurso/text()') || '.' || extractValue(value(m), '/Modificacion/Secuencia/text()'),
    FROM ICRI i, table(xmlsequence(extract(value(i), '/ICRI/Modificaciones/Modificacion'))) m
    WHERE extractValue(value(m), '/Modificacion/Secuencia/text()') =
          (SELECT max(extractValue(value(s), '/Secuencia/text()'))
           FROM table(xmlsequence(extract(value(i),'/ICRI/Modificaciones/Modificacion/Secuencia'))) s)
    WITH READ ONLY;
    CREATE OR REPLACE VIEW "ICRI_DOMINIOS_VIEW"
    (ID, DOMINIO) AS
    SELECT extractValue(value(i), '/ICRI/ID/text()'),
           extractValue(value(a), '/Dominio/text()', 'xmlns="http://www.orswegimoarmada.es/ORSWE/ICRI"')
    FROM ICRI i, table(xmlsequence(extract(value(i), '/ICRI/Dominios/Dominio'))) a
    WITH READ ONLY;We have created 5000 XML documents based in this schema and stored in the database.
    Now we have executed different querys to obtain certain data.
    * QUERY 1
    SELECT COUNT(*) FROM ICRI_DOMINIOS_VIEW V1, ICRI_DOMINIOS_VIEW V2
    WHERE V1.ID = V2.ID AND V1.DOMINIO = 'Mar' AND V2.DOMINIO = 'Tierra'Time: 38sg. 1 row, Value: 1097.
    * QUERY 2
    SELECT COUNT(*) FROM ICRI_DOMINIOS_VIEW V1
    WHERE V1.DOMINIO = 'Mar'
          AND
          V1.ID IN (SELECT V2.ID FROM ICRI_DOMINIOS_VIEW V2
                    WHERE V2.DOMINIO = 'Tierra')Time: 34sg. 1 row, Value: 1097.
    * QUERY 3 (XPath Version)
    SELECT COUNT(*)
    FROM ICRI
    WHERE existsNode(object_value, '/ICRI/Dominios[Dominio="Mar" and Dominio="Tierra"]')=1
    Time: 32msg. 1 row, Value: 1097.
    * QUERY 4 (Version XPath)
    SELECT extractValue(object_value, '/ICRI/ID/text()')
    FROM ICRI
    WHERE existsNode(object_value, '/ICRI/Dominios[Dominio="Mar" and Dominio="Tierra"]')=1
    Time: 63mseg. 1097 rows.
    * QUERY 5
    SELECT V1.ID FROM ICRI_DOMINIOS_VIEW V1, ICRI_DOMINIOS_VIEW V2
    WHERE V1.ID = V2.ID AND V1.DOMINIO = 'Mar' AND V2.DOMINIO = 'Tierra'
    Time: 15sg. 1097 rows.
    * QUERY 6
    SELECT V1.ID FROM ICRI_DOMINIOS_VIEW V1
    WHERE V1.DOMINIO = 'Mar'
    AND
    V1.ID IN (SELECT V2.ID FROM ICRI_DOMINIOS_VIEW V2
    WHERE V2.DOMINIO = 'Tierra')
    Time: 26sg. 1097 rows.
    Now, with the next query, we have found an important issue in Oracle, because this query doesn't return any row.
    * QUERY 7
    SELECT extractValue(value(i), '/ICRI/ID/text()') ID,
           extractValue(value(i), '/ICRI/NombreRecurso/text()') NOMBRE,
           extractValue(value(i), '/ICRI/VersionRecurso/text()') || '.' || extractValue(value(m), '/Modificacion/Secuencia/text()') VERSION
    FROM ICRI i, table(xmlsequence(extract(value(i), '/ICRI/Modificaciones/Modificacion'))) m
    WHERE
       (extractValue(value(m), '/Modificacion/Secuencia/text()') =
        (SELECT max(extractValue(value(s), '/Secuencia/text()'))
         FROM table(xmlsequence(extract(value(i),'/ICRI/Modificaciones/Modificacion/Secuencia'))) s)
    AND
       (extractValue(value(i), '/ICRI/ID/text()') IN
        (select extractValue(object_value, '/ICRI/ID/text()') ID
         FROM ICRI
         WHERE (existsNode(object_value, '/ICRI/Dominios[Dominio="Mar" and Dominio="Tierra"]')=1)
    )Time 607mseg. 0 rows.
    * QUERY 8
    SELECT VI.IDICRI, VI.NOMBRERECURSO, VI.VERSIONRECURSO
    FROM ICRI_RELACIONAL_VIEW VI, (SELECT V1.ID FROM ICRI_DOMINIOS_VIEW V1, ICRI_DOMINIOS_VIEW V2
                                   WHERE V1.ID = V2.ID AND V1.DOMINIO = 'Mar' AND V2.DOMINIO = 'Tierra') V3
    WHERE VI.IDICRI = V3.ID Time: 16sg. 1097 rows.
    * QUERY 9
    SELECT VI.IDICRI, VI.NOMBRERECURSO, VI.VERSIONRECURSO
    FROM ICRI_RELACIONAL_VIEW VI
    WHERE VI.IDICRI IN
    (SELECT V1.ID FROM ICRI_DOMINIOS_VIEW V1
    WHERE V1.DOMINIO = 'Mar'
          AND
          V1.ID IN (SELECT V2.ID FROM ICRI_DOMINIOS_VIEW V2
                    WHERE V2.DOMINIO = 'Tierra')Time: 34 sg. 1097 rows.
    * QUERY 10
    SELECT extractValue(value(i), '/ICRI/ID/text()') ID,
    extractValue(value(i), '/ICRI/NombreRecurso/text()') NOMBRE,
    extractValue(value(i), '/ICRI/VersionRecurso/text()') || '.' || extractValue(value(m), '/Modificacion/Secuencia/text()') VERSION
    FROM ICRI i, table(xmlsequence(extract(value(i), '/ICRI/Modificaciones/Modificacion'))) m,
    (SELECT V1.ID FROM ICRI_DOMINIOS_VIEW V1, ICRI_DOMINIOS_VIEW V2
    WHERE V1.ID = V2.ID AND V1.DOMINIO = 'Mar' AND V2.DOMINIO = 'Tierra') V3
    WHERE
    (extractValue(value(m), '/Modificacion/Secuencia/text()') =
    (SELECT max(extractValue(value(s), '/Secuencia/text()'))
    FROM table(xmlsequence(extract(value(i),'/ICRI/Modificaciones/Modificacion/Secuencia'))) s)
    AND
    extractValue(value(i), '/ICRI/ID/text()') = V3.ID
    Time: 15sg. 1097 rows.
    * QUERY 11
    SELECT extractValue(value(i), '/ICRI/ID/text()') ID,
           extractValue(value(i), '/ICRI/NombreRecurso/text()') NOMBRE,
           extractValue(value(i), '/ICRI/VersionRecurso/text()') || '.' || extractValue(value(m), '/Modificacion/Secuencia/text()') VERSION
    FROM ICRI i, table(xmlsequence(extract(value(i), '/ICRI/Modificaciones/Modificacion'))) m
    WHERE
       (extractValue(value(m), '/Modificacion/Secuencia/text()') =
        (SELECT max(extractValue(value(s), '/Secuencia/text()'))
         FROM table(xmlsequence(extract(value(i),'/ICRI/Modificaciones/Modificacion/Secuencia'))) s)
    AND
       (extractValue(value(i), '/ICRI/ID/text()') IN (SELECT V1.ID FROM ICRI_DOMINIOS_VIEW V1
                                                      WHERE V1.DOMINIO = 'Mar'
                                                      AND
                                                      V1.ID IN (SELECT V2.ID FROM ICRI_DOMINIOS_VIEW V2
                                                                WHERE V2.DOMINIO = 'Tierra'))
    )Time: 30sg. 1097 rows.
    * QUERY 12
    SELECT extractValue(value(i), '/ICRI/ID/text()') ID,
           extractValue(value(i), '/ICRI/NombreRecurso/text()') NOMBRE,
           extractValue(value(i), '/ICRI/VersionRecurso/text()') || '.' || extractValue(value(m), '/Modificacion/Secuencia/text()') VERSION
    FROM ICRI i, table(xmlsequence(extract(value(i), '/ICRI/Modificaciones/Modificacion'))) m
    WHERE
       (extractValue(value(m), '/Modificacion/Secuencia/text()') =
        (SELECT max(extractValue(value(s), '/Secuencia/text()'))
         FROM table(xmlsequence(extract(value(i),'/ICRI/Modificaciones/Modificacion/Secuencia'))) s)
       )Time: 187msg. 5000 rows.
    Well, if we execute the query based in a relational view all work fine but the performance of the query is hugely decreased. If we try to execute the query based in the XPath values, this options must be the correct, the query doesn't return any result.
    Any idea to solve this problem? For us it is very important to find a solution as soon as possible, because our development time is finishing.
    Our clients have installed Oracle Client 10.2.0.1 & ODAC 10.2.0.20.
    Thanks in advance for your help,
    David.

    SQL> alter session set optimizer_features_enable='10.1.0';
    Session altered.
    SQL> SELECT count(*)
    2 FROM ICRI i, table(xmlsequence(extract(value(i), '/ICRI/Modificaciones/Mo
    dificacion'))) m
    3 WHERE
    4 extractValue(value(i), '/ICRI/ID/text()') IN
    5 (select extractValue(object_value, '/ICRI/ID/text()') ID
    6 FROM ICRI
    7 WHERE (existsNode(object_value,
    8 '/ICRI/Dominios[Dominio="Mar" and Dominio="Tierra"]')=1))
    9 /
    COUNT(*)
    5
    Test this with a few of your queries and see if the results are expected.
    if so I am thinking it is close to bug 5585187
    QUERY NOT RETURNING PROPER RESULTS WITH INLINE VIEWS
    Fixed in 11.
    I am going to see if I can get an env to see if your TC works with this fix before I confirm it 100 percent.
    Also note this was done with a very scaled down version of your testcase. Using only one XML doc
    regards
    Coby
    Message was edited by: Coby
    coadams

Maybe you are looking for

  • Class & int/String issues

    Upon compiling, I am receiving the following errors: TeamRosterApp.java:153: cannot find symbol symbol : class ButtonPanel location: class TeamRosterPanel ButtonPanel buttonPanel; ^ TeamRosterApp.java:166: cannot find symbol symbol : class ButtonPane

  • Transaction resources not released across program invocations using MVCC

    I'm evaluating Berkley DB XML v2.4.13 for use in a new software product and have encountered problems with multiversion concurrency control. I'm using the Java API and JRE 1.6.0_07. The platform is Windows XP Professional SP3. When I create a transac

  • Process code table

    Hi Can anybody tell me where the process code of a particular message type stored. Suppose my message type is INVOIC My Process code is - INVF which table contain this process code value. Thanks  a Lot Mrutyunjaya Tripathy

  • My iPod won't do anything at all

    I'm sure this has been discussed somewhere, but my iPod absolutely refuses to do anything but play music through iTunes when connected to my laptop. I can't format it, restore it, delete anything, or add anything. Does anyone have any suggestions as

  • Linking transaction in workitem

    Hi Gurus, I would like to know if it's possible and how I can link a transaction in a Business Workflow. The requirement is to have a workitem in which the user has 4 link to 4 transaction and based on his choice the system has to open the choosen tr