From statement [message #371558] |
Tue, 07 November 2000 14:01 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
denise
Messages: 64 Registered: November 2000
|
Member |
|
|
In my PL/SQL there is a table in a from statement that I need to use that will change each quarter. The beginning of the table name is always the same but the end changes by quarter. For example in quarter one it will be gcs_fytd_2001Q1 and for quarter three it will be gcs_fytd_2001Q3. Is there a way to pass the quarter to the table in a from statement without using an '&' variable?
|
|
|
Re: From statement [message #371559 is a reply to message #371558] |
Tue, 07 November 2000 14:18 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Christian Boulet
Messages: 9 Registered: April 2000
|
Junior Member |
|
|
Hello, Of course you could use Dynamic SQL inside your PL/SQL to concatenate the deduced table_name with the rest of the select statement...
text:='SELECT AAA FROM '||tbl_part1||'_'||tbl_part2||' where bbb = 123';
in 8i you can use Native Dynamic SQL
OPEN CUR_AAA for text;
loop
fetch......
in 8.0.5 you'll need to use the old DBMS_SQL package...
Good luck!
|
|
|
|