Unix Technical Forum

converting data returned

This is a discussion on converting data returned within the Oracle Miscellaneous forums, part of the Oracle Database category; --> Afternoon all, I am trying to figure out how to some data manipulation that is straight SQL and not ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 01:00 PM
sunadmn
 
Posts: n/a
Default converting data returned

Afternoon all,


I am trying to figure out how to some data manipulation that is
straight SQL and not native to SQL*Plus. I have data that returns like
this in a query:

PERIOD RESPONSE COUNT
00 36.83333333333333333333333333333333333333 12
01 42.16666666666666666666666666666666666667 12
02 40.08333333333333333333333333333333333333 12
03 54.83333333333333333333333333333333333333 12
04 55.66666666666666666666666666666666666667 12

Now from the above I would like to just drop everything after the
second spot behind the decimal point but I am not sure how to do it
inside SQL. If I were coding this in Perl I would just use a regex or
something to manipulate the data the way I would like, but I am stuck
using the BIRT framework of Eclipse and it really only understands
straight SQL. Any pointers you could provide would be greqat.

Thanks a million,
-Steve

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 01:00 PM
Mark D Powell
 
Posts: n/a
Default Re: converting data returned

On Jun 11, 3:17 pm, sunadmn <suna...@gmail.com> wrote:
> Afternoon all,
>
> I am trying to figure out how to some data manipulation that is
> straight SQL and not native to SQL*Plus. I have data that returns like
> this in a query:
>
> PERIOD RESPONSE COUNT
> 00 36.83333333333333333333333333333333333333 12
> 01 42.16666666666666666666666666666666666667 12
> 02 40.08333333333333333333333333333333333333 12
> 03 54.83333333333333333333333333333333333333 12
> 04 55.66666666666666666666666666666666666667 12
>
> Now from the above I would like to just drop everything after the
> second spot behind the decimal point but I am not sure how to do it
> inside SQL. If I were coding this in Perl I would just use a regex or
> something to manipulate the data the way I would like, but I am stuck
> using the BIRT framework of Eclipse and it really only understands
> straight SQL. Any pointers you could provide would be greqat.
>
> Thanks a million,
> -Steve


In your SQL Manual look up the to_char, trunc, and round functions:

UT1 > select to_char(9999999.99999,'9,999,999,999.99') from sys.dual;

