Given a PL/SQL block where I have access to 2 recordtype variables, I want to insert these 2 records into the same table in a single statement, but my attempts to use INSERT ALL have failed thus far. Is it possible to use INSERT ALL with record variables at all?
Here is some code that works, using dedicated inserts:
DECLARE
mProperty1 MyTable%ROWTYPE;
mProperty2 MyTable%ROWTYPE;
...
BEGIN
...
INSERT INTO MyTable VALUES mProperty1;
INSERT INTO MyTable VALUES mProperty2;
...
END;
If I try to convert the statement to a INSERT ALL though, it fails with an error message:
DECLARE
mProperty1 MyTable%ROWTYPE;
mProperty2 MyTable%ROWTYPE;
...
BEGIN
...
INSERT ALL
INTO MyTable VALUES mProperty1
INTO MyTable VALUES mProperty2
SELECT 1 FROM DUAL;
...
END;
ORA-06550: line 14, column 60: PLS-00382: expression is of wrong type ORA-06550: line 13, column 60: PLS-00382: expression is of wrong type ORA-06550: line 13, column 60: PL/SQL: ORA-00904: : invalid identifier ORA-06550: line 12, column 7: PL/SQL: SQL Statement ignored
Am I missing something obvious? Is there a way to make this statement work?
INSERT ALLand is dealing with cursors, which is not what I'm working with here. - julealgonINSERT. - julealgon