Oracle DBA – A lifelong learning experience

Posts Tagged ‘unix’

Performing calculations in unix

Posted by John Hallas on August 31, 2009

Normally if I working on a database and want perform simple calculations I use the Oracle database rather than starting up the windows calculator.

select 6*1024*1024 from dual;

6*1024*1024
-----------
    6291456

 

However I recently found out a method of using unix itself (I am sure there are many more options other than this one but I find this quite easy)

man bc gives

bc is an interactive processor for a language that resembles C but provides unlimited-precision arithmetic.  It takes input from any  files given, then reads the standard input.

In usage

/home/oracle $bc
6*1024*1024
6291456
quit

Arithmetic operators are shown in the normal manner + - * / % ^ and there are lots of functions available such as sine, cosine and log, although I would be likely to use a calculator if I wanted to use these.

Posted in Oracle | Tagged: , , , , | 6 Comments »

 
Follow

Get every new post delivered to your Inbox.

Join 190 other followers