If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > SQL: Numeric Conversion in DB2 Queries

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-19-03, 07:46
ragheshkr ragheshkr is offline
Registered User
 
Join Date: Dec 2003
Posts: 2
Post SQL: Numeric Conversion in DB2 Queries

Hi,

I have a DB2 Query in which i have to multiply Two columns.
i.e., Select Column1 * Column2 From Table Name
In this table the Column 1 is numeric but Column 2 is character having the values 1.56.
Now what is the inbuilt reserved word which i can use to convert '1.56' string to 1.56.

In Oracle we have To_number.But i am unable to find any such Reserved Word in DB2. Please Help.

Thanks & Regards,
Ragi
Reply With Quote
  #2 (permalink)  
Old 12-19-03, 08:09
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Ragi,
Look at the numeric functions: INTEGER, DECIMAL, FLOAT, DOUBLE. Each one will take your string and return a numberic of the datatype of the function name.

HTH

Andy
Reply With Quote
  #3 (permalink)  
Old 12-19-03, 22:42
ragheshkr ragheshkr is offline
Registered User
 
Join Date: Dec 2003
Posts: 2
Smile

Quote:
Originally posted by ARWinner
Ragi,
Look at the numeric functions: INTEGER, DECIMAL, FLOAT, DOUBLE. Each one will take your string and return a numberic of the datatype of the function name.

HTH

Andy
Hi Andy,

SELECT 3 * DECIMAL('12.2',3,1) FROM <Table> Works fine.
Thanks A Lot.
Appreciate Your Help!!!

Regards,
Ragi
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On