Search code examples
sqlintersystems-cache

"Output" equivalent for Intersystems Cache - Or how to output updated data?


I have the following query I need to run on my production data, but I would like to output the id column so that I have a record of the updated rows. In MS SQL Server I can use OUTPUT but I can't find anything similar in the documentation.

UPDATE someTable as st
SET st.InActive = 1
WHERE st.ID IN (
        SELECT a.ID
        FROM someTable a
        natural join otherTable b
        WHERE b.EffectiveDate < '2016-09-15'
        ORDER BY a.ID Desc
)

Solution

  • Looks like you looking for something like RETURNING clause in PostgreSQL. Unfortunately InterSystems Caché does not have such functionality or similar.