2017-07-17 56 views
0

在存儲過程中,我想給出一組輸入,其中我也有一些表。檢查HANA中存儲過程的輸入

我可以使用條件來處理空的標量輸入,但我不知道如何處理空表或輸入是空的。

我想有一些這樣的事

count = select count(*) from input_table;  
if :count = 0 or not given(~) --how to check if the input is not given? 
then 
tab = select * from table; 
else 
tab = input_table; 
end if; 

謝謝!

回答

0
select * from Table t1 
where exists(
select 1 from ChildTable t2 
where t1.id = t2.parentid) 
procedure 
if exists(select 1 from table) 
begin 
-- do stuff 
end 
+0

嘿Nisarg,你能解釋一下我的孩子桌子和它的ID嗎?我沒有真正理解。謝謝! – Sai