What Data Type is Returned by a Mathematical Function?

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;

DUMP(512*POWER(1024,2))
------------------------------
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.
About these ads

3 Comments on “What Data Type is Returned by a Mathematical Function?”

  1. Chris says:

    Another handy way to make people believe you are omnipotent is to run a 10046 trace running (level 8 or 12 for preference) and tail -f the trace file. Mumbling incoherently and pointing at the screen occasionally as the output scrolls up the screen….

  2. prodlife says:

    Chris,
    I actually had this pulled on me once or twice. Impressive indeed :)

  3. Asif Momen says:

    Chen,

    DUMP function can be useful and in fact came as a rescue for us. Have a look at my recent post on its usefulness.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 3,109 other followers