Skip to content

Instantly share code, notes, and snippets.

@snickerjp
Created August 2, 2012 10:05
Show Gist options
  • Save snickerjp/3236053 to your computer and use it in GitHub Desktop.
Save snickerjp/3236053 to your computer and use it in GitHub Desktop.
SQL関連
select DATA_FLGS,decode(bitand(DATA_FLGS,16),16,'○','×') from DATA where ID='1' ;
DATA_FLGS DE
--------------- --
16644 ×
select DATA_FLGS,decode(bitand(DATA_FLGS,16),16,'○','×') from DATA where ID='2' ;
DATA_FLGS DE
--------------- --
24605 ○
SQL> select DATA_FLGS,bitand(DATA_FLGS,16) from DATA where ID='1' ;
DATA_FLGS BITAND(DATA_FLGS,16)
--------------- --------------------------
16644 0
SQL> select DATA_FLGS,bitand(DATA_FLGS,16) from DATA where ID='2' ;
DATA_FLGS BITAND(DATA_FLGS,16)
--------------- --------------------------
24605 16
select DATA_FLGS,bitand(DATA_FLGS,POWER(2, (5 - 1))) from DATA where ID='2' ;
DATA_FLGS BITAND(DATA_FLGS,POWER(2, (5 - 1)))
--------------- --------------------------
24605 16
SQL> select DATA_FLGS from DATA;
ID DATA_FLGS
----------- ---------------
1 16644
2 24605
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment