Special LIKE query

Hi,
I need to create a special SQL query; I'll explain better with an example:
if, for example, I need to query about the string VIA, I'll use:
SELECT ..... WHERE name LIKE '% VIA %'
but if I query about VIA at the end of a comment:
SELECT ..... WHERE name LIKE '% VIA.%'
or
SELECT ..... WHERE name LIKE '% VIA,%'
or
SELECT ..... WHERE name LIKE '% VIA;%'
or I can need to query for VIA between brackets:
SELECT ..... WHERE name LIKE '%(VIA %'
or
SELECT ..... WHERE name LIKE '%VIA)%'
Can I do all of it with only one question defining a specific group of special characters?, the idea is that I could define a group z=(, . ; : ( ) [ ] ...) and then type my query
SELECT ..... WHERE name LIKE '%zVIAz%'
Sorry because of my poor english
thanks

I'll do the query throught a program which should separate the query in multiples queries to the database; if a have 12 LIKEs, I'll do 12 queries... too much queries

Similar Messages

  • About regex and 'like' query

    Dear all,
    can i doing regex query in SAP B1?
    And how to use 'like' query with table, i mean :
    SELECT * FROM test T0 INNER JOIN test2 T1
    WHERE T0 LIKE '%T1.testfield%'
    thanks for your help

    wait - something came out funny in the previous posting - the system highlighted the name "field" with blue - that is NOT what I typed...
    instead I typed...
    "field" between two brackets ( bracket = [ and the other bracket - I cannot type them in because they come out as a different character)
    what the heck is going on with the forum here???  I am seeing this highlighting in other postings as well...
    Hope THIS one comes out correctly
    Edited by: Zal Parchem on Dec 29, 2007 2:47 PM

  • Executing Like Query

    Hey Can Anyone tell me how ca i execute like query using jdbc odbc bridge
    when i use the following syntax it gives me an error
    select topicid,name,subject from topic where subject like("subject1%")
    or
    select topicid,name,subject from topic where subject like("subject1*")
    both of the statements issue an error
    Please Help
    asap
    Thanx

    when i use the following syntax it gives me an error
    select topicid,name,subject from topic where subject
    like("subject1%")You need to use single quotes instead of double quotes.
    SELECT topicid, name, subject FROM topic WHERE subject LIKE 'subject1%'

  • SPECIAL PRICE QUERY

    Hi Experts,
    I need to make a query for special price query.
    1. Customer Name/Item Name/Original Price(as Retail Price List)/Special Price/Start of Date/End of DATE
    2. Search By End of Date
    Can anyone help to make this query?

    Hi Stephen......
    You can find those detials in OSPP and SPP1 Table......
    Try this.........
    SELECT Distinct T2.CardName, T3.ItemName, T5.ListName as 'Price List',
    T4.Price as 'Original Price from Price List', T0.Price As 'Special Price',
    T1.FromDate as 'From Date', T1.ToDate as 'Valid Date'  FROM OSPP T0 Inner Join SPP1 T1
    On T0.ItemCode=T1.ItemCode Left Join OCRD T2 On T0.CardCode=T2.CardCode Left Join OITM T3
    On T0.ItemCode=T3.ItemCode Left Join ITM1 T4 On T0.ItemCode=T4.ItemCode Left Join OPLN T5
    On T5.ListNum=T4.PriceList
    Regards,
    Rahul

  • Is there any LIKE query equivalent in XML?

    Is there any LIKE query equivalent in XML?
    I would like the display words starts with 'A' in flex list, vice versa. I send A as a input.
    Any ideas?

    Hi,
    I don't know that one - but with slight modification I can filter nodes values also - not onlyl attributes:
    var people:XML = <people>
       <person>
                        <firstName>Peter</firstName>
              </person>
       <person>
                        <firstName>Auguste</firstName>
              </person>
       <person>
                        <firstName>Gregory</firstName>
              </person>
       <person>
                        <firstName>Andy</firstName>
              </person>
    </people>
    (so we have nodes that have values - not attributtes)
    and then e.g.:
    var peopleList:XMLList = people.person.(firstName.charAt(0) == "A");
    trace(peopleList);
    (this is dynamic statement - you could replace "A" with variable reference, etc)
    Edit;
    I've googled interesting article you could read on that subject here:
    http://www.senocular.com/flash/tutorials/as3withflashcs3/?page=4
    hth,
    regards,
    Peter
    Message was edited by: Peter Blazejewicz

  • Special Pricing Query

    Hi,
    I need some assistance with a Price List query.
    I have special volume discounts setup for items within the main price lists.  I have done it this way rather than doing special pricing against business partners.
    I need a query where you select a product group and a price list and only selects items with item property 34 set as 'Y'.  The report needs to produce the item code, base price, volume, discounted price (based on the volume).  This would basically give the result of what a "single item" would cost and then a "box price" for the same item.  It would look something like:
    ITEM CODE     LIST PRICE     VOLUME     BOX/VOLUME PRICE     ITEM REMARKS
    Any assistance would be greatly appreciated.
    Many Thanks,
    Steve

    Hi Nagarajan,
    Thank you for the query.  It doesn’t however give the results I need.  It seems to list a number of transactions rather than the pricing from the price list.
    Ideally am looking for the following results:
    ITEM CODE         LIST PRICE (From Price List)          DISCOUNT VOLUME QTY (From special Pricing with Price List)     DISCOUNT  VOLUME PRICE ITEM REMARKS
    Based on the WHEN/FILTER:
    Price List = ‘%’
    QueryGrp34 = 'Y'
    I hope this helps??
    Many Thanks,
    Steve   

  • Cm:select performance problem with multiple likes query clause

    I have query like <br>
              <b>listItem like '*abc.xml*' && serviceId like '*xyz.xml*'</b><br>
              Can we have two likes clauses mentioned above in the cm:select. The above is executing successfully but takes too much time to process. <br><br>
              Can we simplify the above mentioned query or any solution. Please help me in this issue.<br><br>
              Thanks & Regards,<br>
              Murthy Nalluri

    A few notes:
    1. You seem to have either a VPD policy active or you're using views that add some more predicates to the query, according to the plan posted (the access on the PK_OPERATOR_GROUP index). Could this make any difference?
    2. The estimates of the optimizer are really very accurate - actually astonishing - compared to the tkprof output, so the optimizer seems to have a very good picture of the cardinalities and therefore the plan should be reasonable.
    3. Did you gather index statistics as well (using COMPUTE STATISTICS when creating the index or "cascade=>true" option) when gathering the statistics? I assume you're on 9i, not 10g according to the plan and tkprof output.
    4. Looking at the amount of data that needs to be processed it is unlikely that this query takes only 3 seconds, the 20 seconds seems to be OK.
    If you are sure that for a similar amount of underlying data the query took only 3 seconds in the past it would be very useful if you - by any chance - have an execution plan at hand of that "3 seconds" execution.
    One thing that I could imagine is that due to the monthly data growth that you've mentioned one or more of the tables have exceeded the "2% of the buffer cache" threshold and therefore are no longer treated as "small tables" in the buffer cache. This could explain that you now have more physical reads than in the past and therefore the query takes longer to execute than before.
    I think that this query could only be executed in 3 seconds if it is somewhere using a predicate that is more selective and could benefit from an indexed access path.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Like Query

    Guyz What wrong with my query?
    Im using form 6i database 9i
    IF :CTRL.DIS_SRCH IS NULL THEN
         ALERT_MESSAGES('Enter some words to search database');
    ELSE
         SET_BLOCK_PROPERTY('COR_ITEM_DESCP', DEFAULT_WHERE, UPPER('ITEM_DESCP')LIKE UPPER('%'||:CTRL.DIS_SRCH||'%''');
         GO_BLOCK('COR_ITEM_DESCP');
         EXECUTE_QUERY;
         END IF;As my query working fine below.
    AMC>SELECT ITEM_ID,CATEGORY,ITEM_DESCP FROM COR_ITEM_DESCP WHERE upper(ITEM_DESCP) LIKE upper('%&ITEM_NAME%')
      2  /
    Enter value for item_name: CA
    old   1: SELECT ITEM_ID,CATEGORY,ITEM_DESCP FROM COR_ITEM_DESCP WHERE upper(ITEM_DESCP) LIKE upper('%&ITEM_NAME%')
    new   1: SELECT ITEM_ID,CATEGORY,ITEM_DESCP FROM COR_ITEM_DESCP WHERE upper(ITEM_DESCP) LIKE upper('%CA%')
      ITEM_ID CATEGORY                                                                                 
    ITEM_DESCP                                                                                         
      1010124 BANDAGES                                                                                 
    UNICAST COTTON 5 CM                                                                                
      1010125 BANDAGES                                                                                 
    UNICAST COTTON 10 CM 3X4                                                                           
      1010126 BANDAGES                                                                                 
    CASTING TAPE (FIBER GLASS) 3 INCH                                                                  
      1010127 BANDAGES                                                                                 
    CASTING TAPE (FIBER GLASS) 4 INCH 4X4                                                              
      1010139 GLOVES                                                                                   
    SURGICAL GLOVES 7 CM                                                                               
      1010140 GLOVES                                                                                   
    SURGICAL GLOVES 7.5 CM                                                                             
      1010141 GLOVES                                                                                   
      ITEM_ID CATEGORY                                                                                 
    ITEM_DESCP                                                                                         
    SURGICAL GLOVES 8 CM                                                                               
      1010156 SYRINGES                                                                                 
    SCALP VEIN SET 22G                                                                                 
      1010157 SYRINGES                                                                                 
    SCALP VIEN SET 24G                                                                                 
      1010158 SYRINGES                                                                                 
    I.V CANNULA 22G                                                                                    
      1010159 SYRINGES                                                                                 
    I.V CANNULA 24G                                                                                    
      1010165                                                                                          
    THERMOSCAN COVER                                                                                   
      1010168                                                                                          
    SURGICAL BLADE 11                                                                                  
      ITEM_ID CATEGORY                                                                                 
    ITEM_DESCP                                                                                         
      1010169                                                                                          
    SUGRICAL BLADE 15                                                                                  
      1010176                                                                                          
    SUFUNE CATGUT - 2/0                                                                                
      1010177                                                                                          
    SUFUNE CATGUT - 3/0                                                                                
      1010193                                                                                          
    FOLEY CATHETER 12                                                                                  
      1010194                                                                                          
    FOLEY CATHETER 14                                                                                  
      1010195                                                                                          
    FOLEY CATHETER 16                                                                                  
      ITEM_ID CATEGORY                                                                                 
    ITEM_DESCP                                                                                         
      1010196                                                                                          
    FOLEY CATHETER 18                                                                                  
      1010197                                                                                          
    FOLEY CATHETER 20                                                                                  
      1010200                                                                                          
    SUCTON CATHETOR 10                                                                                 
      1010201                                                                                          
    SUCTON CATHETOR 12                                                                                 
      1010202                                                                                          
    SUCTON CATHETOR 14                                                                                 
      1010207 PRINTING STUFF                                                                           
    PATIENT CARD                                                                                       
      1010209 PRINTING STUFF                                                                           
      ITEM_ID CATEGORY                                                                                 
    ITEM_DESCP                                                                                         
    PRESCRIPTION CASH                                                                                  
      1010224 PRINTING STUFF                                                                           
    MEIDCAL REPORT BOOKS                                                                               
      1010237 PRINTING STUFF                                                                           
    CASH PAYMENT VOUCHER                                                                               
      1010238 PRINTING STUFF                                                                           
    CASH RECEIVED VOUCHER                                                                              
    29 rows selected.

    I solved by modifying the below code....
    SET_BLOCK_PROPERTY('COR_ITEM_DESCP', DEFAULT_WHERE, 'UPPER(ITEM_DESCP)LIKE UPPER(:CTRL.DIS_SRCH)||''%''');Regards
    Moazam Shareef

  • "CONNECT BY"-like query using XPath

    Greetings!
    The problem is as follows:
    I have a XML document whose main part contains a set of many subelements names "rasterFile". Each of this elements has an attribute "rasterRefId" which refers to another rasterFile element (to its id attribute). These references form a tree-like structure of parent and child rasters.
    What we need is to be able to effectively extract a subset of this structure, e.g. for rasterFile with id="4" we need to get this element, its referenced elements, and the elements referenced by the previously referenced elements (but we may request event four or five levels).
    Using a relation database, we should use the CONNECT BY statement, but the document is stored in a XMLType table containing only one row (we use only one large document). So I need to do this sort of query in XPath. How? Or is there any other way to do that?
    Thanks in advance.
    Petr
    The sample document (shortened, the original has about ten thousand rasterFile elements):
    <ber:backdropData xmlns:ber="http://www.berit.com/ber">
    <ber:name>bdemx</ber:name>
    <ber:description/>
    <ber:backdropLayer backdropRefId="bt_5002826" structure="hierarchical"
    format="jpeg">
    <ber:rasterFile id="ti_bt_5002826_jpeg_0_0x0" name="0-0x0.jpeg" decreaseRatio="2">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>1.2996519899999999 1.2996519899999999</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_1_1x1" name="1-1x1.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_0_0x0">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.6498259949999999 0.6498259949999999</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_1_1x0" name="1-1x0.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_0_0x0">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.6498259949999999 0.6498259949999999</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_1_0x1" name="1-0x1.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_0_0x0">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.6498259949999999 0.6498259949999999</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_1_0x0" name="1-0x0.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_0_0x0">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.6498259949999999 0.6498259949999999</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_3x3" name="2-3x3.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_1x1">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_3x2" name="2-3x2.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_1x1">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_3x1" name="2-3x1.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_1x0">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_2x3" name="2-2x3.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_1x1">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_2x2" name="2-2x2.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_1x1">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_2x1" name="2-2x1.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_1x0">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    <ber:shear>0.0 0.0</ber:shear>
    <ber:translate>633142.205995 239189.641789</ber:translate>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_1x3" name="2-1x3.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_0x1">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_1x2" name="2-1x2.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_0x1">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_1x1" name="2-1x1.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_0x0">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_1x0" name="2-1x0.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_0x0">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_0x3" name="2-0x3.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_0x1">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_0x2" name="2-0x2.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_0x1">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_0x1" name="2-0x1.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_0x0">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_0x0" name="2-0x0.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_0x0">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    </ber:backdropLayer>
    </ber:backdropData>

    Thanks for reply.
    Well, the view doesn't seem to help me. We have only one xml document stored and therefore there is only one row in the XMLType table. Using the "SELECT extract()" statement returns one row containing whole result (in CLOB or whatever) and the view has the same problem.
    What would solve this problem is the query for a collection of elements that would return each resulting element in a single row. But I haven't been able to find out how to do such a thing.
    Petr

  • Looking for a keyword using like query which could contain multiple occurrence in the same column

    I am facing an issue. A bunch of my frontend JSP code has been stored in few tables of my database (65 rows in a table), which I have identified using few like queries. Now I want to update a Href link which is present in all these queries. But since these column entries are very long (50-60 lines long) and it is possible that a few rows may the link (which is to be replaced), multiple times,  I am not sure that if a simple update query using a single like will work for it or not?
    Any suggestion/ideas are welcome.
    Please let me know if you require any more info.

    Hi,
    e5d4d744-cf66-4fe0-8353-bbd8fd826b21 wrote:
    I am facing an issue. A bunch of my frontend JSP code has been stored in few tables of my database (65 rows in a table), which I have identified using few like queries. Now I want to update a Href link which is present in all these queries. But since these column entries are very long (50-60 lines long) and it is possible that a few rows may the link (which is to be replaced), multiple times,  I am not sure that if a simple update query using a single like will work for it or not?
    Any suggestion/ideas are welcome.
    Please let me know if you require any more info.
    Yes; whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), so that the people who want to help you can re-create the problem and test their ideas.
    Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
    Simplify the problem as much as possible.  For example, if your strings are sometimes up to 4000 characters long, you don't have to post any data that's nearly that long.  You can probably show what you want with strings that are 80 characters long.
    Always say which version of Oracle you're using (for example, 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002#9362002
    This statement:
    UPDATE table_x
    SET str  = REPLACE ( str
                       , old_link
                       , new_link
    WHERE   str  LIKE  '%' || old_link || '%'
    will change all occurrences of old_link to new_link.  It will only change the rows where old_link occurs, but, aside from that, it doesn't matter how many times old_link occurs in str:  if it appears 2 times in the same str, then both occurrences will be changed to new_link.
    Watch out for the "mother is in chemotherapy" problem.  If old_link is 'bar.com', the statement above will change 'fubar.com'.  You may need REGEXP_REPLACE and/or REGEXP_LIKE if you need to consider what (if anything) comes immediately before 'bar.com' when deciding whether or not to change it.

  • Binding with a LIKE query

    I am using PHP and ORACLE and am having trouble with binding. I can get a basic bind to work, but I am having trouble with a more complex query like this:
    $oracle_search_name = 'some input text';
    $query1 = "SELECT source_title FROM records WHERE UPPER(source_title) LIKE UPPER('%$oracle_search_name%')";
    It works OK without binding, but how can I replace $oracle_search_name with a bind variable? Simply replacing the $ sign with a colon doesn't seem to work.

    Hey cj,
    Thanks for the help! That seems to do the trick.
    I noticed that you capitalized the bind variable in the OciBindByName() function. Is that required? Here is my example:
    OciBindByName($s, ":MY_BIND_VARIABLE", $my_bind_variable, -1); // Capitalized ":MY_BIND_VARIABLE"
    Also, another question: Will Oracle automatically understand to bind multiple instances of the bind variable like this?
    SELECT tid, col1, col2, col3 FROM test1 WHERE UPPER(col1) LIKE UPPER('%'||:my_bind_variable||'%') OR UPPER(col2) LIKE UPPER('%'||:my_bind_variable||'%')
    That seems to work correctly but I am having trouble finding a detailed reference online about binding in Oracle.
    Thanks again for the input.

  • X-Path like Query option for XMLModel?

    Hi,
    is there an option to use x-path-like queries in the XMLModel?
    E.g.
    <?xml version="1.0" encoding="UTF-8"?>   
    <main> 
                             <config> 
                                        <mode>1</mode>  
                                        <ext> 
                                            <item date="January 2009">                                         
                                            <unit>900</unit> 
                                            <current>1</current>  
                                            <interactive>1</interactive> 
                                            </item> 
                                       </ext> 
                             </config>  
                              <config> 
                                         <mode>2</mode>   
                                        <ext> 
                                               <item date="February 2009">                                      
                                            <unit>400</unit>   
                                            <current>2</current>  
                                            <interactive>5</interactive>   
                                             </item> 
                                       </ext> 
                           </config>  
    </main> 
    and
    var oTable2 = new sap.ui.table.Table();   
    oTable2.bindRows("/config['mode='1'']/ext"); 
    to select a node directly?
    The source is from an old Post [SAPUI5 - XMLModel]  Xpath filter ? where the solution was to loop through the result.
    Does SAPUI support X-Path like queries in the meantime?
    Thanks,
    Oliver

    I'm not sure about an xpath query (which was deprecated in JCR 2.0), but here's how you could use the JCR API to retrieve all of the versions from a path:
         * Returns all of the versions at the specified path as a List of Versions.
         * @param session
         *            the currect JCR session, must not be null
         * @param path
         *            the absolute path of the node to retrieve
         * @return the list of versions at the specified path
         * @throws UnsupportedRepositoryOperationException
         *             thrown if the node at the specified path is not versionable
         * @throws RepositoryException
         *             an unexpected exception occurs interacting with the JCR
         *             repository
        public List<javax.jcr.version.Version> getVersions(final Session session,
            final String path) throws UnsupportedRepositoryOperationException,
            RepositoryException {
        final List<Version> versions = new ArrayList<Version>();
        final VersionManager versionMgr = session.getWorkspace()
            .getVersionManager();
        final VersionHistory versionHistory = versionMgr
            .getVersionHistory(path);
        final VersionIterator versionIterator = versionHistory.getAllVersions();
        while (versionIterator.hasNext()) {
            versions.add(versionIterator.nextVersion());
        return versions;

  • Pivot like query

    create table t1(id1 number,name varchar2(10));
    create table t2(id1 number,id2 number,name_value varchar2(10));
    create table t3(id2 number, name1 varchar2(10));
    insert into t1 (ID1, NAME)
    values (1, 'dave');
    insert into t1 (ID1, NAME)
    values (2, 'rob');
    insert into t1 (ID1, NAME)
    values (3, 'matt');
    insert into t1 (ID1, NAME)
    values (4, 'mike');
    insert into t2 (ID1, ID2, NAME_VALUE)
    values (1, 6, 'val1');
    insert into t2 (ID1, ID2, NAME_VALUE)
    values (2, 6, 'val2');
    insert into t2 (ID1, ID2, NAME_VALUE)
    values (3, 7, 'val3');
    insert into t2 (ID1, ID2, NAME_VALUE)
    values (4, 7, 'val4');
    insert into t3 (ID2, NAME1)
    values (6, 'snap');
    insert into t3 (ID2, NAME1)
    values (7, 'tom');
    insert into t3 (ID2, NAME1)
    values (8, 'harry');
    insert into t3 (ID2, NAME1)
    values (9, 'katie');
    i want output as
      name1 DAVE rob  matt mike   as columns
      snap val1 val2  null null
      tom  null  null  val3  val4

    SolomonYakobson wrote:
    Why do you group by?
    Because I confused myself ?
    I included all columns in initial query:
       ( select t1.id1, t2.id2,
                t1.name,
                t2.name_value,
                t3.name1
    Because of that, the pivot returns looking like this:
           ID1        ID2 NAME1      'dave'     'rob'      'matt'     'mike'  
             3          7 tom                              val3               
             2          6 snap                  val2                          
             1          6 snap       val1                                     
             4          7 tom                                         val4    
    4 rows selected.
    So yeah, remove those from the initial part, and don't need the group by.
    Didn't notice that.   Thanks for pointing it out.

  • Like Query Tuning

    Hi
    I am new to Performance tuning and I know only very basic things.
    My DB version is 10.2.0.4.
    I want to tune my query which uses like clause and it is a dynamically created with either left truncation or right truncation or both.
    I found in some sites that catserach will solve my problem and i tried the same in test DB.
    So I did the following.
    SQL >alter system flush buffer_cache;
    GRANT EXECUTE ON CTX_DDL TO user;
    EXEC CTX_DDL.DROP_INDEX_SET('test_set');
    EXEC CTX_DDL.CREATE_INDEX_SET('test_set');
    EXEC CTX_DDL.ADD_INDEX('test_set','d');
    create index test_table_idx on test_table(c) INDEXTYPE IS CTXSYS.CTXCAT PARAMETERS ('index set test_set');
    SQL> SELECT COUNT(*) COUNT, a, b FROM test_table
    WHERE UPPER(c) LIKE '%270%' AND d = 0 GROUP BY a, b ;
    5664 rows selected.
    Elapsed: 00:00:12.29
    Execution Plan
    Plan hash value: 4088289091
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Ti
    me |
    | 0 | SELECT STATEMENT | | 59358 | 1739K| | 8039 (4)| 00:01:37 |
    | 1 | HASH GROUP BY | | 59358 | 1739K| 5144K| 8039 (4)| 00:01:37 |
    |* 2 | TABLE ACCESS FULL| test_table | 59358 | 1739K| | 7547 (4)| 00:01:31 |
    Predicate Information (identified by operation id):
    2 - filter(UPPER("C") LIKE '%270%' AND "D"=0)
    Statistics
    812 recursive calls
    0 db block gets
    33459 consistent gets
    33206 physical reads
    0 redo size
    168223 bytes sent via SQL*Net to client
    4639 bytes received via SQL*Net from client
    379 SQL*Net roundtrips to/from client
    22 sorts (memory)
    0 sorts (disk)
    5664 rows processed
    SQL >alter system flush buffer_cache;
    SQL> SELECT COUNT(*) COUNT, COUNT, a, b FROM test_table
    WHERE CATSEARCH(C,'<query> <textquery grammar="context">%270% </textquery></query>',NULL) > 0
    GROUP BY a, b;
    5664 rows selected.
    Elapsed: 00:00:27.51
    Execution Plan
    Plan hash value: 2203090224
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 59369 | 2261K| | 606 (2)| 00:00:08 |
    | 1 | HASH GROUP BY | | 59369 | 2261K| 6072K| 606 (2)| 00:00:08 |
    | 2 | TABLE ACCESS BY INDEX ROWID| test_table | 59369 | 2261K| | 2 (0)| 00:00:01 |
    |* 3 | DOMAIN INDEX | test_table_idx | | | | | |
    Predicate Information (identified by operation id):
    3 - access("CTXSYS"."CATSEARCH"("C",'<query> <textquery grammar="context">%270% </textquery></query>',NULL)>0)
    Statistics
    17856 recursive calls
    0 db block gets
    26550 consistent gets
    9047 physical reads
    0 redo size
    168223 bytes sent via SQL*Net to client
    4639 bytes received via SQL*Net from client
    379 SQL*Net roundtrips to/from client
    8 sorts (memory)
    0 sorts (disk)
    5664 rows processed.
    I did all the above steps purely from reading some documents.
    Can anyone explain me
    1. if catsearch is the best option based on the stats (as catsearch option has many recursive calls).
    2. What is the purpose of Oracle Grammar
    3. What is the purpose of EXEC CTX_DDL.CREATE_INDEX_SET('test_set'); ??
    4. I used grammar only for right and both side truncation and for left truncation my where clause is
    WHERE CATSEARCH(C,'1044*',NULL) > 0 AND D = 0 GROUP BY A,B;
    Also Can I modify the above where clause as
    WHERE CATSEARCH(C,'1044*',' D = 0 ' > 0 GROUP BY A,B;
    and explain the same pls.

    Here is the Trace for bit map.
    DROP INDEX test_table_idx;
    CREATE bitmap INDEX test_table_idx ON test_table(c) PARALLEL 20 nologging;
    SELECT COUNT(*) COUNT, a, b FROM test_tableWHERE UPPER(c) LIKE '1044270%' AND d = 0 GROUP BY a, b
    Elapsed: 00:00:00.85
    Execution Plan
    Plan hash value: 7812215
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 59358 | 1739K| | 87592 (1)| 00:17:32 |
    | 1 | HASH GROUP BY | | 59358 | 1739K| 5144K| 87592 (1)| 00:17:32 |
    |* 2 | TABLE ACCESS BY INDEX ROWID | test_table | 59358 | 1739K| | 87100 (1)| 00:17:26 |
    | 3 | BITMAP CONVERSION TO ROWIDS| | | | | | |
    |* 4 | BITMAP INDEX FULL SCAN | test_table_idx | | | | | |
    Predicate Information (identified by operation id):
    2 - filter("C"=0)
    4 - filter(UPPER("C") LIKE '1044270%')
    Statistics
    1 recursive calls
    0 db block gets
    5310 consistent gets
    0 physical reads
    0 redo size
    657 bytes sent via SQL*Net to client
    492 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    1 rows processed
    SELECT COUNT(*) COUNT, a, b FROM test_table WHERE UPPER(c) LIKE '10%' AND d = 0 GROUP BY a, b ;
    687644 rows selected.
    Elapsed: 00:00:35.26
    Execution Plan
    Plan hash value: 7812215
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 59358 | 1739K| | 87592 (1)| 00:17:32 |
    | 1 | HASH GROUP BY | | 59358 | 1739K| 5144K| 87592 (1)| 00:17:32 |
    |* 2 | TABLE ACCESS BY INDEX ROWID | test_table | 59358 | 1739K| | 87100 (1)| 00:17:26 |
    | 3 | BITMAP CONVERSION TO ROWIDS| | | | | | |
    |* 4 | BITMAP INDEX FULL SCAN | test_table_idx | | | | | |
    Predicate Information (identified by operation id):
    2 - filter("C"=0)
    4 - filter(UPPER("C") LIKE '10%')
    Statistics
    21 recursive calls
    0 db block gets
    246786 consistent gets
    10328 physical reads
    0 redo size
    20956978 bytes sent via SQL*Net to client
    504754 bytes received via SQL*Net from client
    45844 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    687644 rows processed
    SELECT COUNT(*) COUNT, a, b FROM test_table WHERE UPPER(c) LIKE '%EXT' AND d = 0 GROUP BY a, b
    118760 rows selected.
    Elapsed: 00:01:13.34
    Execution Plan
    Plan hash value: 7812215
    | Id | Operation | Name | Rows | Bytes |TempS
    pc| Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 59358 | 1739K| | 87592 (1)| 00:17:32 |
    | 1 | HASH GROUP BY | | 59358 | 1739K| 5144K| 87592 (1)| 00:17:32 |
    |* 2 | TABLE ACCESS BY INDEX ROWID | test_table | 59358 | 1739K| | 87100 (1)| 00:17:26 |
    | 3 | BITMAP CONVERSION TO ROWIDS| | | |
    | | |
    |* 4 | BITMAP INDEX FULL SCAN | test_table_idx | | | | | |
    Predicate Information (identified by operation id):
    2 - filter("C"=0)
    4 - filter(UPPER("C") LIKE '%0EXT')
    Statistics
    1 recursive calls
    0 db block gets
    122629 consistent gets
    13682 physical reads
    0 redo size
    3534421 bytes sent via SQL*Net to client
    87579 bytes received via SQL*Net from client
    7919 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    118760 rows processed

  • LIKE Query Optimization

    Hello!
    I'm building dinamic SQL to query a products table, and i use LIKE '%xxx%' statements
    to search the table. How can i optimize this?
    Oracle would not use any index, isn't it?
    READ ONLY transactions would speed anything?
    Thanks.,
    ferran

    If you're searching on, say, a product description, you might want to consider using interMedia.
    I worked on a database behind a web-site that held many documents. These documents could be searched for a word or phrase, and response time was near instantaneous. A bit more set-up is required than simple sticking the text in a VARCHAR2, but the payback is much more flexible, powerful (and fast!) searching.
    Using READ ONLY transactions might give you a small speed advantage, but nothing that will significantly conteract the effect of LIKE '%xxx%'.
    null

Maybe you are looking for

  • I've downloaded firefox19. When I click on the exe. file I don't have a "run" option. What do I do?

    Running Win 7 on ASUS K53E notebook with 2 GHz cpu and 4GB ram. I installed software for an older digital camera and started getting "Firefox is already running....." message. I did a soft boot with no change. I uninstallled and re-installed Firefox

  • Remove stock from Quality Inspection

    Dear All, In material master by mistak quality inspection flag was active in packing material with 01 inspection type. When we received material it goes for quality inspection after MIGO. So in MMBE it shows in Quality Inspection. Now the Plant in wh

  • From Which table Title is coming ?

    Hi Experts, Am currently learning hr abap, while fetching employee personnel details, am not getting from where title(Mr and Mrs) is coming, in screen pa30 it showing that is coming from Q0002 but it is a structure. plz help me to know this. Thanks a

  • Selling online audio - Developer / Help wanted where to start

    I need to develop a site to sell music tracks as MP3's which a user can search for, select, add to cart, pay for and have the track automatically emailed. Any ideas where to start / who to approach for something like this? Are any ecommerce templates

  • Premiere CS6 MXF problems?

    Hi since i installed premiere CS6 i have a lot of problems THE PC that i have is win 7 pro 64 bits  SSD disk for systems and 2 HDD SAta of 2TB each one Video card envidia GT650 , 8 GB Ram first problem >> premiere don't start usually i have to press