Forum Stats

  • 3,875,926 Users
  • 2,266,993 Discussions
  • 7,912,377 Comments

Discussions

question on to_char(number)

738124
738124 Member Posts: 10
Hi.
can everyone explain me why
SELECT TO_CHAR(1890.55,'$99,999D99' FROM DUAL;
gives ORA-01481 error?
I cannot find anything in the SQL reference...
Thanks
Tagged:
«1

Answers

  • Kamran Agayev A.
    Kamran Agayev A. Member Posts: 5,520 Bronze Crown
    user10170777 wrote:
    Hi.
    can everyone explain me why
    SELECT TO_CHAR(1890.55,'$99,999D99' FROM DUAL;
    gives ORA-01481 error?
    I cannot find anything in the SQL reference...
    Thanks
    Why you post it under Certification topic? There's a [SQL/PL-SQL |http://forums.oracle.com/forums/forum.jspa?forumID=75] forum where you should post it
    Anyway, try this:
    SELECT TO_CHAR(1890.55,'$99,999.99') FROM DUAL
    Kamran Agayev A.
  • ttt
    ttt Member Posts: 394 Bronze Badge
    First of all there is a miising right parenthesis and
    ora-01481 means "invalid number format model"

    For format you should use '$99G999D99' and also you should study format models :)

    At the last i think that this was a quetion for some other forum.

    T
    ttt
  • Dird
    Dird Member Posts: 1,225
    Hi Cinzia,

    Googling that line of code is very quickly making me suspicious...

    http://blogs.oracle.com/certification/2009/05/the_route_you_choose.html
    http://www.certguard.com/braindumps.asp

    Mike
  • 738124
    738124 Member Posts: 10
    Yes, I forgot the right parenthesis in reporting the code in the forum,
    but my question is why I have that error?
    select to_char(1890.55,'$99,999.99') from dual; ---> works
    select to_char(1890.55,'$99G999D99') from dual; ---> works
    select to_char(1890.55,'$99,999D99') from dual; --> ORA-01481 error
    select to_char(1890.55,'$99D999.99') from dual; --> ORA-01481 error
    why?
    In the SQL reference there's no written that . and , must not be mixed with D and G....
    Thanks
  • Dird
    Dird Member Posts: 1,225
    Kamran,

    Because he's dumping for 1z0-051 ofcourse :P

    Mike
  • Kamran Agayev A.
    Kamran Agayev A. Member Posts: 5,520 Bronze Crown
    Dird wrote:
    Kamran,

    Because he's dumping for 1z0-051 ofcourse :P

    Mike
    Hi Mike

    You've made wonderful research by searching it over google and finding out that the OP has taken this question from dumps :)
  • Dird
    Dird Member Posts: 1,225
    edited Dec 2, 2009 6:28AM
    Kamran Agayev A. wrote:
    Hi Mike

    You've made wonderful research by searching it over google and finding out that the OP has taken this question from dumps :)
    If in doubt, Google =) I also quickly checked through the exam guide exam (on CD with the exam guide book) and it wasn't in there.

    Edit: I suppose it could be in the transcender prep exam or another alternative though.

    Mike

    Edited by: Dird on Dec 2, 2009 11:27 AM
  • 738124
    738124 Member Posts: 10
    Dird,
    why u don't reply to my question?
    I'm studing not dumping!
    And I'm asking about the syntax of the to_char function, not about which is the solution of the test, that anyway is provided for free as a trial set of question for a approved test furnisher.
    Regards.
  • Dird
    Dird Member Posts: 1,225
    Hi,

    I thought you had already answered the question yourself (not combining the two) so didn't think I needed to reply.

    I see...which test provider?

    Mike
  • 738124
    738124 Member Posts: 10
    Mike,
    are you tring to maximize your intervents in the forum or what?
    Please see the answer here 3943258
This discussion has been closed.