Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Posts
    7

    Unanswered: How to use a column alias name into its where condition

    I have a query which I use the vnl function with an alias name, say :

    select ... , nvl(x,y) date_of_doc, something, ,......
    from file
    where .....

    and this query is used inside a cursor in a procedure with a where condition like this:

    where date_of_doc = f_date;

    but the compiler tell me : ora -00904 , invalid identifier.

    Please, if anyone could tell me hoe to solve this matter.

    TIA

    Alex.

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    Did you try


    where nvl(x,y) = f_date;

    Be wary of implicit data type conversions!
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Jan 2004
    Posts
    7
    yes, you're right.
    that work.

    and is that the only way I think.

    Thanks for you coment.

    Alex.

  4. #4
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    Another way:
    Code:
    select *
    from
    ( select ... , nvl(x,y) date_of_doc, something, ,......
      from file
    )
    where date_of_doc = f_date;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •