Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2008
    Posts
    2

    Unanswered: Expressions in ORDER BY Clause

    -
    MOVIE table structure:
    movie_id not null number primary key
    title not null varchar2(32)
    year not null number
    release date
    list_price float(126)
    rank number
    reviews number
    review_rank number(2,1);

    query:

    select movie_id, title, year, release, list_price, review_rank
    from movie
    where movie_id > '5'
    order by year/NVL(rank,1);

    can anyone tell me that how can a string compared to the column with number datatype and the expression given in the ORDER BY Clause?

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    I understand the table, I understand the query, but I don't understand the question. What does it mean?
    how can a string compared to the column with number datatype and the expression given in the ORDER BY Clause?

  3. #3
    Join Date
    Mar 2007
    Posts
    623
    > how can a string compared to the column with number datatype

    Data conversion, read about implicit one. Just want to stress:
    Oracle recommends that you specify explicit conversions, rather than rely on implicit or automatic conversions
    > the expression given in the ORDER BY Clause

    Arithmetics operators
    NVL
    Which one of these do you not understand?

  4. #4
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    Both year and rank are number fields. The only failure would be if rank equals zero.
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  5. #5
    Join Date
    Feb 2008
    Posts
    2
    Thank u for your information.

    I am just new to the Oracle and also preparing for the OCA IZO-007 exam.

    For the second question:
    > the expression given in the ORDER BY Clause

    I understood the expression given in the query and let me know that there are any specific conditions for the expressions in the ORDER BY Clause.

  6. #6
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Except that they must be valid, I believe there aren't any further restrictions.

Posting Permissions

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