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

Home -> Community -> Usenet -> c.d.o.server -> Re: Require Col on the fly

Re: Require Col on the fly

From: Ilya Kuzkin <ikuzkin_at_fbc.ca>
Date: 2000/05/30
Message-ID: <3933fa34 3@news.cadvision.com>#1/1

Kashif, try this:

  1. select decode (:x, 0, fld0, 1, fld1, 2,fld2) as COLONTHEFLY from MYTABLE;
  2. dynamic SQL might help for common case. for example: dbms sql.parse (cursor name, 'select fld'||x||' from MYTABLE',dbms sql.v7);

Sincerely, ilya Kuzkin.

    Kashif Ahmed wrote in message <3933A92D.FD76DEE0_at_cyber.net.pk>...     Dear
    I have "fld0", "fld1", "fld2" column names in my table and now in select statement I need to make the col name on the fly as,

    select fld|| <x> from mytable;
    <x> = it must be the value what I give input e.g 0, 1, or 2. I want to select the particular column value what I insert as input or whatever the value of x. (0, 1, 2) .

    select fld||'0' from mytable; ==== > doesn't work

    Please tell me how do I solve this.

    Best Regards
    Kashif Ahmed

      
      


--
Received on Tue May 30 2000 - 00:00:00 CDT

Original text of this message

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