How to use EQUIV operator in a query?

i want to list products whose names like 'Windows XP' or 'WindowsXP', following is my query:
select * from product
where contains(product_name,'Windows XP = WindowsXP',1) > 0
but this query only return the products whose name contain 'Windows XP'. the result is something likes
select * from product
where contains(product_name,'Windows (XP = WindowsXP)',1) > 0
so i modified it to :
select * from product
where contains(product_name,'(Windows XP) = (WindowsXP)',1) > 0
it's error
Error report:
SQL Error: ORA-29902: error in executing ODCIIndexStart() routine
ORA-20000: Oracle Text error:
DRG-50900: text query parser error on line 1, column 26
DRG-50921: EQUIV operand not a word or another EQUIV expression
29902. 00000 - "error in executing ODCIIndexStart() routine"
*Cause:    The execution of ODCIIndexStart routine caused an error.
*Action:   Examine the error messages produced by the indextype code and
take appropriate action.

Equiv only works for individual terms. Since there is a space between Windows and XP, they are two terms. You can use synonyms for phrases containing multiple terms, as shown below.
SCOTT@orcl_11g> CREATE TABLE product (product_name  VARCHAR2 (30))
  2  /
Table created.
SCOTT@orcl_11g> INSERT ALL
  2  INTO product VALUES ('Windows XP')
  3  INTO product VALUES ('WindowsXP')
  4  INTO product VALUES ('Unix')
  5  SELECT * FROM DUAL
  6  /
3 rows created.
SCOTT@orcl_11g> BEGIN
  2    CTX_THES.CREATE_THESAURUS ('name_thes');
  3    CTX_THES.CREATE_RELATION ('name_thes', 'Windows XP', 'SYN', 'WindowsXP');
  4  END;
  5  /
PL/SQL procedure successfully completed.
SCOTT@orcl_11g> CREATE INDEX product_name_idx ON product (product_name)
  2  INDEXTYPE IS CTXSYS.CONTEXT
  3  /
Index created.
SCOTT@orcl_11g> SELECT * FROM product
  2  WHERE  CONTAINS (product_name, 'SYN (Windows XP, name_thes)') > 0
  3  /
PRODUCT_NAME
Windows XP
WindowsXP
SCOTT@orcl_11g> SELECT * FROM product
  2  WHERE  CONTAINS (product_name, 'SYN (WindowsXP, name_thes)') > 0
  3  /
PRODUCT_NAME
Windows XP
WindowsXP
SCOTT@orcl_11g>

