测试数据:
db2 => select * from temp_table
X
-----------
11
22
223
10
120
113
6 条记录已选择。
db2 => select * from temp_table where SUBSTR (char(X),9,1)='3'
X
-----------
0 条记录已选择。
db2 => select * from temp_table where SUBSTR (char(X),3,1)='3'
X
-----------
223
113
2 条记录已选择。
db2 => select * from temp_table where SUBSTR (char(X),4,1)='3'
X
-----------
0 条记录已选择。
db2 => select * from temp_table where SUBSTR (char(X),8,1)='3'
X
-----------
0 条记录已选择。
db2 => select * from temp_table where SUBSTR (char(X),1,1)='3'
X
-----------
0 条记录已选择。
db2 => select * from temp_table where SUBSTR (char(X),1,1)='1'
X
-----------
11
10
120
113
4 条记录已选择。
以下是IBM 官网Doc