大きな XML を解析し、FORALL ステートメントを使用してテーブルに挿入しようとしています。
次の表を作成しました。
create table users(EMPNO NUMBER(4),SAL NUMBER(4),HIREDATE DATE);
これが私のコードです
declare
TYPE import_q_rec IS RECORD (
EMPN dbms_sql.NUMBER_TABLE,
SALN dbms_sql.NUMBER_TABLE,
HIREDATE dbms_sql.Date_Table );
l_import_q_tab import_q_rec;
l_row_index number := 0;
l_temp_nd XMLTYPE;
l_result_xml XMLTYPE:=XmlType('<ROWSET>
<ROW>
<EMPNO>2290</EMPNO>
<SAL>2000</SAL>
<HIREDATE>31-DEC-1992</HIREDATE>
</ROW>
</ROWSET>');
begin
WHILE l_result_xml.Existsnode('/ROWSET/Row[' || To_Char(l_row_index) || ']') > 0
LOOP
l_temp_nd :=l_result_xml.Extract('/ROWSET/Row[' || To_Char(l_row_index) || ']');
l_import_q_tab.EMPN(l_row_index) := (l_temp_nd, '/Row/EMPNO/text()', NULL);
l_import_q_tab.SALN(l_row_index) := (l_temp_nd, '/Row/SAL/text()', NULL);
l_import_q_tab.HIREDATE(l_row_index) := (l_temp_nd, '/Row/HIREDATE/text()', NULL);
l_row_index := l_row_index + 1;
END LOOP;
FORALL i IN 1 .. l_row_index - 1
INSERT INTO users
VALUES (l_import_q_tab.EMPN(i), l_import_q_tab.SALN(i), l_import_q_tab.HIREDATE);
end;
次のエラーが表示されます
ORA-06550: line 21, column 38:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 21, column 2:
PL/SQL: Statement ignored
ORA-06550: line 22, column 39:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 22, column 2:
PL/SQL: Statement ignored
ORA-06550: line 23, column 42:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 23, column 2:
PL/SQL: Statement ignored
ORA-06550: line 30, column 51:
PLS-00382: expression is of wrong type