与sqlServer类似,我可以做以下操作
create index TimeSeriesPeriodSs1 on TimeSeriesPeriod (validationStatus,completionStatus) where completionStatus= N'Complete' and validationStatus= N'Pending'
解决方法
您可以在Oracle中创建基于函数的索引,利用NULL值不存储在b-tree索引中的事实.就像是
CREATE INDEX TimeSeriesPeriodSs1 ON TimeSeriesPeriod( (CASE WHEN completionStatus = 'Complete' AND validationStatus = 'Pending' THEN validationStatus ELSE NULL END),(CASE WHEN completionStatus = 'Complete' AND validationStatus = 'Pending' THEN completionStatus ELSE NULL END) );