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

Home -> Community -> Usenet -> c.d.o.tools -> Re: pl/slq: how to use variable as from in select

Re: pl/slq: how to use variable as from in select

From: Jim Kennedy <kennedy-family_at_home.com>
Date: Wed, 11 Apr 2001 13:34:48 GMT
Message-ID: <Y3ZA6.3723$%o2.257728@news1.sttls1.wa.home.com>

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

Original text of this message

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