Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: dbms_sql help
Hello,
In Oracle 8i ...
Oracle8 Enterprise Edition Release 8.0.6.2.0 - Production.
I have tried the following in the package-function :
execute immediate ('select * from emp');
...
but, compiler shouts :
PLS-00103: Encountered the symbol "IMMEDIATE" when expecting one of the
following:
:= . ( @ % ;
The symbol ":=" was substituted for "IMMEDIATE" to continue.
Besides,
execute immediate ('select * from emp') - to what variable
(I need to keep it somehow).
I can be specific, and do select from a specific table, but I need to build a generic function for any table, that can be used in SQL statement - cann't I ?
Thanks :)
<frank.van.bortel_at_gmail.com> wrote in message
news:1141917506.858084.99260_at_z34g2000cwc.googlegroups.com...
> Ehm... why do you wrap it in a function to begin with?
> I mean, you can just as well do
> select * from emp;
>
> instead of :
> select my_pack.my_func from dual;
> and have a function defined that will do the select * from emp.
>
> Why all the hassle?
> And with execute immediate (9i and up, not 8i), it would be:
> execute immediate ('select * from emp');
> No cursor prepare, execute, bind, etc, you would use with dbms_sql.
>
> In the link provided, execute immediate has examples, too.
> But usually this approach leads to non-scalable applications.
>
Received on Mon Mar 13 2006 - 03:06:39 CST