Re: Collection Help

From: onedbguru <onedbguru_at_yahoo.com>
Date: Thu, 15 Mar 2012 18:41:44 -0700 (PDT)
Message-ID: <17734920.318.1331862104566.JavaMail.geo-discussion-forums_at_vbze11>



On Wednesday, March 14, 2012 9:55:15 PM UTC-4, Mladen Gogala wrote:
> 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.com

Relying on Oracle to be consistent with regards to implicit data type conversions is a recipe for disaster.

On Wednesday, March 14, 2012 9:55:15 PM UTC-4, Mladen Gogala wrote:
> 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.com

And it may very well work in this case - beware of implicit data type conversions - They WILL bite at the most inopportune time. Received on Thu Mar 15 2012 - 20:41:44 CDT

Original text of this message