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: SQL Question

Re: SQL Question

From: Matt Foster <matt.foster_at_ed.ac.uk>
Date: Mon, 21 Feb 2000 12:33:14 +0000
Message-ID: <38B1308A.5D7CB487@ed.ac.uk>


Antonio Doblado wrote:
>
> Hello,
>
> I hace Oracle8i for Windows NT installed, and I want to develop an
> application using Visual Basic 6. Windows NT and Oracle are English
> versions, and also Visual Basic.
>
> I have to store some numerical values as varchar2 in the database, and I
> want to use the dot (".") as decimal separator, without thousand separator.
>
> For example a table named "TOTALS" must contain a field named "TOTAL_PRICE"
> defined as varchar2 and values like "89.987" or "87678.5685".
>
> I want to know if it is possible to use SELECT SUM sentences using those
> varchar2 fileds and if Oracle will calculate correctly the result. For
> example, an SQL sentence like:
>
> SELECT SUM(TOTAL_PRICE) FROM TOTALS
>
> will operate correctly and add the two values mentioned before with the next
> result: 87768.5555
>
> Thank you very much.
>
> Antonio Doblado Romo
> adoblado_at_icot.es

This worked for me as below:

SQL> create table test (total_price varchar2(10));

Table created.

SQL> insert into test
  2 values (89.987);

1 row created.

SQL> insert into test
  2 values (87678.5685);

1 row created.

SQL> select sum(total_price) from test;

SUM(TOTAL_PRICE)


      87768.5555

Matt Received on Mon Feb 21 2000 - 06:33:14 CST

Original text of this message

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