Oracle There are three ways to get a script that ends in a percent sign

  • 2021-12-04 20:10:18
  • OfStack

The data is shown in the figure:

The goal is to get the data row of ID=4443, and simply record the following three writing methods:

Type 1, substr:


SELECT * FROM TEST 
WHERE SUBSTR(NOTE ,-1) = CHR(37);

Type 2, escape:


SELECT * FROM TEST A 
WHERE A.NOTE LIKE '%\%' escape '\';

Third, regular expressions:


SELECT * FROM TEST 
WHERE REGEXP_LIKE(NOTE,'%$');

Related articles: