I have this conditional INSERT INTO using SELECT 'WHERE NOT' that fails. I got the syntax of this by trying to follow examples I found on Google which claim they work. I can't figure out where the syntax is wrong, unless what I am doing is not supported?
INSERT INTO ENV (ENV_ID, ENV_NAME, SSO_URL, ENV_NAME_LOWER)
SELECT '99', 'Blah', 'https://blah.com:443', 'production'
WHERE NOT EXISTS (SELECT 1 FROM ENV WHERE ENV_ID = '99');
And here is the error I get in Oracle:
Error at Command Line : 3 Column : 1
Error report -
SQL Error: ORA-00923: FROM keyword not found where expected
00923. 00000 - "FROM keyword not found where expected"
UPDATE:
Got a satisfactory answer but couldn't completely get it working due to another error: ORA-54013: INSERT operation disallowed on virtual columns