DECLARE
TYPE ename_table_type IS TABLE OF emp.ename%type
INDEX BY BINARY_INTEGER;
TYPE sal_table_type IS TABLE OF emp.sal%type
INDEX BY BINARY_INTEGER;
ename_table ename_table_type;
sal_table sal_table_type;
sql_stat VARCHAR2(100);
BEGIN
sql_stat:='UPDATE emp SET sal=:percent WHERE deptno=:dno RETURNING ename,sal INTO :name,:salary;';
EXECUTE IMMEDIATE sql_stat USING &percent1,&dno RETURNING BULK COLLECT INTO ename_table,sal_table;
FOR i IN 1..ename_table.COUNT LOOP
dbms_output.put_line('雇员'||ename_table(i)||'的新工资为'||sal_table(i));
END LOOP;
END;
------解决方案--------------------
execute immdediate那一句里面有全角空格吧,把空格回车删了重新输入。
DECLARE
TYPE ename_table_type IS TABLE OF emp.ename%type
INDEX BY BINARY_INTEGER;
TYPE sal_table_type IS TABLE OF emp.sal%type
INDEX BY BINARY_INTEGER;
ename_table ename_table_type;
sal_table sal_table_type;
sql_stat VARCHAR2(100);
BEGIN
sql_stat:='UPDATE emp SET sal=:percent WHERE deptno=:dno RETURNING ename,sal INTO :name,:salary';
EXECUTE IMMEDIATE sql_stat USING &percent1,&dno RETURNING BULK COLLECT INTO ename_table,sal_table;
FOR i IN 1..ename_table.COUNT LOOP
dbms_output.put_line('雇员'
------解决方案--------------------
ename_table(i)
------解决方案--------------------
'的新工资为'
------解决方案--------------------
sal_table(i));
END LOOP;
END;