Oracle DBA & DEV: MERRY CHRISTMAS!

Jan 5, 2011 / By Yury Velikanov

Tags: , , ,

Hello Everyone!

Just to make you smile and let you remember all those sweet holidays I would like to congratulate you and wish you MERRY CHRISTMAS! in Oracle style:

set lines 180 pages 1000
select decode(sign(rownum-24),-1,
       replace(replace(lpad(' ', 25 - rownum+trunc(rownum / 8) * 3, ' ') ||
       rpad('^', rownum * 2 - 1 - trunc(rownum / 8) * 6, '^') ||
       rpad(' ', 25 - rownum+trunc(rownum / 8) * 3, ' '),' ^^^',' ^o^'),'^^^ ','^o^ '),
       lpad(' ', 23, ' ') ||
       rpad('^', 3, '^') ||
       rpad(' ', 23, ' ')
       ) "MERRY CHRISTMAS!"
  from dual
connect by rownum <= 26;

In case you do not have immediate access to SQL*Plus and an Oracle database the expected output is provided below:

> select decode(sign(rownum-24),-1,
>        replace(replace(lpad(' ', 25 - rownum+trunc(rownum / 8) * 3, ' ') ||
>        rpad('^', rownum * 2 - 1 - trunc(rownum / 8) * 6, '^') ||
>        rpad(' ', 25 - rownum+trunc(rownum / 8) * 3, ' '),' ^^^',' ^o^'),'^^^ ','^o^ '),
>        lpad(' ', 23, ' ') ||
>        rpad('^', 3, '^') ||
>        rpad(' ', 23, ' ')
>        ) "MERRY CHRISTMAS!"
>   from dual
> connect by rownum <= 26;

MERRY CHRISTMAS!
--------------------------------------------------------------------------------------------------------------
                        ^
                       ^o^
                      ^o^o^
                     ^o^^^o^
                    ^o^^^^^o^
                   ^o^^^^^^^o^
                  ^o^^^^^^^^^o^
                    ^o^^^^^o^
                   ^o^^^^^^^o^
                  ^o^^^^^^^^^o^
                 ^o^^^^^^^^^^^o^
                ^o^^^^^^^^^^^^^o^
               ^o^^^^^^^^^^^^^^^o^
              ^o^^^^^^^^^^^^^^^^^o^
             ^o^^^^^^^^^^^^^^^^^^^o^
               ^o^^^^^^^^^^^^^^^o^
              ^o^^^^^^^^^^^^^^^^^o^
             ^o^^^^^^^^^^^^^^^^^^^o^
            ^o^^^^^^^^^^^^^^^^^^^^^o^
           ^o^^^^^^^^^^^^^^^^^^^^^^^o^
          ^o^^^^^^^^^^^^^^^^^^^^^^^^^o^
         ^o^^^^^^^^^^^^^^^^^^^^^^^^^^^o^
        ^o^^^^^^^^^^^^^^^^^^^^^^^^^^^^^o^
                       ^^^
                       ^^^
                       ^^^

26 rows selected.
>

The SQL was written some time ago together with friend of my Maris Elsins

PS I am sure you have you own version somewhere in your library.

Have a great year everyone!

Yury

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>