Similar Messages

  • How to use Airthmetic operator in hibernate Query

    Hi everybody,I am writing a hibernate query that multiply two attributes and takes it sum, but when I use * operator,it gives error "* only allowed inside aggregate function in SELECT " . HQL query is :
    Select
    sum(postab.subtotal),
    sum(postab.tax),
    sum(postab.total),
    count(postab.checknum) ,
    Sum((postab.subtotal)*(loc.royalty)/100)
    From
    com.infonox.hibernate.Location as loc,
    com.infonox.hibernate.Postables as postab
    where loc.restaurantid = postab.restaurantid
    Line which is creating problem is
    Sum((postab.subtotal)*(loc.royalty)/100)
    Is there any other way to take product of two attributs? your help will be greatly appreciated as it is really stumbling block in my project. Thanks in advance

    Sum((postab.subtotal)*(loc.royalty)/100)
    Is there any other way to take product of two
    attributs? your help will be greatly appreciated as
    it is really stumbling block in my project. Thanks in
    advanceSuch a stumbling block should have inspired more activity on your part.
    I'd try rewriting it like this:
    sum(postab.subtotal*loc.royalty/100)[/b]%

  • How to use LIKE Operator with my query requriment

    HI all,
    I have a requirement as follows
    EMPID ENAME JOB SAL
    10 RAJ KAMAL MANAGER 25000
    20 KAMAL RAJ NAYAK CLERK 4000
    30 NARENDAR GUPTA ANALYST 20000
    40 ASHUTOSH GUPTA DEVELOPER 10000
    50 ASHUTOSH NAYAR PROGRAMMER 15000
    i am searching enames such that i need to get the whole name even if i search with just a single LETTER/WORD immaterial of the order they exist in the name for which i need to get the whole name.(INFACT WORD comparision)
    ex:
    1) select * from emp where ename like '%ka%'
    i am getting:
    10 RAJ KAMAL MANAGER 25000
    20 KAMAL RAJ NAYAK CLERK 4000
    This is not what i need i need just word camparision not letters comparision let me tell you...
    select * from emp where ename like '%amal%'
    Even for this query ill get the same output.. this is not my option to go..
    I need just word comparision with starting letter and immaterial of the word position in the name
    If it is possible to do with query please let me know..
    Thanking you
    Narendar Vishwanatham

    Full example:
    SQL> ed
    Wrote file afiedt.buf
      1  with e as (select 10 as empid, 'RAJ KAMAL' as ename, 'MANAGER' as job, 25000 as sal from dual union all
      2             select 20, 'KAMAL RAJ NAYAK', 'CLERK', 4000 from dual union all
      3             select 30, 'NARENDAR GUPTA', 'ANALYST', 20000 from dual union all
      4             select 40, 'ASHUTOSH GUPTA', 'DEVELOPER', 10000 from dual union all
      5             select 50, 'ASHUTOSH NAYAR', 'PROGRAMMER', 15000 from dual)
      6  -- END OF TEST DATA
      7  select *
      8  from e
      9* where regexp_like(ename,'(^| )KA( |$)')
    SQL> /
    no rows selected
    SQL> ed
    Wrote file afiedt.buf
      1  with e as (select 10 as empid, 'RAJ KAMAL' as ename, 'MANAGER' as job, 25000 as sal from dual union all
      2             select 20, 'KAMAL RAJ NAYAK', 'CLERK', 4000 from dual union all
      3             select 30, 'NARENDAR GUPTA', 'ANALYST', 20000 from dual union all
      4             select 40, 'ASHUTOSH GUPTA', 'DEVELOPER', 10000 from dual union all
      5             select 50, 'ASHUTOSH NAYAR', 'PROGRAMMER', 15000 from dual)
      6  -- END OF TEST DATA
      7  select *
      8  from e
      9* where regexp_like(ename,'(^| )KAMAL( |$)')
    SQL> /
         EMPID ENAME           JOB               SAL
            10 RAJ KAMAL       MANAGER         25000
            20 KAMAL RAJ NAYAK CLERK            4000
    SQL>

  • Problem when using About Operator in Contains Query

    Hi,
    I'm new to Oracle and this forums too. I have a problem when using about operator in contains query.
    I create a table with some records and then create a context index on 'name' column.
    CREATE TABLE my_items (
      id           NUMBER(10)      NOT NULL,
      name         VARCHAR2(200)   NOT NULL,
      description  VARCHAR2(4000)  NOT NULL,
      price        NUMBER(7,2)     NOT NULL
    ALTER TABLE my_items ADD (
      CONSTRAINT my_items_pk PRIMARY KEY (id)
    CREATE SEQUENCE my_items_seq;
    INSERT INTO my_items VALUES(my_items_seq.nextval, 'Car', 'Car description', 1);
    INSERT INTO my_items VALUES(my_items_seq.nextval, 'Train', 'Train description', 2);
    INSERT INTO my_items VALUES(my_items_seq.nextval, 'Japan', 'Japan description', 3);
    INSERT INTO my_items VALUES(my_items_seq.nextval, 'China', 'China description', 4);
    COMMIT;
    EXEC ctx_ddl.create_preference('english_lexer','basic_lexer');
    EXEC ctx_ddl.set_attribute('english_lexer','index_themes','yes');
    EXEC ctx_ddl.set_attribute('english_lexer','theme_language','english');
    CREATE INDEX my_items_name_idx ON my_items(name) INDEXTYPE IS CTXSYS.CONTEXT PARAMETERS('lexer english_lexer');
    EXEC ctx_ddl.sync_index('my_items_name_idx');Then I perform contains query to retrieve record :
    SELECT count(*) FROM my_items WHERE contains(name, 'Japan', 1) > 0;
    COUNT(*)
          1
    SELECT count(*) FROM my_items WHERE contains(name, 'about(Japan)', 1) > 0;
    COUNT(*)
          1But the problem is when I using ABOUT operator like in Oracle's English Knowledge Base Category Hierarchy it return 0
    SELECT count(*) FROM my_items WHERE contains(name, 'about(Asia)', 1) > 0;
    COUNT(*)
          0
    SELECT count(*) FROM my_items WHERE contains(name, 'about(transportation)', 1) > 0;
    COUNT(*)
          0I can't figure out what 's wrong in my query or in my index.
    Any help will be appreciated.
    Thanks,
    Hieu Nguyen
    Edited by: user2944391 on Jul 10, 2009 3:25 AM

    Hello (and welcome),
    You'd be best asking this question in the Oracle Text forum, here:
    Text
    And by the way, it will help others to analyse if you put {noformat}{noformat} (lowercase code in curly brackets) before and after your code snippets.
    Good luck!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to use LIKE operator in plsql

    Hi
    I wanted to select certain rows using like operator in plsql(Input should be given by the user). I have given my experiment here .I couldn't get any result.
    As per sql syntax while using LIKE operator we should give search criteria within single quote.where as in plsql if we give within single quote its takes as string so no output is comming.what is solution ? How to use like operator in plsql?
    sql syntax
    SQL>SELECT customer_name FROM customer_header
    WHERE customer_name LIKE 'B%' ; customer_name
    Bala murali
    Babu
    Basker
    plsql syntax
    PROCEDURE pro_custheader_like ( v_cname IN varchar2
         ,answer OUT type_refcur_customer) IS
         BEGIN
         OPEN answer FOR
         SELECT customer_name FROM customer_header
              WHERE customer_name LIKE ( ' v_cname ' );
    END pro_custheader_like;
    execution command
    sql>variable answer refcursor;
    sql>set serveroutput on
    sql>exec package_name.pro_custheader_like( 'R',:answer);
    plsql successfully completed
    sql>print :answer
    no row selected
    by
    balamuralikrishnan.s

    plsql syntax
    PROCEDURE pro_custheader_like ( v_cname IN
    varchar2
    ,answer OUT
    type_refcur_customer) IS
    N
         OPEN answer FOR
         SELECT customer_name FROM customer_header
    WHERE customer_name LIKE ( v_cname );
    END pro_custheader_like;
    Try it without any quotes. And, let us know your feedback.
    Regards.
    Satyaki De.
    Message was edited by:
    Satyaki_De

  • How to use ternary operator in JSF using EL expression

    how to use ternary operator in JSF using EL expression

    I want to use ternary operator for h:datatable columnclasses attribute like as below
    <h:datatable
    columnClasses="#{booleanExpression ? style1,style2 : style3,style4}"
    />
    But it's not working.Is there any other alternative to do this?

  • How to Use Dimension Operator

    Hi
    I'm trying to implement SCD Type 2. I have done so using conventional methods.
    I have read in some blogs that dimension operator can be used for SCD. Can any one provide me material on how to use Dimension Operator. I tried OWB User guide. But its not useful.
    I have seen that we need to create levels. But i dont need levels.
    Can somebody please tell me how to use it.
    Regards
    Vibhuti

    Hi Vibhuti,
    using dimensions with OWB 10g R2 isn't that difficult. You just create a number of attributes like an ID, a business key and probably a description and then associate each of the attributes with a level. You need at least one level that all the attributes are associated to. Then you can use the slowly changing dimension wizard (SCD) to track changes. In the SCD settings you can determin for which attribute you want to trigger history and which attributes contain your effective date and your end date (if you want to use SCD type II). Obviously you would need two additional attributes in every level for that purpose.
    Regards,
    Jörg

  • How to use 'about' operator in Full text search query?

    Hi all,
    I have to search the following string in full text index using 'about' operator.
    'Advertisment(Cosmetics) Assets'
    If use the following query
    SELECT keyword_id
    FROM mam_keyword_languages
    WHERE contains(fts_text_uc, convert('about(Advertisment(Cosmetics) Assets)',
    'WE8MSWIN1252', 'WE8MSWIN1252')) > 0
    ORDER BY nlssort(text, 'NLS_SORT=EEC_EUROPA3')
    It gives following error.
    ERROR at line 1:
    ORA-29902: error in executing ODCIIndexStart() routine
    ORA-20000: Oracle Text error:
    DRG-50901: text query parser syntax error on line 1, column 37
    How can i do this search? Is there any other way?
    Thanx in advance.
    T.Umapathy

    Sum((postab.subtotal)*(loc.royalty)/100)
    Is there any other way to take product of two
    attributs? your help will be greatly appreciated as
    it is really stumbling block in my project. Thanks in
    advanceSuch a stumbling block should have inspired more activity on your part.
    I'd try rewriting it like this:
    sum(postab.subtotal*loc.royalty/100)[/b]%

  • How to use XRANK operator for partial match comaprison?

    Hi All,
    I am aware how to use the XRANK operator to boost a result if a managed property equals a specific value.
    XRANK(cb=400) importance:'1'
    How would I make a key word query using XRANK which will boost a result if the managed property contains a part or whole of a term as indicated in the pseudo code below?
    XRANK(cb=400) language:'*en*'
    In this scenario, I would like all results where language contains  the phrase 'en' to be boosted. I wonder if this is possible at all.
    thanks,
    Saurabh
    sdg

    Hi,
    Keyword Query Language does not support suffix matching.  So, in the above scenario it might not be possible.
    Please refer to the technet article.
    Keyword Query Language (KQL) syntax reference
    Please mark it answered if your problem resolved or helpful.

  • How tio use like operator in textitem to get the name

    Oracle forms6i
    Hai All
    I have created an form to create an hierarchy list. I that I had an Text_item how can i use like operator to get the name to select. which trigger i need to use. when i select the name i need to get his employee code and other details
    Thanks In Advance
    Srikkanth.M

    A is the head of Dept 10 and three person are under A namelyHow will you know that B, C and D are under A is there any parent child relationship between Leader and Employee code? If yes, Then you can create the relationship between blocks no need to set where_clause programatically. So, relationship can be like...
    leader_block.emp_code = emp_block.leader_code
    AND leader_blokc.dep_code = emp_block.dep_codeSo, when you will query data in LEADER block it will show employees which are under LEADER which you queried in LEADER block.
    Or if there is no relationship then how will you know that which employee under which leader?
    b 002 10 1
    c 003 10 1
    d 004 10 1
    When i enter the name of head corresponding other members in the department will need to display in the
    Tabular format Or if you want to query the records only for department relation. Then as you said you create two blocks then create create the relationship using dep_code between those blocks.
    like...
    leader.dep_code = emp_block.dep_code-Ammad

  • How to use multi select in a query report

    I defined a lov. This lov retuns name and a id. I want to use the result of this multi select in my query.
    I always get invalid number when I choose two items of the select. When I debug I see that the return value of the multi select is 1:2. How can I change the seperator : in , I tried the following but this does't work.
    if :P26_PRODUCTTYPE IS NOT NULL then
    l_sql := l_sql ||' and producttype in
    (REPLACE(:p26_producttype,'':'','','' ))';
    end if;

    as you're finding, multiple values selected from html db multi-select list items (and checkboxes) are stored as a single, colon-delimited string. i explained an easy way to handle this via pl/sql in...
    Multiple select list
    ...that post shows you how to throw the selected values into a pl/sql table and step through them as needed. it also showed how to use an instr to parse through the string if you want to go that route. you could use that same instr logic right in your sql query. so let's say your lov for your multi-select item (P1_MY_MULTISELECT, we'll call it) was defined as...
    select ename, empno from emp order by 1
    ...and your user selected KING, FORD, and JONES. :P1_MY_MULTISELECT would store those values as...
    7839:7902:7566
    ...you could then write a query to return the selected enames with something like...
    select ename, job
    from emp
    where insrt (':'||:P1_MY_MULTISELECT||':',':'||empno||':') != 0
    ...hope this helps,
    raj

  • Error when using "inlist operator" in the query filter of Webi 3.1

    Hi,
    We are currently in the process of migrating Deski to webi (BOXI 3.1).
    The problem is, Deski is using the "inlist" operator which is working fine but after migrating to webi the inlist operator in the query filter is throwing the below error,
    *Error Message :*
    A database error occured. The database error text is: ORA-00907: missing right parenthesis. (WIS 10901)
    Appreciate your assistance on this.
    Thanks !
    Regards,
    Perialt

    Karthik ,
    Yes I am seeing an additional paranthesis in Webi SQL query.
    For example plz consider the product table below,
    SELECT
    Product.ID,
    Product.Name
    FROM Product
    WHERE
    Product.Name IN ( @Prompt('4) Name:','C','Product\Name-M',multi,free)  )
    As a work around in Custom SQL, If I remove the paranthesis the below query is running fine in webi
    SELECT
    Product.ID,
    Product.Name
    FROM Product
    WHERE
      Product.Name IN  @Prompt('4) Name:','C','Product\Name-M',multi,free) 
    But I want a permanent solution.

  • How to use logical database "psj" for query?

    Hi, expert :
       use "PSJ" to make a query. but in queries, the title have two lines. and can't  correspond to the content.
       how to make the title correspond to the content?
    regards

    Hi
    Comments option nothing but where you can enter your description.While creating the SAP Query using SQVI enter your query name and click create one popup window will come in that you have comments field where you can enter your description.
    Thanks
    S.Murali

  • Using XML Operation Tags to query by date

    Problem 1:
    When I use timestamps from items' XML to form queries on repositories, I receive SQL errors.
    Problem 1 Example:
    Query the PublishingRepository to find all active projects created on August 16.
    In Dynamo Administration, navigate to /atg/epub/PublishingRepository
    In the box labeled "Run XML Operation Tags on the Repository," enter the following tag:
        <query-items item-descriptor="project">status = "Active" AND creationDate = "08/16/2013"</query-items>
    Result: java.sql.SQLDataException: ORA-01843: not a valid month
    Problem 1 Solution:
    Use this query instead:
    <query-items item-descriptor="project">
    status = "Active"
    AND
    creationDate = date("2013-08-16")
    </query-items>
    Problem 2:
    Using the "<" operator to construct a less-than argument doesn't work.
    Problem 2 Example:
    Query the PublishingRepository to find all active projects created before August 16.
    In Dynamo Administration, navigate to /atg/epub/PublishingRepository
    In the box labeled "Run XML Operation Tags on the Repository," enter the following tag:
        <query-items item-descriptor="project">status = "Active" AND creationDate < date("2013-08-16")</query-items>
    Result: SOURCE:org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.
    Problem 2 Solution:
    For some reason, the ">" greater-than operator seems to work fine, even when the "<" less-than operator won't. You can switch around the order of the query to get the desired result:
    <query-items item-descriptor="project">
    status = "Active"
    AND
    date("2013-08-16") > creationDate
    </query-items>

    Problem 1:
    When I use timestamps from items' XML to form queries on repositories, I receive SQL errors.
    Problem 1 Example:
    Query the PublishingRepository to find all active projects created on August 16.
    In Dynamo Administration, navigate to /atg/epub/PublishingRepository
    In the box labeled "Run XML Operation Tags on the Repository," enter the following tag:
        <query-items item-descriptor="project">status = "Active" AND creationDate = "08/16/2013"</query-items>
    Result: java.sql.SQLDataException: ORA-01843: not a valid month
    Problem 1 Solution:
    Use this query instead:
    <query-items item-descriptor="project">
    status = "Active"
    AND
    creationDate = date("2013-08-16")
    </query-items>
    Problem 2:
    Using the "<" operator to construct a less-than argument doesn't work.
    Problem 2 Example:
    Query the PublishingRepository to find all active projects created before August 16.
    In Dynamo Administration, navigate to /atg/epub/PublishingRepository
    In the box labeled "Run XML Operation Tags on the Repository," enter the following tag:
        <query-items item-descriptor="project">status = "Active" AND creationDate < date("2013-08-16")</query-items>
    Result: SOURCE:org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.
    Problem 2 Solution:
    For some reason, the ">" greater-than operator seems to work fine, even when the "<" less-than operator won't. You can switch around the order of the query to get the desired result:
    <query-items item-descriptor="project">
    status = "Active"
    AND
    date("2013-08-16") > creationDate
    </query-items>

  • How to use boolean operator to get count

    Hi All,
    In my query i need to add a field Count which shows number.
    Meaning,
    Column A   ColumnB ColumnC  Count
    100               50            0            2
    55                60             76         3
    79                0               0           1
    meaning from all three column only two has values then Count should show 2. etc....
    any suggestion how to use boolean expression here ?
    or anyother way to display Count ?
    thanks,
    KS

    Hi thanks for idea.
    boolean didnt work here. the formulau sugested worked...
    But i wrote formula for the Count --> COUNT("overtime") and for the Count property I selected Calculate Result As --> Summation fo Rounded Values
    so the output is as follows:
    i had data for 3 payperiods
    Count  (1st 3 columns)                    overall result(last Column)
    200801     200802     200803           
    1                 0             1                         2
    1                1              1                         3
    0                1             0                         1
    Now the out put i wanted is in the last column -Result column.
    I dont want Count column to be display like this. it is showing values instead of total. any this i should change for this?
    thanks,
    KS

Maybe you are looking for