Select from execute block?

杀马特。学长 韩版系。学妹 提交于 2019-12-13 15:02:21

问题


Is is possible to select from execute block result? I want to perform some operation (sum etc..) from it.

 select t1.* 
 from 
   ( execute block 
     returns ( 
       OUT_VALUE integer ) 
    as 
    begin 
    ... 
    suspend; 
  end ) t1

or

 with   
 t1 as ( execute block ... ) 
   select * 
   from t1 
   order by 
     t1.sort_column 

Neither does not work. Anyone has an advice? Thanks!


回答1:


You should create an independent stored procedure like

create procedure proc1
returns (
  OUT_VALUE integer 
) as
begin
   ... 
  suspend; 
end

and then select on this proc

select sum(OUT_VALUE)
from proc1


来源:https://stackoverflow.com/questions/37719525/select-from-execute-block

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!