Guest User

Untitled

a guest
Dec 11th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. CREATE VIRTUAL PROCEDURE GetVals(IN filters string) RETURNS (json clob) OPTIONS (UPDATECOUNT 0, "REST:METHOD" 'GET', "REST:URI" 'get_vals')
  2. AS
  3.  
  4. BEGIN execute immediate
  5. 'SELECT JSONOBJECT(JSONARRAY_AGG(JSONOBJECT(
  6. col1,
  7. col2,
  8. col3,
  9. col4,
  10. col5,
  11. col6,
  12. ....
  13. ....
  14.  
  15. )) as "data"
  16. ) as json FROM(
  17. SELECT SUM((CASE
  18. WHEN ((CASE
  19. .....
  20. ....
  21. .....
  22.  
  23. FROM ex_table AS ex
  24. JOIN table1
  25. ON ...
  26. .....
  27. WHERE a=b AND ' || filters || '
  28. GROUP BY col)
  29. ) AB';
  30. END
Add Comment
Please, Sign In to add comment