我有像子网这样的表
cidr | ip
我想通过所属 ips 列表选择子网。在 postgres 我可以这样做:
select
ips.ip, net.uid, net.cidr
from
TBL_SID_SUBNETWORK net,
(select unnest(ARRAY[1,2,3]) ip) ips
where
cast (((2^net.cidr) - 1) as bigint)<<(32 - net.cidr) & ips.ip = net.ipaddress
在 postgres 中,我可以传递数组并将其用作表格。
select ips.ip from
(select unnest(ARRAY[1,2,3]) ip) ips
|ip|
1
2
3
是否有可能在 Oracle 中做类似的事情?在一个查询中?我不想创建、填充和删除其他表,因为我间接使用 DB,并且事务由应用程序配置管理。
我知道 Oracle 的TABLE(collection)
功能与我想要的功能相同。但是我不能将集合传递给这个查询,因为我应该在之前声明和填充集合,这样就和创建临时表一样。