What am I doing wrong (RTRIM, PL/SQL) 
Author Message
 What am I doing wrong (RTRIM, PL/SQL)
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.



Wed, 18 Jun 1902 08:00:00 GMT
 What am I doing wrong (RTRIM, PL/SQL)

You're trying to stuff 19 characters into a 10 character space.  Change
your declaration of col1 to varchar2(19) or more.
Quote:

> 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.



Wed, 18 Jun 1902 08:00:00 GMT
 What am I doing wrong (RTRIM, PL/SQL)
Never mind - what I'm wanting to do will require the SUBSTR command.  Sorry
for the inconvenience.
Quote:

> 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.



Wed, 18 Jun 1902 08:00:00 GMT
 What am I doing wrong (RTRIM, PL/SQL)
Hi,

I'm not sure about what you intend to do, but i suppose you want to extract
the initial digits of your string until the delimiter comma. If I'm right,
you could try use SUBSTR and not RTRIM.

HTH

--
==========================

Please, remove numbers to reply
==========================


Quote:
> 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.



Wed, 18 Jun 1902 08:00:00 GMT
 What am I doing wrong (RTRIM, PL/SQL)

Quote:
> 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

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



Wed, 18 Jun 1902 08:00:00 GMT
 What am I doing wrong (RTRIM, PL/SQL)


Quote:
> 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.

Bret,

If you want to get rid of ',', you can try
select REPLACE('123,123,123',',','')

Hope helps.

Andrew

Sent via Deja.com http://www.deja.com/
Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT
 
 [ 6 post ] 

 Relevant Pages 

1. ADO and SQL: what am I doing wrong ?

2. SQL What am I doing wrong ?

3. What am I forgetting or doing wrong

4. what am I doing wrong in this procedure?

5. TSQL question - what am I doing wrong?

6. what am i doing wrong?

7. Simple one what am i doing wrong

8. Darn what am i doing wrong?

9. What am I doing wrong

10. What am I doing wrong?

11. Joins - What I'am doing wrong

12. I think I am doing something wrong


 
Powered by phpBB® Forum Software