我的代码如下。但是,由于许多when
和then
语句,它看起来很有趣。这段代码会返回一些值吗?
返回的值应为'32E1.85T'
。并且,when
和pair
的数量是否正确?限制是255吗?
WITH materialtype AS ( SELECT CASE
WHEN SUBSTR('CL32______Q___E',2+13,1)= 'C' THEN 'C'
WHEN SUBSTR('CL32______Q___E',2+11,1)= 'N' THEN 'C'
WHEN SUBSTR('CL32______Q___E',2+13,1)= 'C' THEN 'C'
WHEN SUBSTR('CL32______Q___E',2+13,1)= 'O' THEN 'C'
WHEN SUBSTR('CL32______Q___E',2+13,1)= 'D' THEN 'C'
WHEN SUBSTR('CL32______Q___E',2+13,1)= 'L' THEN 'C'
WHEN SUBSTR('CL32______Q___E',2+13,1)= 'Z' THEN 'C'
WHEN SUBSTR('CL32______Q___E',2+13,1)= 'Y' THEN 'C'
WHEN SUBSTR('CL32______Q___E',2+13,1)= 'E' THEN 'E'
WHEN SUBSTR('CL32______Q___E',2+13,1)= 'F' THEN 'E'
WHEN SUBSTR('CL32______Q___E',2+13,1)= 'R' THEN 'E'
WHEN SUBSTR('CL32______Q___E',2+13,1)= 'W' THEN 'E'
WHEN SUBSTR('CL32______Q___E',2+9,1)= '1' THEN 'C'
WHEN SUBSTR('CL32______Q___E',2+9,1)= '2' THEN 'C'
WHEN SUBSTR('CL32______Q___E',2+9,1)= '3' THEN 'C'
WHEN SUBSTR('CL32______Q___E',2+9,1)= '4' THEN 'C'
WHEN SUBSTR('CL32______Q___E',2+9,1)= '5' THEN 'C'
WHEN SUBSTR('CL32______Q___E',2+9,1)= '6' THEN 'C'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'A' THEN 'C'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'B' THEN 'C'
WHEN SUBSTR('CL32______Q___E',2+9,1)= '7' THEN 'C'
WHEN SUBSTR('CL32______Q___E',2+9,1)= '8' THEN 'C'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'N' THEN 'C'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'C' THEN 'C'
WHEN SUBSTR('CL32______Q___E',2+9,1)= '9' THEN 'C'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'D' THEN 'C'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'E' THEN 'E'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'M' THEN 'E'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'P' THEN 'E'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'W' THEN 'E'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'F' THEN 'E'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'Q' THEN 'E'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'Y' THEN 'E'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'R' THEN 'E'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'S' THEN 'E'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'G' THEN 'E'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'H' THEN 'E'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'T' THEN 'E'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'U' THEN 'E'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'I' THEN 'E'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'J' THEN 'E'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'V' THEN 'E'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'K' THEN 'E'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'L' THEN 'E'
ELSE 'fff'
END
FROM DUAL )
,modeltype AS (
SELECT CASE
WHEN SUBSTR('CL32______Q___E',2+1,2)= '03' THEN CASE WHEN SUBSTR('CL32______Q___E',2+12,1)= 'B' THEN 'THMC'
WHEN SUBSTR('CL32______Q___E',2+13,1)= 'Z' THEN ''
WHEN SUBSTR('CL32______Q___E',2+13,1)= 'Y' THEN ''
WHEN SUBSTR('CL32______Q___E',2+13,1)= 'R' THEN ''
WHEN SUBSTR('CL32______Q___E',2+13,1)= 'W' THEN ''
WHEN SUBSTR('CL32______Q___E',2+4,3)= '225' AND (SELECT * FROM materialtype)='C' THEN '225'
WHEN SUBSTR('CL32______Q___E',2+4,3)= '105' AND (SELECT * FROM materialtype)='C' THEN '105'
WHEN SUBSTR('CL32______Q___E',2+4,1)= 'R' THEN ' low'
WHEN SUBSTR('CL32______Q___E',2+5,1)= 'R' THEN ' low'
WHEN SUBSTR('CL32______Q___E',2+4,1)= '0' AND SUBSTR('CL32______Q___E',2+5,1)<= 9 THEN ' low' END
WHEN SUBSTR('CL32______Q___E',2+1,2)= '05' THEN CASE WHEN SUBSTR('CL32______Q___E',2+12,1)= 'B' THEN 'THMC'
WHEN SUBSTR('CL32______Q___E',2+11,1)= 'W' THEN '3'
WHEN SUBSTR('CL32______Q___E',2+4,3)= '106' AND SUBSTR('CL32______Q___E',2+13,1)= 'Z' THEN '106'
WHEN SUBSTR('CL32______Q___E',2+4,3)= '106' AND SUBSTR('CL32______Q___E',2+13,1)= 'Y' THEN '106'
WHEN SUBSTR('CL32______Q___E',2+4,3)= '106' AND SUBSTR('CL32______Q___E',2+13,1)= 'R' THEN '106'
WHEN SUBSTR('CL32______Q___E',2+4,3)= '106' AND SUBSTR('CL32______Q___E',2+13,1)= 'W' THEN '106'
WHEN SUBSTR('CL32______Q___E',2+4,3)= '226' AND SUBSTR('CL32______Q___E',2+13,1)= 'Z' THEN '226'
WHEN SUBSTR('CL32______Q___E',2+4,3)= '226' AND SUBSTR('CL32______Q___E',2+13,1)= 'Y' THEN '226'
WHEN SUBSTR('CL32______Q___E',2+4,3)= '226' AND SUBSTR('CL32______Q___E',2+13,1)= 'R' THEN '226'
WHEN SUBSTR('CL32______Q___E',2+4,3)= '226' AND SUBSTR('CL32______Q___E',2+13,1)= 'W' THEN '226'
WHEN SUBSTR('CL32______Q___E',2+13,1)= 'Z' THEN ''
WHEN SUBSTR('CL32______Q___E',2+13,1)= 'Y' THEN ''
WHEN SUBSTR('CL32______Q___E',2+13,1)= 'R' THEN ''
WHEN SUBSTR('CL32______Q___E',2+13,1)= 'W' THEN ''
WHEN SUBSTR('CL32______Q___E',2+4,3)= '475' AND (SELECT * FROM materialtype)='C' THEN '475'
WHEN SUBSTR('CL32______Q___E',2+4,3)= '106' AND (SELECT * FROM materialtype)='C' THEN '106' END
WHEN SUBSTR('CL32______Q___E',2+1,2)= '31' THEN CASE WHEN SUBSTR('CL32______Q___E',2+9,1)= '9' AND (SELECT * FROM materialtype)='E' THEN '1.35T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'C' AND (SELECT * FROM materialtype)='E' THEN '1.35T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'E' AND (SELECT * FROM materialtype)='E' THEN '1.35T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'F' AND (SELECT * FROM materialtype)='E' THEN '1.35T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'M' AND (SELECT * FROM materialtype)='E' THEN '1.35T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'P' AND (SELECT * FROM materialtype)='E' THEN '1.35T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'H' AND (SELECT * FROM materialtype)='E' THEN '1.85T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'T' AND (SELECT * FROM materialtype)='E' THEN '1.85T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'H' AND (SELECT * FROM materialtype)='U' THEN '1.85T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'H' AND (SELECT * FROM materialtype)='I' THEN '1.85T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'J' AND (SELECT * FROM materialtype)='E' THEN '1.85T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'V' AND (SELECT * FROM materialtype)='E' THEN '1.85T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'K' AND (SELECT * FROM materialtype)='E' THEN '1.85T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'L' AND (SELECT * FROM materialtype)='E' THEN '1.85T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= '9' AND (SELECT * FROM materialtype)='E' THEN '1.34T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'G' AND (SELECT * FROM materialtype)='E' THEN '1.35T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'S' AND (SELECT * FROM materialtype)='E' THEN '1.35T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'R' AND (SELECT * FROM materialtype)='E' THEN '1.35T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'Y' AND (SELECT * FROM materialtype)='E' THEN '1.35T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'Q' AND (SELECT * FROM materialtype)='E' THEN '1.35T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'D' AND (SELECT * FROM materialtype)='E' THEN '1.35T' END
WHEN SUBSTR('CL32______Q___E',2+1,2)= '32' THEN CASE WHEN SUBSTR('CL32______Q___E',2+9,1)= 'C' AND (SELECT * FROM materialtype)='E' THEN '1.34T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'E' AND (SELECT * FROM materialtype)='E' THEN '1.34T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'F' AND (SELECT * FROM materialtype)='E' THEN '1.34T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'M' AND (SELECT * FROM materialtype)='E' THEN '1.34T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'P' AND (SELECT * FROM materialtype)='E' THEN '1.34T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'H' AND (SELECT * FROM materialtype)='E' THEN '1.8T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'T' AND (SELECT * FROM materialtype)='E' THEN '1.8T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'U' AND (SELECT * FROM materialtype)='E' THEN '1.8T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'I' AND (SELECT * FROM materialtype)='E' THEN '1.8T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'J' AND (SELECT * FROM materialtype)='E' THEN '1.8T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'K' AND (SELECT * FROM materialtype)='E' THEN '1.8T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'L' AND (SELECT * FROM materialtype)='E' THEN '1.8T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'G' AND (SELECT * FROM materialtype)='E' THEN '1.34T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'S' AND (SELECT * FROM materialtype)='E' THEN '1.34T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'R' AND (SELECT * FROM materialtype)='E' THEN '1.34T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'Y' AND (SELECT * FROM materialtype)='E' THEN '1.34T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'Q' AND (SELECT * FROM materialtype)='E' THEN '1.34T'
WHEN SUBSTR('CL32______Q___E',2+9,1)= 'D' AND (SELECT * FROM materialtype)='E' THEN '1.34T' END
ELSE 'dadf'
END
FROM DUAL ) SELECT SUBSTR('CL32______Q___E',2+1,2 ) || (SELECT * FROM materialtype) || (SELECT * FROM modeltype) FROM DUAL