Re: Collection Help
From: Mladen Gogala <gogala.mladen_at_gmail.com>
Date: Thu, 15 Mar 2012 01:55:15 +0000 (UTC)
Message-ID: <pan.2012.03.15.01.55.14_at_gmail.com>
On Wed, 14 Mar 2012 18:16:36 -0700, onedbguru wrote:
6 dbms_output.put_line(v_sentence);
7* end;
SQL> /
The next election year is:2012
Date: Thu, 15 Mar 2012 01:55:15 +0000 (UTC)
Message-ID: <pan.2012.03.15.01.55.14_at_gmail.com>
On Wed, 14 Mar 2012 18:16:36 -0700, onedbguru wrote:
>
> Dom - WRONG!!
>
> Actual the error is pretty self explanatory The OP is trying to
> concatenate a number to a string (VARCHAR2). This is NOT java or PHP.
>
> this is the problem:
> ...|| ',' || v_order_tab(index1).total_registered;
> total_registered is defined as a NUMBER data type.
That has nothing to do with the problem. You can concatenate number to string nicely, it will get converted to string:
1 declare
2 v_year number:=2012; 3 v_election varchar2(64):= 'The next election year is:'; 4 v_sentence varchar2(128):=v_election||v_year;5 begin
6 dbms_output.put_line(v_sentence);
7* end;
SQL> /
The next election year is:2012
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
I defined VARCHAR2 variable v_sentence as a concatenation of number to string. It worked just fine. I agree with Dominic.
-- http://mgogala.byethost5.comReceived on Wed Mar 14 2012 - 20:55:15 CDT