Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Cut decimal numbers

DipMay 28 2009 — edited May 29 2009
Hello.


I need a select statement which would cut decimal number from a number and show it separately.

Example:
My query returns values:

worker, time_period, type_of_work, accomplished, accomplished2, change (ddmmyyhhmiss)
----------------------------------------------------------------------------------------------------------------------------------
757 , 0903 , S , +008,00 , +0000,00, , 090528022551
757 , 0903 , T , +008,00 , +0000,00, , 090528022551
757 , 0903 , 1 , +014,66 , +0000,00, , 090528022551
757 , 0903 , 4 , +008,00 , +0000,00, , 090528022551
757 , 0903 , 6 , +012,00 , +0000,00, , 090528022551


Record with type_of_work 1 should always show number without decimals.
In this example query should return +015,00 and new column with -000,34.
If the value is 14,49, query should return +014,00 and +000,49.

It should look like (for upper example):
worker, time_period, type_of_work, accomplished, accomplished2, change (ddmmyyhhmiss)
----------------------------------------------------------------------------------------------------------------------------------
757 , 0903 , S , +008,00 , +0000,00, , 090528022551
757 , 0903 , T , +008,00 , +0000,00, , 090528022551
757 , 0903 , 1 , +015,00 , +0000,00, , 090528022551
757 , 0903 , X , -000,34 , +0000,00, , 090528022551
757 , 0903 , 4 , +008,00 , +0000,00, , 090528022551
757 , 0903 , 6 , +012,00 , +0000,00, , 090528022551


How can i do that in one query?

Thanks.

Edited by: DejanH on May 28, 2009 2:51 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 26 2009
Added on May 28 2009
6 comments
899 views