title: How ro store rowids in order to delete them after corresponding child records are deleted
body: <p>I would like to delete certain rows that i collect with the following select:</p>
  <pre><code>DELETE from REMINDER 
  where exists 
  (
  SELECT r.rowid
  FROM reminder r
  inner join reminder_users u on u.reminder_id = r.id
  inner join device d on d.id = (regexp_replace(r.origin_values, '[^0-9]', '')) and d.NEXT_TEST_DATE_INTERNAL &lt;&gt; u.deadline
  inner join device_test t on t.id = d.NEXT_TEST_INT_ID
  where u.receipt = 0 and t.TEST_INTERNAL_EXTERNAL = 0 and r.NAME like '%Interne%' and r.NAME not like '%Externe%' and u.DEADLINE &gt; sysdate
  );
  </code></pre>
  <p>The problem is, that there is a table 'reminder_users' that contains child records for the parent-table 'Reminder'. So I have to delete the child records first with the following statement:</p>
  <pre><code>DELETE from REMINDER_USERS
  where exists
  (
  SELECT u.ROWID
  from reminder_users u
  inner join reminder r on r.id = u.reminder_id
  inner join device d on d.id = (regexp_replace(r.origin_values, '[^0-9]', '')) and d.NEXT_TEST_DATE_INTERNAL &lt;&gt; u.deadline
  inner join device_test t on t.id = d.NEXT_TEST_INT_ID
  where u.receipt = 0 and t.TEST_INTERNAL_EXTERNAL = 0 and r.NAME like '%Interne%' and r.NAME not like '%Externe%' and u.DEADLINE &gt; sysdate
  );
  </code></pre>
  <p>When I perform the second operation, the first statement returns obviously zero rows, because I deleted the child records. This is why I am looking for a way to store the rowids from the first operation, delete the child records afterwards and finally delete the previously stored data from the table 'REMINDER'.</p>
  <p>Do I have to use a CURSOR here? (Note: If the querys return rows, there will always be at least 2 rows affected). I tried to declare a variable that stores the rows, but then I get an 'ORA-01422: exact fetch returns more than requested number of rows' error...</p>
  <p>Thanks in advance!</p>