Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: passing variable to a cursor
On Thu, 08 Sep 2005 07:55:50 -0700, cbarak wrote:
> I would like to pass in a schema name to a cursor but I'm not sure what
> the syntax is, can someone help...
>
> cursor mycursor (v_schemaname in varchar2) is
> select name from v_schemaname.emp where empid=100;
>
> I've been getting ora-933:SQL command not properly ended.
>
> thanks.
>
> charlin
What you are trying to do is cheating. Here's what a cursor looks
like:
1 declare
2 cursor csr(name varchar2) is
3 select empno,job,hiredate from emp 4 where ename=name;
9 c.hiredate);10 end loop;
PL/SQL procedure successfully completed.
To actually modify the SQL statement itself, you need to use execute immediate or DBMS_SQL. No cheating.
-- http://www.mgogala.comReceived on Thu Sep 08 2005 - 23:55:40 CDT