Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
--测式SQL语句:
With UIDs As
( -- 0 1 2 3 4 5 6 7 8 9 A B C D E F
Select 1 AS Id,
Cast('00000000000000000000010000000000' As Raw(16)) as "UID"
from dual
Union
Select 2 AS ID,
cast('00000000000000000000000100000000' as Raw(16)) as "UID"
from dual
Union
Select 3 AS ID,
cast('00000000000000000000000001000000' as Raw(16)) as "UID"
from dual
Union
Select 4 AS ID,
cast('00000000000000000000000000010000' as Raw(16)) as "UID"
from dual
Union
Select 5 AS ID,
cast('00000000000000000000000000000100' as Raw(16)) as "UID"
from dual
Union
Select 6 AS ID,
cast('00000000000000000000000000000001' as Raw(16)) as "UID"
from dual
Union
Select 7 AS ID,
cast('00000000000000000100000000000000' as Raw(16)) as "UID"
from dual
Union
Select 8 AS ID,
cast('00000000000000000010000000000000' as Raw(16)) as "UID"
from dual
Union
Select 9 AS ID,
cast('00000000000000010000000000000000' as Raw(16)) as "UID"
from dual
Union
Select 10 AS ID,
cast('00000000000001000000000000000000' as Raw(16)) as "UID"
from dual
Union
Select 11 AS ID,
cast('00000000000100000000000000000000' as Raw(16)) as "UID"
from dual
Union
Select 12 AS ID,
cast('00000000010000000000000000000000' as Raw(16)) as "UID"
from dual
Union
Select 13 AS ID,
cast('00000001000000000000000000000000' as Raw(16)) as "UID"
from dual
Union
Select 14 AS ID,
cast('00000100000000000000000000000000' as Raw(16)) as "UID"
from dual
Union
Select 15 AS ID,
cast('00010000000000000000000000000000' as Raw(16)) as "UID"
from dual
Union
Select 16 AS ID,
cast('01000000000000000000000000000000' as Raw(16)) as "UID"
from dual
)
Select * From UIDs Order By UIDs."UID", UIDs.ID;
--查询结果:
ID | UID
---|---
6 | 00000000000000000000000000000001
5 | 00000000000000000000000000000100
4 | 00000000000000000000000000010000
3 | 00000000000000000000000001000000
2 | 00000000000000000000000100000000
1 | 00000000000000000000010000000000
8 | 00000000000000000010000000000000
7 | 00000000000000000100000000000000
9 | 00000000000000010000000000000000
10 | 00000000000001000000000000000000
11 | 00000000000100000000000000000000
12 | 00000000010000000000000000000000
13 | 00000001000000000000000000000000
14 | 00000100000000000000000000000000
15 | 00010000000000000000000000000000
16 | 01000000000000000000000000000000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.