試試這個
WITH
locmembers(member_id, email_address) AS
(SELECT 1,'[email protected]' FROM dual UNION ALL --numbers but < 10 digits
SELECT 2,'[email protected]' FROM dual UNION ALL --numbers = 10 digits
SELECT 3,'[email protected]' FROM dual UNION ALL --numbers > 10 digits
SELECT 4,'[email protected]' FROM dual UNION ALL
SELECT 5,'[email protected]' FROM dual --email address with 10 digits
)
SELECT
member_id
,email_address
,SUBSTR(REGEXP_REPLACE(email_address, '^[[:digit:]]{10}'),1,1)
FROM
locmembers
WHERE SUBSTR(REGEXP_REPLACE(email_address, '^[[:digit:]]{10}'),1,1) = '@'
;
你嘗試搜索'甲骨文substring'? –
'WHERE REGEXP_LIKE(EMAILADDRESS,'^ [[:digit:]] {10}')' –
如果'EMAILADDRESS'已經是'varchar',那麼將它投射到一個 –