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: select constant.field

Re: select constant.field

From: Mark C. Stock <mcstockX_at_Xenquery>
Date: Wed, 25 Jan 2006 07:14:22 -0500
Message-ID: <XNqdnUEB2eg_9krenZ2dnUVZ_sudnZ2d@comcast.com>

"Arto Viitanen" <arto.viitanen_at_csc.fi> wrote in message news:43d7208f$0$10074$ba624cd0_at_newsread.funet.fi...
> Mark C. Stock wrote:

>> bottom line '1.' is a numeric expression -- the text (quoted or not) 
>> after the decimal is being interpreted as a column alias (which you'll 
>> notice if you take a close look at you output in SQL*Plus)
>>
>> i.e.
>>
>> SQL> select 1xxx from dual;
>>
>>        XXX
>> ----------
>>          1
>>
>> ++ mcs
>>
>>
>

> Yes, but funny thing was, why 1.foo gives floating point number, but
> 1."foo" gives integer. I tested this on MySQL and it gives 1 on both
> cases.
>

> --
> Arto Viitanen, CSC Ltd
> Espoo, Finland

>

bottom line is that both are a type of logical syntax error (just like SELECT EMPNO ENAME, SAL FROM EMP is a syntax error that returns 2 colums when 3 are expected)

but, what indicates to you that one is an integer and one is a floating point? they look identical to me:

SQL> select q.*, dump(xxx), dump("xxx")
  2 from (
  3 select
  4 1.xxx
  5 ,1."xxx"
  6 from dual
  7 ) q
  8 /

       XXX xxx
---------- ----------
DUMP(XXX)



DUMP("XXX")

         1 1
Typ=2 Len=2: 193,2
Typ=2 Len=2: 193,2

SQL> create table xxx as
  2 select
  3 1.xxx
  4 ,1."xxx"
  5 from dual
  6 /

Table created.

SQL> descr xxx
 Name Null? Type

Received on Wed Jan 25 2006 - 06:14:22 CST

Original text of this message

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