Operation Details
Description:  
Sterotype: nsmulti
SQL
select distinct mtv.motivationid 
into :motivationID 
from Motivation mtv 
where mtv.state in ('MOTS10000', 'MOTS10004')
and not exists (
  select * from IntakeApplication ia where ia.rootentityid = mtv.datastoreid
) and not exists (
  select * from MotivationIntakeAppLink mia where mia.motiveid = mtv.motivationid
)