Try this

for leading spaces :

select  name,length(name),rtrim(name)
from    ora_test
where   length(rtrim(ltrim(name))) != length(rtrim(name));

for lagging spaces :


select  name,length(name),ltrim(name)
from    ora_test
where   length(ltrim(rtrim(name))) != length(ltrim(name));

----------------------------------------------------------------------------
--------------------
The Data from the ora_test table is as follows :


NAME                 LENGTH(NAME)
-------------------- ------------
 Karthik Mohan                 15  -- 1 leading space and 1 lagging space
Siva                            6  -- 2 lagging spaces
  God                           5  -- 2 leading spaces

3 rows selected.

Regards,
Karthik Mohan


-----Original Message-----
Sent: Thursday, July 05, 2001 12:10 PM
To: Multiple recipients of list ORACLE-L


hi all

i have one table in which the note column have following entries

ID         NOTE
-------------------------------------------------------------------------
31177340 400A
31177374 FITZGERALD FENCE


31177394 FASHION BUG
31177454 PRECISION LITHOGRAVING
31177472 TOBIN BROS - VACANT
31177497 BRAID MILL
31177514
         GRAIN STORAGE

31177528 EDGEWOOD COMMONS

-----------------------------------------------------------------------

i want to find the leading as well as trailing spaces in the note field, i
am getting the leading spaces using the following query

 select id,NOTE
 from test
 where note like ' %' ;

plz provide me query to get the leading as well as trailing spaces..

thanks in advance

Shirish Khapre, SE Rolta India Ltd.
Off Ph No. (+91) (022) 8326666,8262222,8300568
Ext'n 2730
Minds are like parachutes. They only function when they are open


-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Shirish Khapre
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to