Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Undocumented SQL REVERSE function.

Re: Undocumented SQL REVERSE function.

From: internetmaster <youlove_at_me.com>
Date: Fri, 02 Aug 2002 17:54:56 -0400
Message-ID: <3D4AFFB0.5050700@me.com>


Daniel Morgan wrote:

> Mark D Powell wrote:
> 
> 

>>Daniel Morgan <dmorgan_at_exesolutions.com> wrote in message news:<3D49A7B2.D50B3490_at_exesolutions.com>...
>>
>>>"Barry P. Grove" wrote:
>>>
>>>
>>>>Hi,
>>>>
>>>>Just discovered the undocumented SQL REVERSE function; it's not the one
>>>>from utl_raw, and it doesn't seem to be defined in /rdbms/admin/standard.sql,
>>>>so I don't know why it might be there. Other than compatibility with
>>>>SQLServer and/or DB2. Checked Oracle versions v7.3.4, v8.0.4, v8.1.7 and
>>>>all of these support it, check out this otherwise innocuous function:
>>>> select reverse('abcdefg') from dual;
>>>>
>>>>Am I missing something? Is this documented in some place I missed?
>>>>
>>>>Barry.
>>>
>>>Interesting. I especially enjoy
>>>
>>>SELECT REVERSE(12345) FROM dual;
>>>and
>>>SELECT REVERSE(SYSDATE) FROM dual;
>>>
>>>SELECT REVERSE(null) FROM dual brings SQL*Plus down in an unceremonious crash.
>>>
>>>Daniel Morgan
>>
>>Interesting, More like wierd:
>>
>>UT1> select sysdate, reverse(sysdate), reverse(trunc(sysdate)) from
>>dual;
>>
>>SYSDATE REVERSE(S REVERSE(T
>>--------- --------- ---------
>>02-AUG-02 09-- -20 00-DECEMB
>>
>>-- reverse sysdate repeatedly produces different resutls, obviously
>>due to time
>>
>>UT1> select reverse(12345), reverse('12345') from dual;
>>
>>REVERSE(12345) REVER
>>-------------- -----
>> -7.790E+33 54321
>>
>>I took Daniel's word about crashing the instance by trying to
>>reverse(null). I had a C book which listed reverse as being a string
>>function to do my last example, 12345 ==< 54321. On (I think) Pyramid
>>I wrote a C program that used it and when we migrated to Sequent the
>>function was unknown so I had to write it.
>>
>>Too bad we probably can't get the story behind why this esists.
>>Developer needed it internally or it was going to be provided but no
>>one ever issued a final decision on how to handle numbers and date
>>datatypes properly ....
>>
>>-- Mark D Powell --
> 
> 
> Didn't crash the instance but did crash SQL*Plus on the client so it is safe to try.
> 
> And yes I did it in order first on 12345, then on SYSDATE, and then on NULL.
> 
> Daniel Morgan


I crap out with a memory fault after running the first one. I have Oracle 8.1.7 on Linux. The other two run fine.

> Received on Fri Aug 02 2002 - 16:54:56 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US