How to add the following to a stored procedure (Cache Studio)
1. Select from a few tables and insert result into a TABLEA.
2. Then select data from the TABLEA, apply some SQL logic, insert results into TABLEB.
3. SELECT * FROM TableA
UNION ALL
SELECT * FROM TableB
InterSystems Caché is a multi-model DBMS and application server. See more details here.

.png)