Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find ' (single quotes) in STRING

Status
Not open for further replies.

jdemmi

MIS
Jun 6, 2001
1,106
US
I have a simple table with a VARCHAR2 data typed column. I need locate records which have a single quote ' in the string. How can I accomplish this?

Assume the table is like this.

SUPPLIER CODE (Number)
SUPPLIER NAME (Varchar2)

and I want to find all suppliers with a ' in their name.

Thanks in advance.

-- Jason
"It's Just Ones and Zeros
 
Jason,

Here are some data and some code:

Section 1 -- Sample data:
Code:
select * from demmi;

SUPPLIER_CODE SUPPLIER_NAME
------------- ----------------------
            1 Mary's Doughnuts
            2 Me 'n' Ed's Pizza
            3 Computer Code by Jason

Section 2 -- Code to locate single quotes in SUPPLIER_NAME:
Code:
select * from demmi where supplier_name like ('%''%');

SUPPLIER_CODE SUPPLIER_NAME
------------- -----------------
            1 Mary's Doughnuts
            2 Me 'n' Ed's Pizza

2 rows selected.

Let us know if this satisfactorily resolves your need.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA @ 18:51 (19Oct04) UTC (aka "GMT" and "Zulu"), 11:51 (19Oct04) Mountain Time)
 
DOH!.....the parenthesis! I had only done this once before and could not remember how.

Thanks!

-- Jason
"It's Just Ones and Zeros
 
Actually, Jason, the parentheses are extraneous. It works without them:

Code:
select * from demmi where supplier_name like '%''%';

SUPPLIER_CODE SUPPLIER_NAME
------------- -----------------
            1 Mary's Doughnuts
            2 Me 'n' Ed's Pizza

[santa]Mufasa
(aka Dave of Sandy, Utah, USA @ 19:02 (19Oct04) UTC (aka "GMT" and "Zulu"), 12:02 (19Oct04) Mountain Time)
 
Try This:

Select * from Supplier_Table
where instr(supplier_name, chr(39))>0;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top