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

Home -> Community -> Usenet -> c.d.o.misc -> Re: What am I doing wrong (RTRIM, PL/SQL)

Re: What am I doing wrong (RTRIM, PL/SQL)

From: Stephan Born <stephan.born_at_beusen.de>
Date: Wed, 29 Sep 1999 13:33:18 +0200
Message-ID: <37F1F8FE.A25A6396@beusen.de>


> Oracle 8.0.5
> I cannot find an example for what I am trying to do - I want to parse a
> string using rtrim but am having trouble.
> Here is a sample of what I am trying to do:
>
> declare col1 varchar2(10);
> begin
> col1:=rtrim('1111,2222,3333,4444',',');
> DBMS_OUTPUT.PUT_LINE(col1);
> end;
>
> These are the messages I get:
>
> ORA-06502: PL/SQL: numeric or value error
> ORA-06512: at line 3
>
> What am I doing wrong? - I've tried declaring col1 as a char(10), also
> I've tried selecting into it, but nothing seems to work.

Try

declare col1 varchar2(20); -- 10 is too short!!!! begin
col1:=rtrim('1111,2222,3333,4444',','); DBMS_OUTPUT.PUT_LINE(col1);
end;

But the result of rtrim('1111,2222,3333,4444',',') is still '1111,2222,3333,4444'... since rtrim does remove the given character from the right side of the given string until it finds the first character
which is not ',' (in your case!).

Regards, Stephan

--


Dipl.-Inf. (FH) Stephan Born   | beusen Consulting GmbH
fon: +49 30 549932-17          | Landsberger Allee 392
fax: +49 30 549932-29          | 12681 Berlin
mailto:stephan.born_at_beusen.de  | Germany
---------------------------------------------------------------


Received on Wed Sep 29 1999 - 06:33:18 CDT

Original text of this message

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