Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: What's + 0 does after a column name when creating view
On 2005-06-09, andyho99_at_yahoo.com <andyho99_at_yahoo.com> wrote:
> Hi,
>
> I was wondering why people put "+ 0" after a column when creating view.
>
>
> For example,
>
> CREATE OR REPLACE FORCE VIEW APPS.PER_ADDRESSES_V (a, b, c) as
> select a,
> b + 0 b,
> c
It forces a varchar to be a number:
create table foo (
a varchar2(5), b varchar2(5), c varchar2(5)
create view vw_foo_1 as
select a,b,c from foo;
create view vw_foo_2 as
select a,b+1 b, c from foo;
desc vw_foo_1;
Name Null? Type
A VARCHAR2(5) B VARCHAR2(5) C VARCHAR2(5)
desc vw_foo_2;
Name Null? Type
A VARCHAR2(5) B NUMBER C VARCHAR2(5)
It goes with(out) saying that this is bad practise.
hth
Rene
-- Rene Nyffenegger http://www.adp-gmbh.ch/Received on Thu Jun 09 2005 - 14:22:56 CDT
![]() |
![]() |