Home > database >  Orcal taken how to judge the query string is equal to a string
Orcal taken how to judge the query string is equal to a string

Time:10-02

Query and intercepting the parts of a field according to the character of a set of data how to judge whether this set of data containing a string!

CodePudding user response:

 

SQL> The select instr (' 11122233345555 ', '4') from dual;
INSTR (' 11122233345555 ', '4')
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10

SQL>

CodePudding user response:

Well well, thank you! This I know, I mean with Substr, intercepting Instr inquiries after get a set of data and how to determine whether this set of data, equal or contain a string?

CodePudding user response:

Using instr (t.s tr, 'b' 45) & gt; 0, if equal or contain a string, the return value is greater than 0, the opposite is equal to 0
Example:
Select * from (
Select '12345 g8789 STR from dual
Union all
Select '12345 b8789 STR from dual
) t
Where instr (t.s tr, 'b' 45) & gt; 0
  • Related