Toad World® Forums

Bind Variable "cursorMemoria" is NOT DECLARED


#1

hello,

I have the next example:

create or replace procedure listaEmpleados(cursorMemoria OUT SYS_REFCURSOR)
as
BEGIN
open CURSORMEMORIA for select * from HR.EMPLOYEES;
DBMS_OUTPUT.ENABLE(1000000);
END;

set AUTOPRINT on;

VARIABLE cursorMemoria SYS_REFCURSOR;
EXECUTE listaEmpleados(:cursorMemoria);

But I have the Bind Variable “cursorMemoria” is NOT DECLARED. Please could you help me. Thank you.

Usage: VAR[IABLE] [ [ NUMBER | CHAR | CHAR (n [CHAR|BYTE]) |

VARCHAR2 (n [CHAR|BYTE]) | NCHAR | NCHAR (n) |
NVARCHAR2 (n) | CLOB | NCLOB | REFCURSOR |
BINARY_FLOAT | BINARY_DOUBLE ] ]

Bind Variable “cursorMemoria” is NOT DECLARED
anonymous block completed


#2

Try this. This is working

create or replace procedure listaEmpleados(cursorMemoria OUT SYS_REFCURSOR)
as
BEGIN
open CURSORMEMORIA for select * from EMPLOYEES;
DBMS_OUTPUT.ENABLE(1000000);
END;

set AUTOPRINT on;

set echo on;

DECLARE
cursorMemoria SYS_REFCURSOR;
BEGIN
listaEmpleados(cursorMemoria);
END;
/


#3

Hi Antoine_mc1,

This line:

VARIABLE cursorMemoria SYS_REFCURSOR;

should be this:

VARIABLE cursorMemoria REFCURSOR;

You have the wrong variable type because when I try typing in your example code, I get this:

SQL> var badList sys_refcursor;

Usage: VAR[IABLE] [ [ NUMBER | CHAR | CHAR (n [CHAR|BYTE]) |
VARCHAR2 (n [CHAR|BYTE]) | NCHAR | NCHAR (n) |
NVARCHAR2 (n) | CLOB | NCLOB | BLOB | BFILE
REFCURSOR | BINARY_FLOAT | BINARY_DOUBLE ] ]

But it works fine with just REFCURSOR.