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!

Simple select/ where condition

Status
Not open for further replies.

raji96

Programmer
Aug 7, 2001
64
US
I have a column(col1) which has values like
1-Apple
2-Orange
3-Grapes
I need to check if 1 is in the database,
but since the value is stored as 1-apple how can I compare it to 1.

Thanks!
 
If you need to extract "numeric" part of some string value, try this:

select
to_number
(substr
(col, 1, length(col)-length(ltrim(col, '0123456789')))
)
from tab



Regards, Dima
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top