我正在一个ORA-12733: regular expression too long错误。有没有办法解决?
if (REGEXP_LIKE(v,'^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]1{0,1}[0-9]){0,1}[0-9]))$')) then
self.success := 1;
self.message := null;
return;
else
self.success := 0;
self.message := 'Invalid IPv6 address. Example of a valid format: 2001:0db8:0000:0000:0000:ff00:0042:8329';
return;
end if;
更新:我想这个,但是当我运行select测试它,它抛出ORA-29531: no method isProperIPv6Address in class ipv6。我之前并没有在Oracle中与Java搞混,所以我不确定我是否接近或者这是一个糟糕的主意。
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED ipv6 as
public class ipv6
{
public static int isProperIPv6Address(String address)
{
try
{
java.net.Inet6Address.getByName(address);
return 1;
} catch(Exception e) { return 0; }
}
}
create or replace function isProperIPv6Address (string in varchar2)
return number as language java name 'ipv6.isProperIPv6Address(java.lang.Int) return java.lang.Int';
select isProperIPv6Address('blah') from dual;
但看来java.net.Inet6Address.getByName()将字面上出去上网,看看这个地址确实存在(从https://community.oracle.com/message/8648095拍摄)。我的理解是否正确?我不需要那个。我只需要验证它们的语法是否有效。