Friday, May 28, 2010

A quick quiz for a Friday.

What is the largest number you can get from a three character string ?

999 ?
Not even close.

How about 9 billion ?

select to_number('9e9') from dual;

TO_NUMBER('9E9')
--------------------
9,000,000,000

Any advance on that ?

4 comments:

Noons said...

infinite?


select power(
to_number('999'),
to_number('999'))
from dual;
SQL> /
*
ERROR at line 1:
ORA-01426: numeric overflow


;)

Noons said...

Another quick one:
1* select exp('999') from dual
SQL> /
select exp('999') from dual
*
ERROR at line 1:
ORA-01426: numeric overflow

;)

Anonymous said...

In MySQL too ;)

mysql> select 9e9;
+------------+
| 9e9 |
+------------+
| 9000000000 |
+------------+
1 row in set (0.01 sec)

mysql>

Rachid

Scott Wesley said...

Breaks some dates, too

select to_date(TO_NUMBER('9E9'),'j') from dual;

ORA-01854: julian date must be between 1 and 5373484