Search by prefix in the escape character

Hello experts,

I'm using Oracle 11.2.03.  I have a clue of context and I want to be able to precede the generic search on escape characters.

For example

Select * from indvl where contains (indvl_nm, {abc} %)

It only gives me abc and no abcd

Note :{} charchter are also defined as the character of printjoin for my index

As far as I know, you cannot combine a sentence with surrounded by {} with wildcard characters escape sequence.  However, you can combine the preface escape characters by------with wildcards.  I'm guessing you're automatically encompassing all with {and}.  I suggest that you not do this and escape individual characters instead.  For more convenience, you can write a function for this.  I presented a demo below with a few characters.  You can expand that to include more characters.  If there are a lot of things that you want to automatically escape, then you might want to use regexp_replace instead of replace it.

[email protected] > create table indvl

2 (indvl_nm varchar2 (30))


Table created.

[email protected] > insert all

2 in indvl values ('abc')

3 in indvl values ("abcd")

4 in indvl values ('is 3')

5 Select * of the double


3 lines were created.

[email protected] > start

2 ctx_ddl.create_preference ('indvl_lex', 'basic_lexer');

3 ctx_ddl.set_attribute ('indvl_lex', 'printjoins', ' {} = "");

4 end;


PL/SQL procedure successfully completed.

[email protected] > create index indvl_idx

2 on indvl (indvl_nm)

3 indextype is ctxsys.context

4 parameters ("lexer indvl_lex")


The index is created.

[email protected] > create or replace function format_search

2 (p_string in varchar2)

3. return varchar2

4, as

5 v_string varchar2 (4000): = p_string;

6 start

7 v_string: = replace (v_string, ' {',' \ {'}});

8 v_string: = replace ({v_string, '} {','------} "");

9 v_string: = replace (v_string, 'is', ' \ =');

10 and so on for all other special characters

11 return v_string;

12 end format_search;


The function is created.

[email protected] > display errors

No errors.

[email protected] > select * from indvl where contains (indvl_nm, format_search ('abc %')) > 0))






2 selected lines.

[email protected] > select * from indvl where contains (indvl_nm, format_search ('== %')) > 0))




is 3

1 selected line.

Tags: Database

