Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: how to substr '%' from the data?

Re: how to substr '%' from the data?

From: <Brian_McQuillan_at_gelco.com>
Date: Mon, 11 Jun 2001 15:18:36 -0700
Message-ID: <F001.00324B5C.20010611152138@fatcity.com>

Helen,
try this instead,, It should help
select substr(mystring,1,(instr(mystring,'%') -1)) from mytable

eg below
DEV>create mytable (mystring varchar2(10)); Table created
DEV>insert into mytable values ('abcdefgh%jkl'); 1 row created
DEV>insert into mytable values ('a%cdefghjkl'); 1 row created
DEV>commit;
Commit complete
DEV>select substr(mystring,1,(instr(mystring,'%') -1)) 2 from mytable
3 /

substr(mystring,1,(



abcdefgh
a

2 rows selected

DEV> Brian.

Helen rwulfjeq <lannyue_at_yahoo.com>@fatcity.com on 06/11/2001 06:06:35 PM

Please respond to ORACLE-L_at_fatcity.com

Sent by: root_at_fatcity.com

To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> cc:

Hello,

I have data like following, how do I substr the string (or use any other function) to get until "%" and return without "%":


RC-SF-DAL-nd-%

AD-LE-%-%-%

RC-DD-LKF-01-RENTAL% CS-%-%-%-%

CS-%-ABC-%-%


I did  "select RTRIM('CS-%-%-%-%', '%-%') from DUAL", but it can not return correct for the last record

eg,  "select RTRIM(CS-%-ABC-%-%', '%-%') from DUAL"  -- will not work correctly

Thanks for help

Do You Yahoo!?
Yahoo! Mail Personal Address - Get email at your own domain with Yahoo! Mail.

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author:
  INET: Brian_McQuillan_at_gelco.com

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: ListGuru_at_fatcity.com (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). Received on Mon Jun 11 2001 - 17:18:36 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US