If you are just searching for a specific word in a column, then you can use the '%' wildcard, which standards for any number of characters, similar to the '*' wildcard for DOS or Unix filenames. So to search COL_A from TABLE_A for those rows which contain the word "apache", you would use a query similar to the following:
SELECT * FROM table_a WHERE col_a LIKE '%apache%';The LIKE operator will search for those columns that are "like" the given phrase, taking into account any wildcards. The '_' wildcard matches one and only one character, similar to the '?' DOS wildcard for filenames. If you are looking into more sophisticated indexes and searching of data, you might want to investigate the ConText option, now called Oracle interMedia. This is an add-on option though.
For More Information
- Dozens more answers to tough Oracle questions from Brian Peasland are available.
- The Best Oracle Web Links: tips, tutorials, scripts, and more.
- Have an Oracle or SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
- Ask your technical Oracle and SQL questions -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.
This was first published in August 2002