Link to home
Start Free TrialLog in
Avatar of wwwbetyar
wwwbetyar

asked on

identifier 'V_CUR' must be declared

Hello guys

What's wrong ?
v_Cur is a ref cursor

begin
  v_Cur := GetALLRecordByIDG(FTable, FIDG);
  select max(ID) into v_maxid from v_Cur;    //------------------ Error : *
  return(v_maxid);
end;

*"Error: PLS-00201: identifier 'V_CUR' must be declared
Line: 93
Text: select max(ID) into v_maxid from v_Cur;"
Avatar of cjjclifford
cjjclifford

Is there a DECLARE section missing, where v_Cur is defined?
Avatar of schwertner
Ref Cursor should also be declared.
Avatar of wwwbetyar

ASKER

v_Cur is defined in the package header !

Header :
type
       refcur is ref cursor;  
...



Body :

function GetALLRecordByIDG(FTable in varchar2, --melyik tábla..
                           FIDG in number)     --..melyik IDG-je alapján
  return refcur is      
  v_Cur  refcur;    
  v_sql  long;
-- MODIFICATION HISTORY
-- Person          Date         Comments
-- --------------  -----------  -------------------------------------------
-- Visszatér az összes rekorddal amelynek IDG-je alapjan azonos (csak IDG-t tudjuk)
-- --------------  -----------  -------------------------------------------
-- Zalán Péter     2004.09.06.   Létrehozás
-- --------------  -----------  -------------------------------------------    
begin
  v_sql := 'select * from '||FTable||' where IDG='||to_char(FIDG);
  open v_Cur for v_sql;
  return(v_Cur);
end;  

and now ????
v_Cur cannot be accessed like that in the calling procedure.

What you have to do is something like:

-- test procedure part of the package defining "refcur"
PROCEDURE test_proc
IS
    v_Cur refcur;
BEGIN
    v_Cur := GetALLRecordByIDG(FTable, FIDG);
    -- etc, etc...
END;
/


ASKER CERTIFIED SOLUTION
Avatar of cjjclifford
cjjclifford

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial