Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB   


 

 

 


 

 

 
 

Select SQL to exclude rows without strings

Oracle Tips by Burleson Consulting

January 31, 2012

Question:  I have a table where I want to exclude all rows where my large_text column contains a set of keywords:  

<field1>   zzzz   <status> movie tie in<status>

 The embedded columns values are as follows:  

<exclude>media tie-in</exclude>
<exclude>movie tie-in</exclude>
<exclude>scholastic tie-in</exclude>



Who do I write a SQL statement to look inside the large_text  column and not show the rows that contain these columns?

Answer:  Normally you can use the "not like" clause or the more powerful regexp_like which which can look for patterns of text and numbers.  For BLOB and CLOB datatypes, use the dbms_lob package to find and exclude embedded strings within large objects.

You might be tempted to exclude the embedded row text based on a common string:

select
   text_column
where
   text_column not like ('%tie-in%');

But you might get a false strike a missed row that has "tie in" in another place in the text.  In your case, with literal values to exclude, you SQL might look like this:

select
   text_column
where
   text_column not like ('%media tie-in%')
or
   text_column not like ('%movie tie-in%')
or
   text_column not like ('%scholastic tie-in%');


Even above the SQL to bypass (exclude rows) that contain your embedded literal may accidently not bypass an y "tie on_ rows that we not embedded within a <status> tag.

Also be aware that this type of query to eliminate unwanted rows with embedded text values might cause a full table scan.

 
Get the Complete
Oracle SQL Tuning Information 

The landmark book "Advanced Oracle SQL Tuning  The Definitive Reference"  is filled with valuable information on Oracle SQL Tuning. This book includes scripts and tools to hypercharge Oracle 11g performance and you can buy it for 30% off directly from the publisher.

 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2012 

All rights reserved.

Oracle © is the registered trademark of Oracle Corporation.


 

  
 

 
 
 
 
Oracle performance tuning software
 
 

 

 
 
 
Oracle performance Tuning 10g reference poster
 
 
 
Oracle training in Linux commands
 
Oracle training Excel
 
Oracle training & performance tuning books