Syntax error or access violation: 1305 FUNCTION

397 Views Asked by At
SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION mysky.holidaycount does not exist (SQL: SELECT *,holidaycount(date_from,date_to) as totaldays FROM leaves where employee_id = 'SLT0001')

I have 3 tabs, add leave, view leave, and leave the list, 3 of them are not working suddenly, before years it was working fine now only one is not working, it shows the error holidaycount function does not exist.

error Facing -

SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION mysky.holidaycount does not exist (SQL: SELECT *,holidaycount(date_from,date_to) as totaldays FROM leaves where employee_id = 'SLT0001')
1

There are 1 best solutions below

0
Ramon Soarez On

Check if this function actually exists in the database in the mysql information_schema table:

SELECT ROUTINE_NAME
FROM information_schema.ROUTINES
WHERE ROUTINE_SCHEMA = 'mysky'
  AND ROUTINE_TYPE = 'FUNCTION'
  AND ROUTINE_NAME = 'holidaycount';

You can use an SQL query that makes use of the information_schema table. This table contains information about databases, tables, columns, routines (procedures and functions), etc.