2

I have the following excel formula:

CEILING(F9*6763.85873627538/((F9-1)*400+6763.85873627538),1)

Where F9 is named PROJECTED_QUANTITY in my table sample_size_by_service_id

I have the following SQL query written out:

select
PROJECTED_QUANTITY, ceiling((PROJECTED_QUANTITY*6763.858736275380)/((PROJECTED_QUANTITY - 1)*400+6763.85873627538),1)
FROM sample_size_by_service_id

and I'm getting the following error message:

Error Code: 1582. Incorrect parameter count in the call to native function 'ceiling' 0.047 sec

Not sure what I'm doing wrong here - I'm a novice to SQL and my hours of googling have had me make sure that my PROJECTED_QUANTITY column is an INTEGER type (it is). I suspected that I am badly badgering the combined operators, but I'm not sure how else to write it.

Appreciate any insight! Thanks!

sqlnewb
  • 121
  • 1
  • 11
  • 1
    `ceiling` mysql function always returns integer, so it doesn't support the second parameter. – BrakNicku Mar 27 '15 at 16:49
  • Sorry, I don't understand. PROJECTED_QUANTITY is an integer. – sqlnewb Mar 27 '15 at 17:12
  • 1
    In Excel this function has 2 parameters: CEILING(number, significance). In your case the second parameter is 1 (result with one decimal place). In mysql it is: CEILING(number). There are no decimal places, the result is an integer. If you want to get 1 decimal place you should use: CEILING(number*10)/10 – BrakNicku Mar 27 '15 at 17:19
  • Thank you user3964075 - I took the second parameter out and I am achieving the expected results (exactly the same as I have in excel). THANK YOU!! – sqlnewb Mar 27 '15 at 18:05

1 Answers1

2

At the suggestion of user3964075, I removed the second parameter as the mysql syntax for CEILING is CEILING(number), not CEILING(number, significance) as it is in excel. Removing the second parameter resolved the issue - I am no longer getting error code 1582 and am achieving the desired results.

sqlnewb
  • 121
  • 1
  • 11