Home » SQL & PL/SQL » SQL & PL/SQL » error in explicit cursor (Oracle, 10g, windows XP)
error in explicit cursor [message #336528] Mon, 28 July 2008 00:56 Go to next message
Messages: 68
Registered: June 2008
I'm getting the error while executing the explicit cursor.
  CURSOR c_emp IS
    select * from emp e,dept d
    where e.deptno=d.deptno;
  v_emp emp%rowtype;
  v_dept dept%rowtype;
  OPEN c_emp;
    FETCH c_emp into v_emp,v_dept;
    Dbms_output.put_line(v_emp.empno || ', ' || v_emp.ename);
  End loop;
  CLOSE c_emp;

ERROR at line 10:
ORA-06550: line 10, column 22:
PLS-00597: expression 'V_EMP' in the INTO list is of wrong type
ORA-06550: line 10, column 5:
PL/SQL: SQL Statement ignored

The error is in fetch. statement.

give me hint to correct this query
Re: error in explicit cursor [message #336535 is a reply to message #336528] Mon, 28 July 2008 01:13 Go to previous messageGo to next message
Michel Cadot
Messages: 65084
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Basically, you can declare a variable c_emp%rowtype.
In your case, this is not possible because several fields have the same name.

Re: error in explicit cursor [message #336537 is a reply to message #336535] Mon, 28 July 2008 01:28 Go to previous message
Messages: 507
Registered: March 2008
Location: INDIA
Senior Member
FETCH c_emp into v_emp,v_dept

Syntax you are using to assign value is wrong.
This is not the correct way.

Previous Topic: How to Make Schema Name as a Variable in Trigger
Next Topic: Returns character data from numeric data
Goto Forum:

Current Time: Sat Jul 22 13:50:02 CDT 2017

Total time taken to generate the page: 0.07172 seconds