Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Substitution of column names

Re: Substitution of column names

From: Aram Meguerian <aram_at_unisys.com.br>
Date: 1997/02/15
Message-ID: <01bc1b0f$cc3954e0$5b03dcc8@psaphos>#1/1

> My select statement is
> SELECT FUND, ORGN, ACCT, TOTAL_nn_BUDG
> FROM MYTABLE;
>
> Every month the select statement changes. Is there a way to have the
> user input the cycle (01, 02, ... 12) and then insert what the user
> inputs into the column name? Otherwise, every month I have to edit the
> script to change the 01s to 02s, or the 02s to 03s, etc.
>

      If you're using sqlplus to run your script, try:

      	SELECT FUND, ORGN, ACCT, TOTAL_&1_BUDG
           FROM MYTABLE;

   and call it using the following command line:

         sqlplus -s user/passwd @myscript month

      Else, if you're in some other tool, try using DBMS_SQL package    to issue the statement.

-- 

                     Aram Meguerian
                     aram_at_uninet.com.br

-------------------------------------------------------------------
   "There's no such a thing as a free lunch in the Universe."
          Lazarus Long Notebook's, Lazarus Long
		from Time enough for love, by Robert A. Heinlein
-------------------------------------------------------------------
I don't work at Unisys, it is just my Internet Provider, 
so don't blame it for anything I have just said.
-------------------------------------------------------------------
Received on Sat Feb 15 1997 - 00:00:00 CST

Original text of this message

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