oracle - PLS-00302: component must be declared- Unable to resolve -
i tried below program in sql developer , facing issues:
declare cursor emp_complex_cur select e.fname,d.dlocation employee e, dept_location d e.dno=d.dnumber; emp_max_id integer; type emp_complex_rec record(rname employee.fname%type,rlocation dept_location.dlocation%type); begin open emp_complex_cur; emp_complex_rec in emp_complex_cur loop fetch emp_complex_cur emp_complex_rec; dbms_output.put_line('the employee id is: '||emp_complex_rec.rname||' , employee''s location '||emp_complex_rec.rlocation); close emp_complex_cur; end;
i getting error declare variable rname
though has been declared in record.
try:
begin emp_complex_rec in (select e.fname, d.dlocation employee e inner join dept_location d on (e.dno = d.dnumber)) loop dbms_output.put_line('the employee id is: ' || emp_complex_rec.rname || ' , employee''s location ' || emp_complex_rec.rlocation); end loop; end;
the problem original code definition of emp_complex_rec
type colliding definition of emp_complex_rec
cursor loop variable. explicit cursor definition isn't needed either - imo putting select
in for
loop easier , clearer.
share , enjoy.
Comments
Post a Comment