SQL*Plus Help script
select info from   system.help where  upper(topic)=upper('&1')
Test for Leap Years
select year,
       decode( mod(year, 4), 0,
          decode( mod(year, 400), 0, 'Leap Year',
             decode( mod(year, 100), 0, 'Not a Leap Year', 'Leap Year')
          ), 'Not a Leap Year'
       ) as leap_year_indicator
from   my_table
Spell out numbers to words
select decode( sign( &num ), -1, 'Negative ', 0, 'Zero', NULL ) ||
decode( sign( abs(&num) ), +1, to_char( to_date( abs(&num),'J'),'Jsp') ) from dual
Demonstrate simple encoding and decoding of messages
SELECT TRANSLATE(
        'HELLO WORLD',                  -- Message to encode
        'ABCDEFGHIJKLMNOPQRSTUVWXYZ ',
        '1234567890!@#$%^&*()-=_+;,.') ENCODED_MESSAGE
FROM DUAL
/ 
SELECT TRANSLATE(
        '85@@%._%*@4',                  -- Message to decode
        '1234567890!@#$%^&*()-=_+;,.',
        'ABCDEFGHIJKLMNOPQRSTUVWXYZ ') DECODED_MESSAGE
FROM DUAL
 
No comments:
Post a Comment