我有5个不同的表,在所有表中bat_id是公共列。我有bat_id列表,我必须检查所有5个表预期示例输出中的每个bat_id是否存在记录,如下所示
示例输出:
------------------------------------------------------
l table1 l table2 l table3 l table4 l table5 l bat_id
l 0 l 21 l 5 l 0 l 1 l 452
l 5 l 3 l 0 l 0 l 15 l 123
l 235 l 0 l 0 l 0 l 87 l 586
-------------------------------------------------------
我已经尝试过以下查询,但它一次只能为一个bat_id工作如何修改以下查询以检查单个查询中所有bat_id值的记录。
我必须找到记录计数的bat_id值列表bat_id = 452,123,586,5869,001
declare
Bat_id Number
&Bat_id = 452
begin
select
(Select count(*) from Document where bat_id=&Bat_id) as table1,
(Select count(*) from Eds_task where bat_id=&Bat_id) as table2,
(Select count(*) from MI_Doc_Reads where bat_id=&Bat_id) as table3,
(Select count(*) from MI_Batch_Status where bat_id=&Bat_id) as table4,
(Select count(*) from Batch where bat_id=&Bat_id) as table5
from dual;
end
提前致谢
答案 0 :(得分:0)
在匿名块内打印select语句结果可能需要一个游标。我太懒了,所以我这样做了。
app.directive('bootstrapselectpicker', function ($timeout) {
return {
restrict: "A",
link: function (scope, element, attrs, ctrl) {
$timeout(function () {
element.selectpicker();
});
}
};
});