【发布时间】:2020-06-10 15:43:27
【问题描述】:
我正在使用带有输入和输出参数的游标从选择查询中获取数据并间隔插入到另一个表中:-
DECLARE
i_start_date varchar2(20) := '2019-01-02';
i_end_date varchar2(20):= '2019-01-09';
v_ack_records record_inst%ROWTYPE;
CURSOR record_inst(i_start_date varchar2,i_end_date varchar2) IS
select a.id,b.status
from table1.a,table2 b
on a.msg_id=b.msg_id
and b.t_date>=i_start_date
and b.t_date<=i_end_date ;
BEGIN
OPEN record_inst;
LOOP
FETCH record_inst INTO v_ack_records;
EXIT WHEN record_inst%NOTFOUND;
INSERT INTO test_table
(id,status)
VALUES(v_ack_records.id,
v_ack_records.status);
END LOOP;
CLOSE record_inst;
COMMIT;
END;
/
我不太清楚用于此的语法。您能帮忙吗? 我收到以下错误:-
[Error Code: 6550, SQL State: 65000] ORA-06550: line 5, column 15:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 5, column 15:
PL/SQL: Item ignored
ORA-06550: line 14, column 5:
PLS-00306: wrong number or types of arguments in call to 'RECORD_INST'
ORA-06550: line 14, column 5:
PL/SQL: SQL Statement ignored
ORA-06550: line 16, column 28:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 16, column 5:
PL/SQL: SQL Statement ignored
ORA-06550: line 22, column 15:
PL/SQL: ORA-00984: column not allowed here
ORA-06550: line 18, column 1:
PL/SQL: SQL Statement ignored
开始日期和结束日期是输入,id 和状态是输出。
谢谢,
【问题讨论】:
标签: oracle plsql cursor oracle10g dbvisualizer