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: SELECT order

Re: SELECT order

From: Patrick Sinke <patrick.sinke_at_capgemini.nl>
Date: Fri, 11 May 2001 14:58:00 +0200
Message-ID: <989588324.278576@sleeper.capgemini.nl>

<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

Original text of this message

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