I read here that the syntax is as follows:
INSERT WHEN ([Condition]) THEN INTO [TableName] ([ColumnName]) VALUES ([VALUES]) ELSE INTO [TableName] ([ColumnName]) VALUES ([VALUES]) SELECT [ColumnName] FROM [TableName];
But I do not want to provide values โโfrom another table. I just want to type them, so I have:
INSERT WHEN EXISTS (SELECT 1 FROM FOO WHERE NAME = 'JOE') THEN INTO BAR (NAME, AGE) VALUES ('JOE', 50)
and this throws an exception: ORA-00928: missing SELECT keyword.
I want to perform an insertion if the given value is found in another table.
Kamil source share