错误代码 1582 Incorrect parameter count in the call to native f

Posted odejsjhshw

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了错误代码 1582 Incorrect parameter count in the call to native f相关的知识,希望对你有一定的参考价值。

1. 错误描述

1 queries executed, 0 success, 1 errors, 0 warnings

查询:SELECT t.`name`, DATE_FORMAT(str_to_date(‘2015‘), ‘%Y‘) as statisDate, ROUND(IFNULL(SUM(t.`amount`), 0), 3) AS ...

错误代码: 1582
Incorrect parameter count in the call to native function ‘str_to_date‘

执行耗时   : 0 sec
传送时间   : 0 sec
总耗时      : 0 sec
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

2. 错误原因

SELECT 
  t.`name`,
  DATE_FORMAT(STR_TO_DATE(‘2015‘), ‘%Y‘) AS statisDate,
  ROUND(IFNULL(SUM(t.`amount`), 0), 3) AS amount
FROM
  t_stu_info t 
WHERE 1 = 1 
  AND DATE_FORMAT(t.statisDate, ‘%Y‘) = ‘2015‘ 
UNION
ALL 
SELECT 
  t.`name`,
  DATE_FORMAT(STR_TO_DATE(‘2014‘), ‘%Y‘) AS statisDate,
  ROUND(IFNULL(SUM(t.`amount`), 0), 3) AS amount
FROM
  t_stu_info t 
WHERE 1 = 1 
  AND DATE_FORMAT(t.statisDate, ‘%Y‘) = ‘2014‘
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

mysql内置函数str_to_date的格式是:str_to_date(字符串,日期格式);
在这个查询SQL中却是str_to_date(字符串),导致报错

3. 解决办法

修改查询SQL语句

SELECT 
  t.`name`,
  DATE_FORMAT(STR_TO_DATE(‘2015‘,‘%Y‘), ‘%Y‘) AS statisDate,
  ROUND(IFNULL(SUM(t.`amount`), 0), 3) AS amount
FROM
  t_stu_info t 
WHERE 1 = 1 
  AND DATE_FORMAT(t.statisDate, ‘%Y‘) = ‘2015‘ 
UNION
ALL 
SELECT 
  t.`name`,
  DATE_FORMAT(STR_TO_DATE(‘2014‘,‘%Y‘), ‘%Y‘) AS statisDate,
  ROUND(IFNULL(SUM(t.`amount`), 0), 3) AS amount
FROM
  t_stu_info t 
WHERE 1 = 1 
  AND DATE_FORMAT(t.statisDate, ‘%Y‘) = ‘2014‘
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow


以上是关于错误代码 1582 Incorrect parameter count in the call to native f的主要内容,如果未能解决你的问题,请参考以下文章

浏览器中的“代码:Messaging / Incorrect-GCM-sender-id”错误消息

错误代码 1366 Incorrect integer value 'zhangsan' for column 'd

vsftpd的530 Login incorrect错误解决方法 vsftpd登录错误

从idea push代码到gitee,报如下错误:Incorrect username or password (access token)

Forbidden (CSRF token missing or incorrect.):错误解决办法

mysql错误(Incorrect key file for table)