Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: pl/slq: how to use variable as from in select
You need to use dbms_sql package or execute immediate. Oracle is trying to resolve the from so it can do type checking etc. when it compiles it and since it is a variable it cannot. Basically, you have to use dynamic sql. Jim
"Ralf Bender" <ralf_bender_at_web.de> wrote in message
news:3ad455aa$1_at_netnews.web.de...
> hello
>
>
> in pl/sql i wrote the following statement :
> LOOP
> FETCH c_AnzBelege INTO c_TName;
> EXIT WHEN c_AnzBelege%NOTFOUND;
>
>
>
> SELECT Name,Login
> FROM c_TName
> WHERE trunc(create_on) = trunc(sysdate)-1;
>
>
> END LOOP
>
>
> But i got PLS-00201 at the FROM variable? Could someone explain how to do
it
> right?
>
>
> thx a lot
> ralf
>
> --
> _____________________________________________________________
> NewsGroups Suchen, lesen, schreiben mit http://netnews.web.de
Received on Wed Apr 11 2001 - 08:34:48 CDT