Mcgen Rey Musico
Mcgen Rey Musico

Reputation: 1

How to use wildcard character in oracle?

SELECT * from TB_PETS where PET_NAME like '_[ali]%';

Why this code is not working? Im trying to list all the record that has second character is a, l, i but it doesn'y work.

Upvotes: 0

Views: 116

Answers (2)

Imran
Imran

Reputation: 169

Finds any values that have "r" in the second position

WHERE columnName LIKE '_r%'

More details visit this link: https://www.w3schools.com/sql/sql_wildcards.asp

Upvotes: 0

HainKurt
HainKurt

Reputation: 134

just use

SELECT * from TB_PETS where PET_NAME like '_ali%';

it should give you what you want

with TB_PETS as (
select 'Kalito' as PET_NAME from dual union all
select 'Maline' from dual union all
select 'Kumpara' from dual
)
SELECT * from TB_PETS where PET_NAME like '_ali%';

PET_NAME
Kalito
Maline

Upvotes: 1

Related Questions