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!

doublespace to a single space

Status
Not open for further replies.

mkey

Programmer
Oct 3, 2001
288
CA
Hi all,

I have a whole bunch of tables that have columns that are varchar. I want to check for any double space within the string. Also for any space in front of the string or at the end of a string.
I know I could check like this:

WHERE (DESCRIPTION LIKE '% %' OR DESCRIPTION LIKE ' %' OR DESCRIPTION LIKE '% 'OR DESCRIPTION LIKE ' %' OR DESCRIPTION LIKE '% ');

But each table have different column names. So its a lot of work to specify each table and its corresponding columns. How can I check for double space a bit faster without writing script for each table?

Thanks!
 
You will have to go over the table ALL_TAB_COLUMNS and write a dynamic script.You can restrict your query over ALL_TAB_COLUMNS to pick up columns of type VARCHAR2 only.Maybe, you will have to pick LONG column types too, depending on your situation.
 
Why don't you use instr(field,' ')<>0 ? I agree, you should create the statements dynamically, looping throug ALL_TABLES and ALL_TAB_COLUMNS.
BTW, how do you plan to identify such fields? Regards, Dima
 
As I have mentioned in my previous posting, the fields could be identified using their DATA_TYPE ( and maybe, OWNER as well)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top