Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Problem with cursor declaration

Problem with cursor declaration

From: Paul Wagner <wagner_at_cs.umn.edu>
Date: 17 Sep 1998 20:02:23 GMT
Message-ID: <6trpsf$17b$1@news1.tc.umn.edu>


I'm trying to set up a cursor within a PL/SQL procedure, where the cursor will allow me to select from a table name passed as a parameter to the procedure (PL/SQL 2.3, Oracle 7.3). I tried something like:

declare
...

   CURSOR pcursor (tablename VARCHAR2) IS

      SELECT * FROM tablename;
...

but I get errors saying the cursor is incomplete or malformed (PLS-00341) and that 'tablename' must name a table to which the user has access (PLS- 00356).

If I change "tablename" in the SELECT statement to the actual name of the table, it works fine. I'd thought, though, from the O'Reilly PL/SQL book, that you can use a cursor parameter anywhere in the select statement. Somehow it seems like the parameter name is being used instead of its value. Any ideas on how to get this working or on any other way to have a cursor open a table which is specified in a string variable in the procedure?

Thanks much for any and all help,

Paul

--
* * * * * * * * * * * * * * * *

Received on Thu Sep 17 1998 - 15:02:23 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US