I'm trying to do the following:
INSERT INTO MyTable(a, b, c)
SELECT a FROM source1
JOIN source2 ON ...
Where source2 contains columns B and C.
However Oracle doesn't seem to like this and is telling me "SQL Error: ORA-00947: not enough values".
Am I doing something wrong here? Is this syntax even possible? Or do I have to rewrite it as:
SELECT a, b, c FROM source1, source2 WHERE ....
Thanks!
Use as many identifiers in the SELECT clause as in the INSERT clause, as in:
INSERT INTO MyTable(a, b, c)
SELECT s1.a, s2.b, s2.c FROM source1 s1
JOIN source2 s2 ON ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With