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
jyothsna1612
Messages: 68
Registered: June 2008
Member
Hi,
I'm getting the error while executing the explicit cursor.
Declare
  CURSOR c_emp IS
    select * from emp e,dept d
    where e.deptno=d.deptno;
  v_emp emp%rowtype;
  v_dept dept%rowtype;
Begin
  OPEN c_emp;
  Loop
    FETCH c_emp into v_emp,v_dept;
    Dbms_output.put_line(v_emp.empno || ', ' || v_emp.ename);
  End loop;
  CLOSE c_emp;
End;


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: 64153
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.

Regards
Michel
Re: error in explicit cursor [message #336537 is a reply to message #336535] Mon, 28 July 2008 01:28 Go to previous message
rajatratewal
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.

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


Current Time: Sun Dec 11 08:32:32 CST 2016

Total time taken to generate the page: 0.11580 seconds