SELECT * FROM YOURTABLE
WHERE
substr(PRODUCT_ID, 3, 2)='33'
AND
substr(PRODUCT_ID, 1, 2)='11'
OR
SELECT * FROM YOURTABLE
WHERE
PRODUCT_ID LIKE '11%33%'
沒錯總之,你必須轉換爲字符串
reference of substr
目的
SUBSTR函數返回char的一部分,從字符位置開始,substring_length個字符長。 SUBSTR使用由輸入字符集定義的字符計算長度。 SUBSTRB使用字節而不是字符。 SUBSTRC使用Unicode完整字符。 SUBSTR2使用UCS2碼點。 SUBSTR4使用UCS4碼點。
If position is 0, then it is treated as 1.
If position is positive, then Oracle Database counts from the beginning of char to find the first character.
If position is negative, then Oracle counts backward from the end of char.
If substring_length is omitted, then Oracle returns all characters to the end of char. If substring_length is less than 1, then Oracle returns null.
char可以是任何數據類型CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB
。 position和substring_length must be of datatype NUMBER
,或者任何可以隱式轉換爲NUMBER的數據類型,並且必須解析爲整數。返回值與char的數據類型相同。作爲參數傳遞給SUBSTR的浮點數自動轉換爲整數。
我認爲你正在尋找一個按位和。參見: http://stackoverflow.com/questions/360844/mysql-bitwise-operations-bloom-filter – Blazes