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.

Scott@orcl12c > create table indvl

2 (indvl_nm varchar2 (30))

3.

Table created.

Scott@orcl12c > insert all

2 in indvl values ('abc')

3 in indvl values ("abcd")

4 in indvl values ('is 3')

5 Select * of the double

6.

3 lines were created.

Scott@orcl12c > start

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

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

4 end;

5.

PL/SQL procedure successfully completed.

Scott@orcl12c > create index indvl_idx

2 on indvl (indvl_nm)

3 indextype is ctxsys.context

4 parameters ("lexer indvl_lex")

5.

The index is created.

Scott@orcl12c > 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;

13.

The function is created.

Scott@orcl12c > display errors

No errors.

Scott@orcl12c > select * from indvl where contains (indvl_nm, format_search ('abc %')) > 0))

2.

INDVL_NM

------------------------------

ABC

ABCD

2 selected lines.

Scott@orcl12c > select * from indvl where contains (indvl_nm, format_search ('== %')) > 0))

2.

INDVL_NM

------------------------------

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'
     WHERE ID = (SELECT ID
                   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
    Vishwas

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

    Also, you can do something like this

    UPDATE xyz_xyz
       SET NAME = 'ABC' ||'&' || 'PQR'
     WHERE ID = (SELECT ID
                   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

    Database 11.2.0.3

    Thanks in advance for any help.

    Raymond

    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:///\/testsite.domain.net\/clients\/pxx2014\/Custom\/354881.jpg","Category":"Consulting, Education\/training, Service industry www.testsite.com '...

    ... for:

    "WebURL": "http://www.testsite.com/enterprise", 'LogoURL': 'http://testsite.domain.net/clients/pxx2014/Custom/354881.jpg', '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,

    http://Oracle-BI.siebelunleashed.com/articles/rowwise-session-var/

    Kind regards
    DpKa

  • 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).

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

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

    Thanks in advance!
    Kabi

    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
    A DATE = NULL
    WHERE
    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
    A DATE = NULL
    WHERE
    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:

    Start
    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');
    end;

    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: http://www.vistax64.com/tutorials/75447-search-options.html.  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: http://www.vistax64.com/tutorials/75451-advanced-search.html.

    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): http://www.vistax64.com/tutorials/158288-advanced-searches.html.

    Here is an article with a number of advanced search options and how format the queries that may be helpful: http://windowsteamblog.com/windows/archive/b/windowsvista/archive/2007/05/09/advanced-search-techniques.aspx.

    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.

    Hello.

    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

    Hello!

    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);
    

    find_and_replace_regexp.jpg

    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

    ^(.{32})(.*)
    

    In the field using replace

    $1
    
  • Use Escape character * as wildcard chacater.

    I'm using Oracle 11.2.0.3.

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

    gives me:

    B * BANK MARKETS LLC

    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.

    Scott@orcl_11gR2 > select * from version $ v

    2.

    BANNER

    --------------------------------------------------------------------------------

    Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production

    PL/SQL Release 11.2.0.1.0 - Production

    CORE 11.2.0.1.0 Production

    AMT for 64-bit Windows: Version 11.2.0.1.0 - Production

    NLSRTL Version 11.2.0.1.0 - Production

    5 selected lines.

    Scott@orcl_11gR2 > create table text_tbl

    2 (srch_nm varchar2 (30))

    3.

    Table created.

    Scott@orcl_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

    8.

    5 rows created.

    Scott@orcl_11gR2 > create index text_idx

    2 on text_tbl (srch_nm)

    3 indextype is ctxsys.ctxcat

    4.

    The index is created.

    Scott@orcl_11gR2 > select Dr.$ Dr. chips $ text_idx$ I

    2.

    TOKEN OF $ DR

    ----------------------------------------------------------------

    ANOTHER

    B

    B

    B

    BABANKTEST

    BANK

    BANK

    BANKTEST

    LLC

    LLC

    LLC

    LLC

    MARKETS

    NAME

    14 selected lines.

    Scott@orcl_11gR2 > select * from TEXT_TBL

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

    3.

    SRCH_NM

    ------------------------------

    B * BANK MARKETS LLC

    B * BANK LLC

    2 selected lines.

    Scott@orcl_11gR2 > select * from TEXT_TBL

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

    3.

    SRCH_NM

    ------------------------------

    B * BANK MARKETS LLC

    B * BANK LLC

    B * BANKtest LLC

    3 selected lines.

    Scott@orcl_11gR2 > drop index text_idx

    2.

    The index is deleted.

    Scott@orcl_11gR2 > start

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

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

    4 end;

    5.

    PL/SQL procedure successfully completed.

    Scott@orcl_11gR2 > create index text_idx

    2 on text_tbl (srch_nm)

    3 indextype is ctxsys.ctxcat

    4 parameters ("lexer text_lexer")

    5.

    The index is created.

    Scott@orcl_11gR2 > select Dr.$ Dr. chips $ text_idx$ I

    2.

    TOKEN OF $ DR

    ----------------------------------------------------------------

    ANOTHER

    B * BANK

    B * BANK

    B * BANKTEST

    BABANKTEST

    LLC

    LLC

    LLC

    LLC

    MARKETS

    NAME

    11 selected lines.

    Scott@orcl_11gR2 > select * from TEXT_TBL

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

    3.

    SRCH_NM

    ------------------------------

    B * BANK MARKETS LLC

    B * BANK LLC

    2 selected lines.

    Scott@orcl_11gR2 > select * from TEXT_TBL

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

    3.

    no selected line

Maybe you are looking for

  • Tecra A8 - unable to connect to the Internet via a cable

    Hello! I can't connect my laptop to the Internet via cable. The laptop does not recognize when I put the cable. Recognize only the wireless connection. Can someone tell me, what is the right software that I need to install in order to have cable inte

  • When I tried to download Jobulator, I got an error message that I can't solve

    The message states: the application could not be installed because the Installer file is damaged. Try to get a new setup of the author of the application file. the installation requires Adobe AIR. I've uninstalled and reinstalled without success. I s

  • E6520 Windows 10?

    Howdy, I have a laptop of E6520 under Windows 7 Pro.  I have problems to install Windows 10 and wonder if anyone has had luck get that works.  I go as far as to 84% and then the screen goes black.  A couple hours later it will restart and restore me

  • X 201 WLAN LED does not blink. Is this normal?

    Hello, I just got a ThinkPad X 201 (this is my third ThinkPad). As expected, this is a great machine and I'm pretty impressed with its performance, despite its size. However, I noticed that the WIFI does not blink - my two other ThinkPads done - it.

  • English language on Chinese Windows 7 Ultimate

    I live in China. I bought and installed Windows 7 Ultimate so that I could use English on my new Dell desktop computer. I downloaded English language pack and went through the steps to change the language. I even restarted my computer, but the langua