Results 1 to 3 of 3

Thread: +columnname???

  1. #1
    Join Date
    Feb 2004
    Location
    inida
    Posts
    62

    Unanswered: +columnname???

    hi,

    plz c the queries

    select +sname from supplier;

    select /*+sname*/sname from supplier;

    select sname from supplier;

    Can anybody explain the difference between those queries?
    Output is same.

    TanQ

  2. #2
    Join Date
    Jan 2004
    Posts
    492

    Re: +columnname???

    Originally posted by neema
    hi,

    plz c the queries

    select +sname from supplier;

    select /*+sname*/sname from supplier;

    select sname from supplier;

    Can anybody explain the difference between those queries?
    Output is same.

    TanQ
    /* */ indicates a comment in Oracle, so that part is ignored, which is why the second two queries are the same. About the first one, maybe someone else can shed some light.

  3. #3
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: +columnname???

    They all do the same thing, but the 3rd one is more sensible.

    Query 1 works (surprisingly), presumably because Oracle simply ignores the + sign. Try it with a minus sign and you would get ORA-01722: invalid number (unless sname contains numeric values).

    Query 2 has a comment that looks a bit like an optimizer hint, but isn't, so is just ignored.

Posting Permissions

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