1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

ORA-00904: "TFRCID2": invalid identifier

Discussion in 'SQL PL/SQL' started by balu2517, Aug 30, 2013.

  1. balu2517

    balu2517 Active Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    55
    select distinct sl.symbol,
    sl.commoditytype,
    sl.commodity,
    sl.location,
    sl.carrier,
    sl.btuperpound,
    sl.sulfurlbspermmbtu,
    sl.settlementbase
    from
    udcsdba.commodity_price cp,
    udcsdba.total_fuel_related_cost tfrc,
    udcsdba.tfrc_details td,
    UDCSDBA.symbol_lookup sl

    where
    (td.commodity_price_id = cp.id)
    and tfrc.id = td.id
    and sl.symbol = cp.symbol
    and (tfrc.id = tfrcId or tfrc.id = tfrcid2 )
     
  2. Bharat

    Bharat Community Moderator Forum Guru

    Messages:
    1,747
    Likes Received:
    147
    Trophy Points:
    1,805
    Location:
    Vijayawada, India
    Hi Balu,

    What does that tfrcid2 means in last line of where clause ? Is it a column from any table or a variable ? Can you please explain what's the issue you are facing exactly.

    Note:
    And may be you can get error again as tfrcid is there before to this tfrcid2 in where clause of last line. Make sure that, whether it's a column of any table or a variable.
     
  3. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,347
    Likes Received:
    348
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    I expect that both tfrcId and tfrcid2 are not columns in any of the tables queried; if they were they would either be resolved (being in only one of the tables) or you would get the following error:

    ERROR at line 3:
    ORA-00918: column ambiguously defined

    SQL*Plus stops at the first of such errors; it won't report that both tfrcId and tfrcid2 are invalid identifiers until you get tfrcid2 resolved, at which time it will 'find' the second invalid identifier and report it:

    Code (SQL):
    SQL> SELECT empno, ename, sal, job
      2  FROM emp
      3  WHERE (job = blort OR job = upong)
      4  /
    WHERE (job = blort OR job = upong)
                                *
    ERROR at line 3:
    ORA-00904: "UPONG": invalid identifier

    SQL> c/upong/'upong'
      3* WHERE (job = blort OR job = 'upong')
    SQL> /
    WHERE (job = blort OR job = 'upong')
                 *
    ERROR at line 3:
    ORA-00904: "BLORT": invalid identifier

    SQL>
    If those are supposed to be variables you've written them incorrectly. I won't go into that with this response.

    Check what you've written carefully, as Oracle and SQL*Plus are not very forgiving for such mistakes.