Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 513
  • Last Modified:

Query Syntax

Hello,
I have a numeric field in my oralce table contains the following values:

x
-----
12.55
875.69
325.6
2.53
12.56
....
....

I want to write query to get the following values according to x in y numeric field.

y
------
55.12
69.875
6.325
53.2
56.12
.....
.....

It means I want to replace numbers before decimal point by numbers after decimal point and vice versa.

Thanks
-FA


0
Farzad Akbarnejad
Asked:
Farzad Akbarnejad
1 Solution
 
sdstuberCommented:
TO_NUMBER(REGEXP_REPLACE(TO_CHAR(x), '([^.]*)\.([^.]*)', '\2.\1'))
0

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

Tackle projects and never again get stuck behind a technical roadblock.
Join Now