Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: varchar2 and number

Re: varchar2 and number

From: Sylvain Leclerc <SLeclerc_at_magrit.com>
Date: 2000/08/09
Message-ID: <044CD796C702D111B56800608CCC51D0166826@INT_04>#1/1

Just divide the cents number by 100, then add it to the dollar number. With a mathematical operator the char string is translate by Oracle into a number. If you don't believe me try this

select ( '3' / 100 ) + '10' from dual;

Sylvain Leclerc, DBA
sleclerc_at_magrit.com

-----Original Message-----
From: Sandy [mailto:daleelaNOdaSPAM_at_usa.net.invalid] Posted At: Wednesday, August 09, 2000 6:02 AM Posted To: server
Conversation: varchar2 and number
Subject: varchar2 and number

hi,

I have a form with two fields one for a number and for the decimal. I tried the character '||'to put them together in the same variable then it would be a number(15,2) but of course it doesn't work because i do like this :

Price number(15,2);
Dollar varchar2(15);
cents varchar2(2);

Price=Dollar ||','||cents;

the Dollar and the cents are both in varchar2 because it is from the form so i can't change it.and the price is a variable which contains the value i will insert in a table. In fact, if you didn't understand if the user enter 10 for Dollar and 20 for cents the price would be 10,20.( If you did understood i apologize ).

Is there a functin or anything to do it ?

thanks a lot

Sandy

Received on Wed Aug 09 2000 - 00:00:00 CDT

Original text of this message

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