What Data Type is Returned by a Mathematical Function?
Posted: September 6, 2008 Filed under: tips
This question was asked last week by Nicklas Westerlund. His attempts to answer the question are fascinating and creative. But they did make me wonder why MySql has a reputation for being developer friendly and easier to use than Oracle.
In Oracle I do the following:
SQL> select dump(512*power(1024,2)) from dual;
Typ=2 Len=6: 197,6,37,88,10,13
And then I refer to the Data Types Table
in the documenation to find out that Typ=2 is a number (surprise!).
I also know that this particular number takes 6 bytes, and I know the value in each of these bytes.
It may seem that the DUMP function is useless, except maybe to debug performance issues related to math functions. However, from my experience it can be used to impress colleagues. Show them the bytes and they’ll think your are a guru at least until the next time you make a mistake and crash production.