icon-arrow icon-check icon-mail icon-phone icon-facebook icon-linkedin icon-youtube icon-twitter icon-cheveron icon-download icon-instagram play close icon-arrow-uturn icon-calendar icon-clock
Werken bij Whitehorses
Blog 21/11/2019

How to escape characters in Oracle SQL

Oracle website

When you have to query an Oracle table and want to find rows containing a certain string, you can use wildcards in your WHERE clause. But what do you do if you need to search for rows containing a wildcard as a string? This question came up at one of our customers.

Integratiespecialist
Michel van Zoest /
Integratiespecialist

In a query searching for a string inside a column, you will use something similar to:

 

SELECT column
  FROM table
 WHERE column like '%string%';

But what do you do when you want to find a string containing a %-sign? Because this is the wildcard character, you will get all rows as a result from your query.
 

Luckily there is a solution for this problem. The ESCAPE keyword.

By using this keyword you can escape any character and search for strings containing wildcard characters.

Here is an example:

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

This way it will not see the 2nd %-character as a wildcard, but as a normal string character.

1 Reactie

Geef jouw mening

Reactie plaatsen

Reactie toevoegen

Jouw e-mailadres wordt niet openbaar gemaakt.

Geen HTML

  • Geen HTML toegestaan.
  • Regels en alinea's worden automatisch gesplitst.
  • Web- en e-mailadressen worden automatisch naar links omgezet.
Craigtaf

<a href=https://www.cialisschweiz.ch>cialis schweiz</a>
Don't make deciding on insurance coverage all about conserving money. Often times you may want to devote a bit more than what you should find using a price range plan because of added requirements you might have. Should you be purchasing simply for selling price, you could possibly turn out underinsured if you could easily pay a little more and have the appropriate insurance coverage.
<a href=https://www.dapoxetinschweiz.nu>dapoxetin schweiz</a>
Finances your time intelligently. When your goal would be to get a home and restore it, or maintenance or transform it within a short time prior to re-marketing the house, you want to pay attention to the time that the work towards your property is to take. The problem that numerous first-time brokers come across with home-turning is because they failed to expect the task to take so long. When setbacks arise, and mortgage repayments are accumulating in addition to the price of components and labor, it may absolutely result in a stress filled condition. Be sensible with estimates, and always have cash in the completely ready should you deal with an unforeseen costs.
<a href=https://www.kamagrajellydanmark.nu>kamagra danmark</a>
Should you experience a flaky scalp, try using this procedure bi-regular: Start sectioning your hair and execute a gentle rubbing on the scalp by using a rubbing alcoholic beverages-saturated cotton mat. As soon as the alcohol dries, start brushing the hair. Complete with a in depth wash utilizing warm water, and be sure never to shampoo.
<a href=https://www.cialissenzaricetta.net>cialis senza ricetta</a>

za. 30/11/2019
02:56
Integratiespecialist
Michel van Zoest /
Integratiespecialist

Wil je deel uitmaken van een groep gedreven en ambitieuze integratiespecialisten? Stuur ons jouw CV!