Help escaping from user input, whatever they are

I need help escaping from the user input whatever they may be. Currently, I did the following searches with no luck.

CONTAINS (columnName, ' % a %', 1) > 0
CONTAINS (columnName, '% {%}', 1) > 0

Looking for a Word with a "%' in it as follows"stocks have increased by 13%."

You must put the % as a printjoin in a lexer and use this lexer in the index settings in order for the % to include in the indexed tokens. Then you can use-to escape to the % as an individual character. You cannot combine sentences using the {and} with wildcard characters who escape. Please see the demo below.

SCOTT@orcl_11gR2> -- table:
SCOTT@orcl_11gR2> create table test_tab
  2    (columnName  clob)
  3  /

Table created.

SCOTT@orcl_11gR2> -- lexer with % included in printjoins:
SCOTT@orcl_11gR2> begin
  2    ctx_ddl.create_preference ('test_lex', 'basic_lexer');
  3    ctx_ddl.set_attribute ('test_lex', 'printjoins', '%');
  4  end;
  5  /

PL/SQL procedure successfully completed.

SCOTT@orcl_11gR2> -- index using lexer:
SCOTT@orcl_11gR2> create index test_idx
  2  on test_tab (columnName)
  3  indextype is ctxsys.context
  4  parameters
  5    ('lexer test_lex
  6        transactional')
  7  /

Index created.

SCOTT@orcl_11gR2> -- test data:
SCOTT@orcl_11gR2> insert all
  2  into test_tab (columnName) values ('The shares have increased by 13%.')
  3  into test_tab (columnName) values ('other data')
  4  select * from dual
  5  /

2 rows created.

SCOTT@orcl_11gR2> commit
  2  /

Commit complete.

SCOTT@orcl_11gR2> -- query:
SCOTT@orcl_11gR2> select * from test_tab
  2  where  contains (columnName, '%\%%') > 0
  3  /

COLUMNNAME
--------------------------------------------------------------------------------
The shares have increased by 13%.

1 row selected.

Tags: Database

Similar Questions

Maybe you are looking for

  • My GMail Goggle address is used as the return address

    I have set up my email accounts with email response answer such as email for the account, everything was fine and was sent the correct answer to the address until I have configure the SMTP Protocol to use my Goggle GMail because it is a laptop, and I

  • 3rd reading machine series

    Hello I'm trying to contact a 3rd party device, a tester of smoke for trucks, using series read in LabView. I have attached the dokument command parameters. I use the parameters of diesel on page 9. I can't get sensitive information. There is no byte

  • RAM for Vista problem shows only 1 GB despite 2GB material

    I have Windows Vista 32 bit installed in my system with 2 GB of RAM, and it worked perfectly. Yesterday my system performance show only 1 GB of RAM and the Ram usage is 60 to 90% of the capacity, I know that max support 4 GB 32-bit system, but how is

  • Is blackBerry smartphones there a way to delete all messages at once

    In my view, there is a way to hide, but I want to permanently delete. I find no way but one at a time. Thank you very much for your help

  • My h8 - 1027c has a firewire port?

    I bought a h8 - 1027c at Costco and it doesn't seem to have a firewire port.  or does? I need to transfer my DV tapes on my h8 - 1027c but I can't because of the absence of firewire port.