WITH RECURSIVE DEPBLOCKTABLE(BLOCKID, DEPBLOCKID) AS
(
   SELECT
      MID_BLOCKID as BLOCKID,
      MID_DEPBLOCKID as DEPBLOCKID
   FROM
      R5MAINISOLATIONDEPBLOCKS
   WHERE
      MID_BLOCKID = <param.blockid>
   UNION
   SELECT
      depblocks.MID_BLOCKID as BLOCKID,
      depblocks.MID_DEPBLOCKID as DEPBLOCKID
   FROM
      DEPBLOCKTABLE,
      R5MAINISOLATIONDEPBLOCKS as depblocks
   WHERE
      depblocks.MID_BLOCKID = DEPBLOCKTABLE.DEPBLOCKID
)
SELECT
   R5MAINISOLATIONMAINS.MIP_GISOBJID as GISOBJID,
   DEPBLOCKTABLE.DEPBLOCKID as DEPBLOCKID
FROM
   R5MAINISOLATIONMAINS,
   DEPBLOCKTABLE
where
   R5MAINISOLATIONMAINS.MIP_BLOCKID = DEPBLOCKTABLE.DEPBLOCKID