Similar Questions

  • How to use the escape character in the update statement.

    Hi all

    I'm trying to update using the following table update statement in sql, but whenever he asks me to enter the value 'and' below sql.
    UPDATE xyz_xyz
       SET NAME = 'ABC & PQR'
                   FROM abc_abc
                  WHERE NAME = 'C & PQR');
    Please let me know how to use escape character syntax or let me know if there is no alternative.

    Thank you

    If you use SQL * more then use SET DEFINE OFF.

    Also, you can do something like this

    UPDATE xyz_xyz
       SET NAME = 'ABC' ||'&' || 'PQR'
                   FROM abc_abc
                  WHERE NAME = 'C' ||'&' ||'PQR');
  • Data error Services POST Oracle REST of the escape character

    I get an error 400 Bad Request of ADR operating POST or PUT with JSON that contains a slash reverse to escape the quotes and forward slashes, etc using Java.  How can I POST JSON with these types of characters?

    Oracle REST Services 2.0.9 data 224.01.05


    Thanks in advance for any help.


    Oracle support:

    The 404 Bad Request appears as the ORDS JSON parser does not accept escape forward slash (/) characters. Remove the slash before each slash to solve the problem

    Using the example provided, change:

    "WebURL": 'http:///\/ \/enterprise","LogoURL":"http:///\/\/clients\/pxx2014\/Custom\/354881.jpg","Category":"Consulting, Education\/training, Service industry '...

    ... for:

    "WebURL": "", 'LogoURL': '', 'Category': 'Consulting, training, Service industry '...

    Escaping the obliques is allowed in the JSON specification, but is not necessary.  It of a minor flaw in the ORDS JSON parser and is addressed in the final version of 3.0.x. All other escaping works very well with the ORDS JSON parser.

  • the escape character in the where clasue always on logical layer

    My application requires "A WHERE Clause" filter on the table of the logic layer where the in-list has grown from a session variable.

    for example, I get a session named 'UserList' ('Jack', 'ken');

    I want to filter the information by the Userlist, and it seems to a have problem charater escape, the single quotation mark will cause trouble.
    It works fine when I add "' jack', 'ken'" manually in which would adopt, but if I use VALUEOF (NQ_SESSION. ("' userList '), it failed.

    There is some information for your reference:
    1. in the reply, I want to know the value of 'UserList', here I show in State text: @{biServer.variables ["NQ_SESSION. UserList"]}

    It shows as below
    Jack ',' ken

    2. in the available session initializaiton block, I test, the "Userlist" works well, it is 'jack', 'ken' as we hoped.

    Edited by: island_man August 7, 2012 12:26

    Edited by: island_man August 7, 2012 12:27 AM

    Hi user,

    Normal session variable will not work in your case. Opt for the block row of sage of initialization,

    Kind regards

  • Deactivation of the PowerShell escape character

    I need to use Get-VMGuestNetworkInterface on about 100 mV.  They are members of domain created from the same template with the same local administrator account.  Unfortunately, the local administrator password using the 'character.  The "character is the PowerShell escape character.  The escape character will not allow itself be included with a string value, so when I try to pass the parameter - GuestPassword, it does not include the "character, the password is incorrect, and the authentication will fail.  Anyone know who to use the "character in a string literal?

    Depends on hwo you pass the string between apostrophes, the backtick didn't need to be escaped (' pass'word ').

    Quotation marks, use the back-slash ("past" word")

  • Before escape character point in the dn entry after provisioning OID

    Our users IOM are automatically provisioned to OID using OID box connector. Everything works well except this issue.

    When the value of "User login" IOM contains the character (called BILLY. (BOB), the dn entry in OID is created with an escape character (dn: uid = BILLY\.) BOB, cn is users, dc = abc, dc = com).

    'User Login' IOM = BILLY. BOB
    OID entry created as
    DN: uid is BILLY\. BOB, cn is users, dc = abc, dc = com
    First name: Billy
    CN: Billy Bob

    Note that the uid does not get the escape character, only the dn value is getting affected.

    Thanks in advance!

    You must remove. in the definition of research, which comes with STANDARD connector.

    Re: OID Connector.User Id includes "------" seen by DOHAD

  • get an error to remove and update statement using the escape char

    for the following statement:
    Order of UPDATE
    circuit AS in_service_id | '------%' ESCAPE ' \'
    AND ord_id = "ORD1."

    getting below error:

    ORA-01424: missing or illegal character that follows the escape character

    any suggestions?

    Assuming that in_service_id is a variable

    The value of the variable can have any value that is having '-' char, this statement will give error.

    This can help.

    Order of UPDATE
    circuit AS replace(in_service_id,'\','\\') | '------%' ESCAPE ' \'
    AND ord_id = "ORD1."

  • escape character must be the string of length 1 (error ORA-01425)

    Hi all!

    I get this error message (SQL error: ORA-01425: escape character must be the string of length 1) when querying an oracle 9i database with:

    SELECT * FROM table WHERE column LIKE '%' ESCAPE ' \';

    Bar which makes it a double backslash (included with apostrophes) would solve the problem, however, with this change, the request is more executable in a 10g database.

    Is there a way to make the executable SQL above (with a single backslash escape) code in both (and latest) versions, without changing it? Maybe a server definition database that could solve this problem...

    Suggestions for the problem described are greatly appreciated!

    Thank you

    col2 NVARCHAR2 (100)

    OK, you should have mentioned before using unicode ;)

    However, should not always identical fields be treated identically in any database?...

    Yes, they should :(

    In any case the escape string should obviously be treated as unicode so the right way, I guess, would be

      select * from mytable where col2 like N'%' escape N'\'; 

    Note the front N ' \' to make the unicode string.

  • Best preferences for queries to prefix with the index catalog (CTXCAT)

    Documentation for Oracle Text gives this example of a setting preferred prefix/substring for the index catalog and context:

    ctx_ddl.create_preference ('mywordlist', 'BASIC_WORDLIST');
    ctx_ddl.set_attribute ('mywordlist', 'PREFIX_INDEX', 'TRUE');
    ctx_ddl.set_attribute ('mywordlist', 'PREFIX_MIN_LENGTH', ' 3');
    ctx_ddl.set_attribute ('mywordlist', 'PREFIX_MAX_LENGTH', ' 4');
    ctx_ddl.set_attribute ('mywordlist', 'SUBSTRING_INDEX', 'YES');

    The SUBSTRING_INDEX attribute is really necessary if I only ever issue that research prefix, such as:

    Auction title SELECT FROM WHERE CATSEARCH (title, ' cam *', ") > 0;

    I'm not sure that you understand the difference between the PREFIX_INDEX and the SUBSTRING_INDEX.

    Substring is intended to speed up searches "double truncation", especially for the requirements specialist such as the research of the chemical name, where you want to search "% fluoro" or similar.

    It is NOT recommended for general use, because it significantly slows down indexing and makes the very much larger indices.

    Prefix allows you to speed up the search for right truncated simple searches such as '% of cam', but it's not normally necessary.

    For general use with middle office truncation and right (for example "oracl %" or "% key ora") I would not use one of these options. Double truncation or truncation on the left ("% racl %" or "% scrapes") should be avoided as far as possible - use of the wildcard character to start without the option of substring will cause a full table scan on the index table $I to find all words that match, given that the index can not be used with a wildcard to start.

  • How to control the rendering of the tab character in a TXT file?

    When I browse a TXT file, the tab character is rendered in order to look a lot like 8 places. Is there a way to control the apparent number of spaces in the rendering? Yes, I know that things like

                   pre { tab-size: 4 }

    in CSS3 could control this number in the rendering of HTML elements, but I want a control similar to a TXT file.

    Or if you want to use CSS, this bookmarklet will insert the style rule on the page:

    javascript:var r="pre{-moz-tab-size:4;}"; var s=document.createElement("style"); s.type="text/css"; s.appendChild(document.createTextNode(r)); document.body.appendChild(s); void 0;

    (Note that at least for now, you must prefix-moz - on the size of tabs in Firefox.)

  • search for file names with tilde character

    trying to locate all the file name containing the tilde (~) character. It is obviously special for the search as a search looking for files with this character corresponds to each file. I can't find the mechanism to quote the tilde so that Windows will search for files containing the tildes in name literally.

    You expect to be easy to find the answer, but then I found others asking the question. I can't find the answer.

    See the following article on research in Vista:  I ' ts faily basic and probably does not cover what you need to know to make the research you are tyring to do.

    Here is an article on research options in Vista:

    Here is an article on the use of advanced query options to improve searches in Vista (I think yuu might find your answer in this one):

    Here is an article with a number of advanced search options and how format the queries that may be helpful:

    I hope this helps.  If not go back and I'll try to find more resources or attempting to do myself to see if I can understand how do.  It seems that Mr. Wizard answered the question before I coulld end my post. The anwer to the 'why' is probably contained in the above items.

    Good luck!

    Lorien - MCSA/MCSE/network + / has + - if this post solves your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • Whenever I try to search in Windows Explorer, the files listed do not have the requested content.


    One of my end-users using Windows search in Explorer to search for a particular value (> 8).  Once the search is complete, several files are listed, but when it opens in Word 2010 and looks exactly the same value, it is said that the value is found.  Why the world is happening?  What research watch hidden in files, or only the visible content attributes?
    Thank you.

    The content property is not available on the upper level, less than, or other symbols comparative.  You can only search for characters.    And if you try to find the real character > itself, which does not work well.  The only non-alphanumeric characters that are available are ____, /, and -(I have tested the symbols on the keyboard).

    Update: I have found since the other characters are available, using a special syntax.  For example:

    content: ~ = "> 8"

    Who would find files that contain characters specific > 8 anywhere, as long as they are together in this order.

    [Update: apparently special search symbols such as ~ = do not work with the content when property indexed research places, but work during the search in unindexed locations.]

    And another thing, simply chokes Windows 7 Search on the search for Word files when these same Word files are open, especially if they are in a folder with a large number of files, if I remember that well.

  • RegExp search and replace, keep the formatting of the original text


    Will have to perform the Search and replace within a framework of text using RegExp.

    And to retain the original formatting of the text block.

    How is it possible?

    Bad example-, it converts all the text formatting to the format of the first character:

    var reg = /a/gmi;
    var replacer = '*';
    var fr = activeDocument.textFrames[0];
    fr.contents = fr.contents.replace (reg , replacer);


    Thank you!

    I has not yet been tested your code.

    But why you did not play with my code snippet, use something like this:

    // regex_changeContentsOfWordOrString_RemainFormatting.jsx
    // regards pixxxel schubser
    var s = /arguments/gi;
    var replacer = "other string", result;
    var atf = activeDocument.textFrames[0];
    while (result = s.exec(atf.contents)) {
        try {
            aCon = atf.characters[result.index];
            aCon.length = result[0].length;
            aCon.contents = replacer;
            } catch (e) {};

    Try it and have fun

  • How use Bridge to rename the batch to remove all characters after the 32nd character?

    I would like to batch rename to remove all characters after the 32nd character. Is this possible?

    Substitution string use with use of regular expressions is selected.

    In the use of the search field


    In the field using replace

  • Use Escape character * as wildcard chacater.

    I'm using Oracle

    Select * from TEXT_TBL where catsearch(srch_nm,'B\*BANK','') > 0

    gives me:


    B * BANK LLC

    However, select * from TEXT_TBL where catsearch (srch_nm,'B\ * BANK*', ") > 0 is not return all records.  I think that the 2nd instance of * is also to be escaped and not used as a wildcard. Is it possible to escape the first failure of * and use the second failure of * as a reserved word.

    Thanks for you time.

    HeraldtenDam wrote:

    the wildcard character in Oracle Text is not * but the %

    The wildcard character for contains a context index is %, but the wildcard for catsearch with a ctxcat index *.  The following example shows that you get good results without defining the asterisk as a printjoin, but his definition of the asterisk as a printjoin gives incorrect results.

    [email protected]_11gR2 > select * from version $ v




    Oracle Database 11 g Enterprise Edition Release - 64 bit Production

    PL/SQL Release - Production

    CORE Production

    AMT for 64-bit Windows: Version - Production

    NLSRTL Version - Production

    5 selected lines.

    [email protected]_11gR2 > create table text_tbl

    2 (srch_nm varchar2 (30))


    Table created.

    [email protected]_11gR2 > insert all

    2 in text_tbl values ('B * BANK MARKETS LLC "")

    3 in text_tbl values ('B * BANK LLC "")

    4 in text_tbl values ('B * BANKtest LLC "")

    5 in text_tbl values ("BaBANKtest LLC")

    6 in text_tbl values ("another name")

    7 select * of the double


    5 rows created.

    [email protected]_11gR2 > create index text_idx

    2 on text_tbl (srch_nm)

    3 indextype is ctxsys.ctxcat


    The index is created.

    [email protected]_11gR2 > select Dr.$ Dr. chips $ text_idx$ I


















    14 selected lines.

    [email protected]_11gR2 > select * from TEXT_TBL

    2 where catsearch (srch_nm, ' B\ * BANK ', ") > 0





    B * BANK LLC

    2 selected lines.

    [email protected]_11gR2 > select * from TEXT_TBL

    2 where catsearch (srch_nm, ' B\ * BANK *', ") > 0





    B * BANK LLC

    B * BANKtest LLC

    3 selected lines.

    [email protected]_11gR2 > drop index text_idx


    The index is deleted.

    [email protected]_11gR2 > start

    2 ctx_ddl.create_preference ('text_lexer', 'basic_lexer');

    3 ctx_ddl.set_attribute ('text_lexer', 'printjoins', ' *');

    4 end;


    PL/SQL procedure successfully completed.

    [email protected]_11gR2 > create index text_idx

    2 on text_tbl (srch_nm)

    3 indextype is ctxsys.ctxcat

    4 parameters ("lexer text_lexer")


    The index is created.

    [email protected]_11gR2 > select Dr.$ Dr. chips $ text_idx$ I





    B * BANK

    B * BANK









    11 selected lines.

    [email protected]_11gR2 > select * from TEXT_TBL

    2 where catsearch (srch_nm, ' B\ * BANK ', ") > 0





    B * BANK LLC

    2 selected lines.

    [email protected]_11gR2 > select * from TEXT_TBL

    2 where catsearch (srch_nm, ' B\ * BANK *', ") > 0


    no selected line

Maybe you are looking for

  • iTunes menu bar

    My iTunes does not ikon menu or menu bar. What measures are needed to restore these features?

  • Tecra M1 full installation - no recovery disk

    I want to install Windows XP pro on my Tecra M1. It can not recognize the wireless card, and I just tried all the drivers in the download for Toshiba Tecra M1 section. The only error I have found on the Net controller in Windows XP hardware device.ON

  • Impossible to stream multimedia content to my TV

    Original title: Windows Media Player (already run version 11) First of all, my apologies if I'm posting this question in the wrong forum! I recently bought a Sony Bravia TV with internet connection.  Part of its characteristics, is that I should be a

  • message from Hotmail account giving lockout

    I'm trying to connect with my ID but get the message of locking! I still have my password using your link in another mail.  crucial information are locked in my account. help out me.

  • Remove Office Add-ins - Windows does not recognize my administrator status

    Even if I'm already logged as an administrator, I get the message "You must be an administrator to remove these add-ins" when trying (in vain) remove an add-in