Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > Oracle
|
Oracle General Oracle database discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Oracle section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 29th, 2006, 02:35 AM
Registered User
 
Join Date: May 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL for records that contain a percentage sign

Not sure if this is the right forum to post this in, but is there anyway to query an Oracle DB for records where a given field contains a percentage sign at the end?

As in: where field like '%%'

Of course, this doesn't work and I know this exercise is awkward, but I'm working with pretty challenging data.

Alternatively, is there anyway to check that field do not contain an underscore?

As in: where field not like '%_%'

Cheers.
 
Old June 9th, 2006, 11:11 AM
Registered User
 
Join Date: Jun 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can always use the INSTR function with the character code to check whether a particular character is in a field.

e.g. Checking for rows where column1 contains % character

SELECT * FROM table
WHERE INSTR(column1,CHR(37)) > 0

or replace to CHR(93) for the underscore - these are the ASCII codes.

I am sure there is another way using an escape character too.



 
Old June 12th, 2006, 08:04 PM
Registered User
 
Join Date: May 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you - this is exactly what I was after. Muchly appreciated!






Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL - Computing percentage of total ace2e SQL Language 8 October 31st, 2014 10:42 AM
Percentage: IE6 vs. All others? tal HTML Code Clinic 3 August 1st, 2007 05:57 PM
percentage height GuyB CSS Cascading Style Sheets 1 July 6th, 2006 09:42 PM
how to calculate the percentage in sql yvr238 SQL Server 2000 1 May 13th, 2006 03:28 AM
percentage darkhalf Javascript 2 October 28th, 2005 02:55 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.