Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: SELECT order
<david.largeteau_at_sage.com> schreef in berichtnieuws
9de8hl$ca5$1_at_news.netmar.com...
> Hi,
> How can i use variable table name in the FROM clause of a select statement
?
> In a PL/SQL bloc :
> ..
> Begin
> ..
> SELECT COUNT (*)
> INTO w_count
> FROM name_of_table
> WHERE cod_clt = enr_orig.cod_clt;
> ..
> End;
>
> Thanks
>
I think you want the name_of_table entered as a parameter of substitution
variable.
So, that is gonna be Dynamic sql. But that information can be found in the
Oracle Manuals, so I'm not gonna explain that here. A less difficult
approach would be:
accept tabelnaam
spool out.lis
select ..
from &tabelnaam
where .....
;
spool off
@out.lis
This can be tuned a bit, but I think you got the picture here.
Regards,
Patrick Sinke
Cap Gemini Ernst & Young, sector Financial Services
Received on Fri May 11 2001 - 07:58:00 CDT
![]() |
![]() |