TO_CHAR(9999999.9
-----------------
10,000,000.00

HTH -- Mark D Powell --

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 01:00 PM
Brian Peasland
 
Posts: n/a
Default Re: converting data returned

sunadmn wrote:
> Afternoon all,
>
>
> I am trying to figure out how to some data manipulation that is
> straight SQL and not native to SQL*Plus. I have data that returns like
> this in a query:
>
> PERIOD RESPONSE COUNT
> 00 36.83333333333333333333333333333333333333 12
> 01 42.16666666666666666666666666666666666667 12
> 02 40.08333333333333333333333333333333333333 12
> 03 54.83333333333333333333333333333333333333 12
> 04 55.66666666666666666666666666666666666667 12
>
> Now from the above I would like to just drop everything after the
> second spot behind the decimal point but I am not sure how to do it
> inside SQL. If I were coding this in Perl I would just use a regex or
> something to manipulate the data the way I would like, but I am stuck
> using the BIRT framework of Eclipse and it really only understands
> straight SQL. Any pointers you could provide would be greqat.
>
> Thanks a million,
> -Steve
>


Another alternative....


SQL> select trunc(9999.999999,2) from dual;

TRUNC(9999.999999,2)
--------------------
9999.99


HTH,
Brian

--
================================================== =================

Brian Peasland
dba@nospam.peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.


"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown

--
Posted via a free Usenet account from http://www.teranews.com

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-08-2008, 01:01 PM
sunadmn
 
Posts: n/a
Default Re: converting data returned

On Jun 11, 3:29 pm, Brian Peasland <d...@nospam.peasland.net> wrote:
> sunadmnwrote:
> > Afternoon all,

>
> > I am trying to figure out how to some data manipulation that is
> > straight SQL and not native to SQL*Plus. I have data that returns like
> > this in a query:

>
> > PERIOD RESPONSE COUNT
> > 00 36.83333333333333333333333333333333333333 12
> > 01 42.16666666666666666666666666666666666667 12
> > 02 40.08333333333333333333333333333333333333 12
> > 03 54.83333333333333333333333333333333333333 12
> > 04 55.66666666666666666666666666666666666667 12

>
> > Now from the above I would like to just drop everything after the
> > second spot behind the decimal point but I am not sure how to do it
> > inside SQL. If I were coding this in Perl I would just use a regex or
> > something to manipulate the data the way I would like, but I am stuck
> > using the BIRT framework of Eclipse and it really only understands
> > straight SQL. Any pointers you could provide would be greqat.

>
> > Thanks a million,
> > -Steve

>
> Another alternative....
>
> SQL> select trunc(9999.999999,2) from dual;
>
> TRUNC(9999.999999,2)
> --------------------
> 9999.99
>
> HTH,
> Brian
>
> --
> ================================================== =================
>
> Brian Peasland
> d...@nospam.peasland.nethttp://www.peasland.net
>
> Remove the "nospam." from the email address to email me.
>
> "I can give it to you cheap, quick, and good.
> Now pick two out of the three" - Unknown
>
> --
> Posted via a free Usenet account fromhttp://www.teranews.com


Great guys thanks a million here these both are eaxctly what I was
looking for.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-08-2008, 01:03 PM
sunadmn
 
Posts: n/a
Default Re: converting data returned

On Jun 11, 3:24 pm, Mark D Powell <Mark.Pow...@eds.com> wrote:
> On Jun 11, 3:17 pm,sunadmn<suna...@gmail.com> wrote:
>
>
>
> > Afternoon all,

>
> > I am trying to figure out how to some data manipulation that is
> > straight SQL and not native to SQL*Plus. I have data that returns like
> > this in a query:

>
> > PERIOD RESPONSE COUNT
> > 00 36.83333333333333333333333333333333333333 12
> > 01 42.16666666666666666666666666666666666667 12
> > 02 40.08333333333333333333333333333333333333 12
> > 03 54.83333333333333333333333333333333333333 12
> > 04 55.66666666666666666666666666666666666667 12

>
> > Now from the above I would like to just drop everything after the
> > second spot behind the decimal point but I am not sure how to do it
> > inside SQL. If I were coding this in Perl I would just use a regex or
> > something to manipulate the data the way I would like, but I am stuck
> > using the BIRT framework of Eclipse and it really only understands
> > straight SQL. Any pointers you could provide would be greqat.

>
> > Thanks a million,
> > -Steve

>
> In your SQL Manual look up the to_char, trunc, and round functions:
>
> UT1 > select to_char(9999999.99999,'9,999,999,999.99') from sys.dual;
>
> TO_CHAR(9999999.9
> -----------------
> 10,000,000.00
>
> HTH -- Mark D Powell --


Mark,

Thanks for the response here I wonder is there a function like this
for dealing with non numeric data like say something like this?

WebLogic.onlinef.onlinefNET-12-7230@csaps012

Thanks,
-Steve

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-08-2008, 01:03 PM
Frank van Bortel
 
Posts: n/a
Default Re: converting data returned

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

sunadmn wrote:
> On Jun 11, 3:24 pm, Mark D Powell <Mark.Pow...@eds.com> wrote:
>> On Jun 11, 3:17 pm,sunadmn<suna...@gmail.com> wrote:
>>
>>
>>
>>> Afternoon all,
>>> I am trying to figure out how to some data manipulation that is
>>> straight SQL and not native to SQL*Plus. I have data that returns like
>>> this in a query:
>>> PERIOD RESPONSE COUNT
>>> 00 36.83333333333333333333333333333333333333 12
>>> 01 42.16666666666666666666666666666666666667 12
>>> 02 40.08333333333333333333333333333333333333 12
>>> 03 54.83333333333333333333333333333333333333 12
>>> 04 55.66666666666666666666666666666666666667 12
>>> Now from the above I would like to just drop everything after the
>>> second spot behind the decimal point but I am not sure how to do it
>>> inside SQL. If I were coding this in Perl I would just use a regex or
>>> something to manipulate the data the way I would like, but I am stuck
>>> using the BIRT framework of Eclipse and it really only understands
>>> straight SQL. Any pointers you could provide would be greqat.
>>> Thanks a million,
>>> -Steve

>> In your SQL Manual look up the to_char, trunc, and round functions:
>>
>> UT1 > select to_char(9999999.99999,'9,999,999,999.99') from sys.dual;
>>
>> TO_CHAR(9999999.9
>> -----------------
>> 10,000,000.00
>>
>> HTH -- Mark D Powell --

>
> Mark,
>
> Thanks for the response here I wonder is there a function like this
> for dealing with non numeric data like say something like this?
>
> WebLogic.onlinef.onlinefNET-12-7230@csaps012
>
> Thanks,
> -Steve
>

Of course!


.... you just have to write it

- --
Regards,
Frank van Bortel

Top-posting is one way to shut me up...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)

iD8DBQFGeByTLw8L4IAs830RAp6WAJwMZmLVuZMLBBm6WcAI0X jYAzuQSQCgk/5h
8lHXoXNftyQC2NGNV+UPjBo=
=TgtC
-----END PGP SIGNATURE-----
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:00 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com