Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2010
    Posts
    8

    Unanswered: Postgres SQL to_number problem

    Hey There,

    I'm having a SQL to_number function problem.

    Select to_number(sum (case when e_section.certify_date is not null then 1 else 0 end )*100/count(*),99999.99) as prc

    prc
    -------
    0
    0
    0
    57
    72

    The answer suppose to coe like above. Somehow when I ran the select statement, it's indicating an error message: ERROR: function to_number(bigint, numeric) does not exist
    However I know e_section and certify_date columns exist.

    How do I arrange this function? Can anyone help me plz?

  2. #2
    Join Date
    Nov 2006
    Posts
    82
    If you check postgres manual you'll see that there is function
    to_number(text, text)
    (which accepts two strings)
    see here for more PostgreSQL: Documentation: Manuals: PostgreSQL 8.3: Data Type Formatting Functions

  3. #3
    Join Date
    Aug 2009
    Location
    Olympia, WA
    Posts
    337
    Are you sure you want to_number and not to_char ?

Posting Permissions

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