Re: Select from a today_table_name
From: G M <zlmei_at_hotmail.com>
Date: 17 Sep 2002 11:32:19 -0700
Message-ID: <50a5e6b6.0209171032.2991a3a4_at_posting.google.com>
Date: 17 Sep 2002 11:32:19 -0700
Message-ID: <50a5e6b6.0209171032.2991a3a4_at_posting.google.com>
the.clansman_at_eudoramail.com (David) wrote in message news:<95e48c3a.0209160135.5caa7bb3_at_posting.google.com>...
> How have I to do to make a Select from a tabla that its name is today
> date. I need to put this in a stored procedure.
>
> It's not possible to use a function in from.
> SELECT 'TABLE_' || TO_CHAR(SYSDATE,'YYYYMMDD') into cot From DUAL
If your are on Unix, then it can be done. here is one way:
- Create a file called "sel_call.sql" with the following code: --- SET ECHO OFF SET TRIMSPOOL ON SET HEADING OFF SET FEEDBACK OFF SET PAGES 0 spool /oracle/sel_today.sql select 'select * from '|| to_char(sysdate, 'DD_MM_YYYY') || ';' from dual; spool off
_at_/oracle/sel_today.sql
host rm /oracle/sel_today.sql
--- and save it. 2. then login sqlplus, then type _at_sel_call.sql You should see your result. HTH. GuangReceived on Tue Sep 17 2002 - 20:32:19 CEST