Operating System - HP-UX
1745789 Members
3897 Online
108722 Solutions
New Discussion

select statement to see if trailing white spaces

 
Ratzie
Super Advisor

select statement to see if trailing white spaces

How do I run a select statement to see if the data is being padded by spaces at the end?

I would then like to do a replace to remove the spaces...
something like:
update table
set customer = replace (customer,' ','')
where customer = ??? (above select...);
commit;
1 REPLY 1
Laurent Menase
Honored Contributor

Re: select statement to see if trailing white spaces

select field_name from table_name where field_name <> RTrim(field_name);

UPDATE table_name
SET field_name=RTrim(field_name)
WHERE field_name <> RTrim(field_name);