title: Equivalent to IF NOT EXISTS in Oracle?
body: <p>Following statement works in MSSQL:</p>
  
  <pre><code>IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[FK_StationObjectsID]') AND parent_object_id = OBJECT_ID(N'[Attendance]'))
  BEGIN
      ALTER TABLE Attendance ADD CONSTRAINT FK_StationObjectsID FOREIGN KEY (StationObjectsID) REFERENCES stationobjects (stationobjectsid)
  END
  </code></pre>
  
  <p>In Oracle I tried:</p>
  
  <pre><code>IF NOT EXISTS (SELECT * FROM USER_CONSTRAINTS WHERE CONSTRAINT_NAME = 'FK_STATIONOBJECTSID' AND TABLE_NAME = 'ATTENDANCE') THEN
  BEGIN
      ALTER TABLE Attendance ADD CONSTRAINT FK_StationObjectsID FOREIGN KEY (StationObjectsID) REFERENCES stationobjects (stationobjectsid);
  END;
  </code></pre>
  
  <p>but its giving me an error PLS-00103 "Encountered the symbol 'ALTER'..."</p>