Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Logic behind CHR (BITAND (p1,-16777216) / 16777215)

698658Mar 12 2010 — edited Mar 12 2010
Hi,
could You explain me whats the logic behind

CHR (BITAND (p1,-16777216) / 16777215) || CHR (BITAND (p1, 16711680) / 65535)
whats the numbers and why '-' sign is important ?

SELECT sid,
           CHR (BITAND (p1,-16777216) / 16777215) ||
           CHR (BITAND (p1, 16711680) / 65535) enq,
           DECODE (CHR (BITAND (p1,-16777216) / 16777215) ||
                   CHR (BITAND (p1, 16711680) / 65535),
                     'TX', 'Transaction (RBS)',
                     'TM', 'DML Transaction',
                     'TS', 'Tablespace and Temp Seg',
                     'TT', 'Temporary Table',
                    'ST', 'Space Mgt (e.g., uet$, fet$)',
                    'UL', 'User Defined',
                    CHR (BITAND (p1,-16777216) / 16777215) ||
                    CHR (BITAND (p1, 16711680) / 65535)) enqueue_name,
          DECODE (BITAND (p1, 65535), 1, 'Null', 2, 'Sub-Share',
                    3, 'Sub-Exclusive', 4, 'Share', 5, 'Share/Sub-Exclusive',
                    6, 'Exclusive', 'Other') lock_mode
   FROM   v$session_wait
   WHERE  sid = 96;
Regards.
Greg
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 9 2010
Added on Mar 12 2010
3 comments
829 views