Mysql ошибка 1630

Right. So I’ve created a stored procedure in a MySQL DB which happens to use SUBSTRING.

Running the procedure via a query gives me:

SQL Error 1630: Function mydatabase.SUBSTRING does not exist

Beg your pardon?

Rob's user avatar

Rob

27k16 gold badges82 silver badges98 bronze badges

asked Aug 17, 2010 at 22:04

Robin Rodricks's user avatar

Robin RodricksRobin Rodricks

111k141 gold badges400 silver badges607 bronze badges

4

Is there a space after the method call to Substring before the first parenthesis?

It appears on Line 40:

 IF i > 1 AND j > 1 AND (s1_char = SUBSTRING (s2, j - 1, 1))

i.e. Ensure

select substring(CustomerName, 1, 4) AS CustName from MyTable;

instead of:

select substring (CustomerName, 1, 4) AS CustName from MyTable;

answered Aug 17, 2010 at 22:12

p.campbell's user avatar

p.campbellp.campbell

98.8k67 gold badges257 silver badges322 bronze badges

2

Содержание

  1. MacLochlainns Weblog
  2. Placement over substance
  3. MacLochlainns Weblog
  4. Archive for the ‘SQL_MODE’ tag
  5. Placement over substance
  6. MySQL Server Error Codes and Messages 1600 — 1649
  7. MacLochlainns Weblog
  8. Archive for the ‘SUM function’ tag
  9. Placement over substance
  10. Русские Блоги
  11. [MySQL] При вызове хранимой процедуры отображается ОШИБКА 1305 (42000): PROCEDURE test.sp1 не существует
  12. Описание проблемы:
  13. Исправление проблем:
  14. Интеллектуальная рекомендация
  15. Реализация оценки приложения iOS
  16. JS функциональное программирование (е)
  17. PWN_JarvisOJ_Level1
  18. Установка и развертывание Kubernetes
  19. На стороне многопроцессорного сервера — (2) *

MacLochlainns Weblog

Michael McLaughlin’s Technical Blog

Placement over substance

I was stunned when a SQL query raised an ERROR 1630 (42000) telling me the SUM function didn’t exist in MySQL 5.5.23. The fix was simple. The opening parenthesis of the SUM function must be on the same line as the SUM keyword without an intervening white space. Alternatively phrased, you can’t have a line return or white space between the SUM function name and the opening parenthesis of the call parameter list. The same rule doesn’t apply to the opening parenthesis of the FORMAT function and it seems to me that this parsing inconsistency is problematic.

Therefore, my surprise, observation, and complaint is that all functions don’t parse the same way, using the same rules. That is, unless you use specialized SQL_MODE settings. This assumption was borne out by Kolbe Kegel’s comment on this post, and there are 30 remaining built in functions that have specialized parsing and resolution markers.

A simplified version of the code that raises the error follows. As you’ll notice the opening parenthesis for the FORMAT and SUM function have intervening white space and a line return.

SELECT t.transaction_account AS «Transaction» , LPAD(FORMAT (SUM (CASE WHEN EXTRACT(MONTH FROM transaction_date) = 1 AND EXTRACT(YEAR FROM transaction_date) = 2011 THEN CASE WHEN t.transaction_type = cl.common_lookup_type THEN t.transaction_amount ELSE t.transaction_amount * -1 END END),2),10,’ ‘) AS «JAN» FROM TRANSACTION t CROSS JOIN common_lookup cl WHERE cl.common_lookup_table = ‘TRANSACTION’ AND cl.common_lookup_column = ‘TRANSACTION_TYPE’ AND cl.common_lookup_type = ‘DEBIT’ GROUP BY t.transaction_account;

Based on the comments, the SQL_MODE is:

It raises the following error:

ERROR 1630 (42000): FUNCTION studentdb.SUM does not exist. Check the ‘Function Name Parsing and Resolution’ section in the Reference Manual

Moving ONLY the opening parenthesis to the end of the SUM keyword (or removing the line return and white space from between the SUM keyword and opening parenthesis) prevents the error but it would be more convenient if it supported both approaches. It seems odd that an intervening line return and white space for the SUM function raises an exception while the same intervening line return and white space doesn’t raise an exception for the FORMAT function. It strikes me the parser should support both or reject both. Here’s the fixed code that works without enabling the IGNORE_SPACE SQL Mode option.

SELECT t.transaction_account AS «Transaction» , LPAD(FORMAT (SUM( CASE WHEN EXTRACT(MONTH FROM transaction_date) = 1 AND EXTRACT(YEAR FROM transaction_date) = 2011 THEN CASE WHEN t.transaction_type = cl.common_lookup_type THEN t.transaction_amount ELSE t.transaction_amount * -1 END END),2),10,’ ‘) AS «JAN» FROM TRANSACTION t CROSS JOIN common_lookup cl WHERE cl.common_lookup_table = ‘TRANSACTION’ AND cl.common_lookup_column = ‘TRANSACTION_TYPE’ AND cl.common_lookup_type = ‘DEBIT’ GROUP BY t.transaction_account;

As noted by the comments, adding the IGNORE_SPACE to the SQL_MODE lets both queries work without moving the open parenthesis. You can do that in a session with the following syntax (which is covered in an older post):

SET SQL_MODE=(SELECT CONCAT(@@sql_mode,’,IGNORE_SPACE’));

Источник

MacLochlainns Weblog

Michael McLaughlin’s Technical Blog

Archive for the ‘SQL_MODE’ tag

Placement over substance

I was stunned when a SQL query raised an ERROR 1630 (42000) telling me the SUM function didn’t exist in MySQL 5.5.23. The fix was simple. The opening parenthesis of the SUM function must be on the same line as the SUM keyword without an intervening white space. Alternatively phrased, you can’t have a line return or white space between the SUM function name and the opening parenthesis of the call parameter list. The same rule doesn’t apply to the opening parenthesis of the FORMAT function and it seems to me that this parsing inconsistency is problematic.

Therefore, my surprise, observation, and complaint is that all functions don’t parse the same way, using the same rules. That is, unless you use specialized SQL_MODE settings. This assumption was borne out by Kolbe Kegel’s comment on this post, and there are 30 remaining built in functions that have specialized parsing and resolution markers.

A simplified version of the code that raises the error follows. As you’ll notice the opening parenthesis for the FORMAT and SUM function have intervening white space and a line return.

SELECT t.transaction_account AS «Transaction» , LPAD(FORMAT (SUM (CASE WHEN EXTRACT(MONTH FROM transaction_date) = 1 AND EXTRACT(YEAR FROM transaction_date) = 2011 THEN CASE WHEN t.transaction_type = cl.common_lookup_type THEN t.transaction_amount ELSE t.transaction_amount * -1 END END),2),10,’ ‘) AS «JAN» FROM TRANSACTION t CROSS JOIN common_lookup cl WHERE cl.common_lookup_table = ‘TRANSACTION’ AND cl.common_lookup_column = ‘TRANSACTION_TYPE’ AND cl.common_lookup_type = ‘DEBIT’ GROUP BY t.transaction_account;

Based on the comments, the SQL_MODE is:

It raises the following error:

ERROR 1630 (42000): FUNCTION studentdb.SUM does not exist. Check the ‘Function Name Parsing and Resolution’ section in the Reference Manual

Moving ONLY the opening parenthesis to the end of the SUM keyword (or removing the line return and white space from between the SUM keyword and opening parenthesis) prevents the error but it would be more convenient if it supported both approaches. It seems odd that an intervening line return and white space for the SUM function raises an exception while the same intervening line return and white space doesn’t raise an exception for the FORMAT function. It strikes me the parser should support both or reject both. Here’s the fixed code that works without enabling the IGNORE_SPACE SQL Mode option.

SELECT t.transaction_account AS «Transaction» , LPAD(FORMAT (SUM( CASE WHEN EXTRACT(MONTH FROM transaction_date) = 1 AND EXTRACT(YEAR FROM transaction_date) = 2011 THEN CASE WHEN t.transaction_type = cl.common_lookup_type THEN t.transaction_amount ELSE t.transaction_amount * -1 END END),2),10,’ ‘) AS «JAN» FROM TRANSACTION t CROSS JOIN common_lookup cl WHERE cl.common_lookup_table = ‘TRANSACTION’ AND cl.common_lookup_column = ‘TRANSACTION_TYPE’ AND cl.common_lookup_type = ‘DEBIT’ GROUP BY t.transaction_account;

As noted by the comments, adding the IGNORE_SPACE to the SQL_MODE lets both queries work without moving the open parenthesis. You can do that in a session with the following syntax (which is covered in an older post):

SET SQL_MODE=(SELECT CONCAT(@@sql_mode,’,IGNORE_SPACE’));

Источник

MySQL Server Error Codes and Messages 1600 — 1649

Message: Creation context of view `%s`.`%s’ is invalid

Message: Creation context of stored routine `%s`.`%s` is invalid

Message: Corrupted TRG file for table `%s`.`%s`

Message: Triggers for table `%s`.`%s` have no creation context

Message: Trigger creation context of table `%s`.`%s` is invalid

Message: Creation context of event `%s`.`%s` is invalid

Message: Cannot open table for trigger `%s`.`%s`

Message: Cannot create stored routine `%s`. Check warnings

Error: 1608 SQLSTATE: HY000 (ER_NEVER_USED)

Message: Ambiguous slave modes combination. %s

Message: The BINLOG statement of type `%s` was not preceded by a format description BINLOG statement.

Message: Corrupted replication event was detected

Message: Invalid column reference (%s) in LOAD DATA

Message: Being purged log %s was not found

Error: 1613 SQLSTATE: XA106 (ER_XA_RBTIMEOUT)

Message: XA_RBTIMEOUT: Transaction branch was rolled back: took too long

Error: 1614 SQLSTATE: XA102 (ER_XA_RBDEADLOCK)

Message: XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was detected

Error: 1615 SQLSTATE: HY000 (ER_NEED_REPREPARE)

Message: Prepared statement needs to be re-prepared

Message: DELAYED option not supported for table ‘%s’

Message: The master info structure does not exist

Message: option ignored

Message: Built-in plugins cannot be deleted

Error: 1620 SQLSTATE: HY000 (WARN_PLUGIN_BUSY)

Message: Plugin is busy and will be uninstalled on shutdown

Message: %s variable ‘%s’ is read-only. Use SET %s to assign the value

Message: Storage engine %s does not support rollback for this statement. Transaction rolled back and must be restarted

Message: Unexpected master’s heartbeat data: %s

Message: The requested value for the heartbeat period is either negative or exceeds the maximum allowed (%s seconds).

Message: Bad schema for mysql.ndb_replication table. Message: %s

Message: Error in parsing conflict function. Message: %s

Message: Write to exceptions table failed. Message: %s»

Message: Comment for table ‘%s’ is too long (max = %lu)

Message: Comment for field ‘%s’ is too long (max = %lu)

Message: FUNCTION %s does not exist. Check the ‘Function Name Parsing and Resolution’ section in the Reference Manual

Error: 1631 SQLSTATE: HY000 (ER_DATABASE_NAME)

Error: 1632 SQLSTATE: HY000 (ER_TABLE_NAME)

Error: 1633 SQLSTATE: HY000 (ER_PARTITION_NAME)

Error: 1635 SQLSTATE: HY000 (ER_TEMPORARY_NAME)

Error: 1636 SQLSTATE: HY000 (ER_RENAMED_NAME)

Message: Too many active concurrent transactions

Message: Non-ASCII separator arguments are not fully supported

Message: debug sync point wait timed out

Message: debug sync point hit limit reached

Error: 1641 SQLSTATE: 42000 (ER_DUP_SIGNAL_SET)

Message: Duplicate condition information item ‘%s’

Error: 1642 SQLSTATE: 01000 (ER_SIGNAL_WARN)

Message: Unhandled user-defined warning condition

Message: Unhandled user-defined not found condition

Message: Unhandled user-defined exception condition

Message: RESIGNAL when handler not active

Message: SIGNAL/RESIGNAL can only use a CONDITION defined with SQLSTATE

Message: Data truncated for condition item ‘%s’

Message: Data too long for condition item ‘%s’

Error: 1649 SQLSTATE: HY000 (ER_UNKNOWN_LOCALE)

Источник

MacLochlainns Weblog

Michael McLaughlin’s Technical Blog

Archive for the ‘SUM function’ tag

Placement over substance

I was stunned when a SQL query raised an ERROR 1630 (42000) telling me the SUM function didn’t exist in MySQL 5.5.23. The fix was simple. The opening parenthesis of the SUM function must be on the same line as the SUM keyword without an intervening white space. Alternatively phrased, you can’t have a line return or white space between the SUM function name and the opening parenthesis of the call parameter list. The same rule doesn’t apply to the opening parenthesis of the FORMAT function and it seems to me that this parsing inconsistency is problematic.

Therefore, my surprise, observation, and complaint is that all functions don’t parse the same way, using the same rules. That is, unless you use specialized SQL_MODE settings. This assumption was borne out by Kolbe Kegel’s comment on this post, and there are 30 remaining built in functions that have specialized parsing and resolution markers.

A simplified version of the code that raises the error follows. As you’ll notice the opening parenthesis for the FORMAT and SUM function have intervening white space and a line return.

SELECT t.transaction_account AS «Transaction» , LPAD(FORMAT (SUM (CASE WHEN EXTRACT(MONTH FROM transaction_date) = 1 AND EXTRACT(YEAR FROM transaction_date) = 2011 THEN CASE WHEN t.transaction_type = cl.common_lookup_type THEN t.transaction_amount ELSE t.transaction_amount * -1 END END),2),10,’ ‘) AS «JAN» FROM TRANSACTION t CROSS JOIN common_lookup cl WHERE cl.common_lookup_table = ‘TRANSACTION’ AND cl.common_lookup_column = ‘TRANSACTION_TYPE’ AND cl.common_lookup_type = ‘DEBIT’ GROUP BY t.transaction_account;

Based on the comments, the SQL_MODE is:

It raises the following error:

ERROR 1630 (42000): FUNCTION studentdb.SUM does not exist. Check the ‘Function Name Parsing and Resolution’ section in the Reference Manual

Moving ONLY the opening parenthesis to the end of the SUM keyword (or removing the line return and white space from between the SUM keyword and opening parenthesis) prevents the error but it would be more convenient if it supported both approaches. It seems odd that an intervening line return and white space for the SUM function raises an exception while the same intervening line return and white space doesn’t raise an exception for the FORMAT function. It strikes me the parser should support both or reject both. Here’s the fixed code that works without enabling the IGNORE_SPACE SQL Mode option.

SELECT t.transaction_account AS «Transaction» , LPAD(FORMAT (SUM( CASE WHEN EXTRACT(MONTH FROM transaction_date) = 1 AND EXTRACT(YEAR FROM transaction_date) = 2011 THEN CASE WHEN t.transaction_type = cl.common_lookup_type THEN t.transaction_amount ELSE t.transaction_amount * -1 END END),2),10,’ ‘) AS «JAN» FROM TRANSACTION t CROSS JOIN common_lookup cl WHERE cl.common_lookup_table = ‘TRANSACTION’ AND cl.common_lookup_column = ‘TRANSACTION_TYPE’ AND cl.common_lookup_type = ‘DEBIT’ GROUP BY t.transaction_account;

As noted by the comments, adding the IGNORE_SPACE to the SQL_MODE lets both queries work without moving the open parenthesis. You can do that in a session with the following syntax (which is covered in an older post):

SET SQL_MODE=(SELECT CONCAT(@@sql_mode,’,IGNORE_SPACE’));

Источник

Русские Блоги

[MySQL] При вызове хранимой процедуры отображается ОШИБКА 1305 (42000): PROCEDURE test.sp1 не существует

Описание проблемы:

1. Создайте простую хранимую процедуру запроса в MySQL:

2. Затем используйте CALL для вызова этой хранимой процедуры, и ошибка ОШИБКА 1305 (42000): PROCEDURE test.sp1 не существует:

Исправление проблем:

1. Сначала подумайте, действительно ли эта хранимая процедура отсутствует, проверьте текущую хранимую процедуру и убедитесь, что хранимая процедура существует:

2. В это время я думал, что у пользователя нет разрешения на вызов текущей хранимой процедуры, и разрешение хранимой процедуры было предоставлено текущему пользователю. В это время произошла другая ошибка:

Это обнаруживается путем запроса данных, которые необходимо обновить текущую хранимую процедуру перед выполнением оператора авторизации:

Выполните вызов этой хранимой процедуры еще раз, и отобразится успешный вызов:

Интеллектуальная рекомендация

Реализация оценки приложения iOS

Есть два способа получить оценку приложения: перейти в App Store для оценки и оценка в приложении. 1. Перейдите в App Store, чтобы оценить ps: appid можно запросить в iTunes Connect 2. Встроенная оцен.

JS функциональное программирование (е)

Давайте рассмотрим простой пример, чтобы проиллюстрировать, как используется Reduce. Первый параметр Reduce — это то, что мы принимаем массив arrayOfNums, а второй параметр — функцию. Эта функция прин.

PWN_JarvisOJ_Level1

Nc первый Затем мы смотрим на декомпиляцию ida Перед «Hello, World! N» есть уязвимая_функция, проверьте эту функцию после ввода Видно, что только что появившийся странный адрес является пе.

Установка и развертывание Kubernetes

На самом деле, я опубликовал статью в этом разделе давным -давно, но она не достаточно подробно, и уровень не является ясным. Когда я развернулся сегодня, я увидел его достаточно (хотя это было успешн.

На стороне многопроцессорного сервера — (2) *

Обработка сигнала Родительский процесс часто очень занят, поэтому вы не можете просто вызвать функцию waitpid, чтобы дождаться завершения дочернего процесса. Затем обсудите решение. Обратитесь .

Источник

Right. Таким образом, я создал хранимую процедуру в базе данных MySQL, которая использует SUBSTRING.

Выполнение процедуры с помощью запроса дает мне:

Ошибка SQL 1630: функция mydatabase.SUBSTRING не существует

Прошу прощения?

Robin Rodricks

Поделиться

Источник

1 ответ

Есть ли пробел после вызова метода на Substring перед первой скобкой?

Он отображается в строке 40:

 IF i > 1 AND j > 1 AND (s1_char = SUBSTRING (s2, j - 1, 1))

то есть. Убедитесь, что

select substring(CustomerName, 1, 4) AS CustName from MyTable;

вместо:

select substring (CustomerName, 1, 4) AS CustName from MyTable;

p.campbell

Поделиться

Ещё вопросы

  • 0Добавить фиктивные данные в mySql Result
  • 0JQuery UI панель / портлет плагин решение
  • 0session_start неисправность php
  • 1TFS Changeset несколькими пользователями
  • 1конвертировать timedelta чч: мм в секунды
  • 0-webkit-transform проблемы с производительностью в Chrome
  • 0Silex не будет загружать расширения Twig
  • 1Как получить токен на предъявителя из заголовка авторизации в Javascript (Angular2 / 4)?
  • 0Реализация jquery mmenu не видна в представлении вообще
  • 1документация sikuli 1.0.2 и ScreenRegion
  • 1Как настроить app.config для получения тестовых данных из файла Excel с помощью Nunit?
  • 0Javascript скрипты замедляются до нуля
  • 0Angularjs, как избежать специальных символов
  • 1PageSpeed app.js и app.css блокируют рендеринг
  • 1Плагин com.mysema.querydsl querydsl-apt не генерирует классы QueryDSL
  • 1Вектор Drawable внутри Layer-List растягивается
  • 1расчет тепловой карты панд на море
  • 1Загрузка файлов с помощью ExtJS и Jersey
  • 1c # wpf dispatcher.beginInvoke freeze
  • 0Перемещение нижнего колонтитула, которое исчезает, когда вы достигаете конца
  • 0Как настроить полосу прокрутки для отображения только в одном div
  • 1Как управлять видимостью контекстной вкладки ленты WPF 4.5 с помощью доступности определенного элемента управления в представлении Prism (+ MEF) с использованием MVVM?
  • 0Как я могу получить экранированный URL из результата parseJSON в jQuery?
  • 0MySql поиск диапазона дат с месяцем и днем (любой год)
  • 0Простой калькулятор HTML / JavaScript не работает?
  • 0Показать / скрыть div в DataList с помощью Jquery
  • 0Композитор не найден
  • 1Wikitude Передача значения из Java в JavaScript для использования в AR.RelativeLocation
  • 0Как выбрать в MySQL данные | xx | xx | xx |
  • 0windows.location.replace всегда перенаправлять, добавить IF
  • 1Назначение NaN -1 после выполнения StandardScaler
  • 1Проверка прошла успешно
  • 1Создать гиперссылку для доступа к нескольким листам Excel с помощью Python
  • 0Текстовые блоки над изображениями
  • 1hdf5storage.write () не сохраняет в указанный путь?
  • 1WPF Multi Select Combobox найти то, что выбрано
  • 1удаление текста контура круговой диаграммы
  • 0в GWT или GWTP, как экспортировать html-страницу, чтобы группа графического дизайна могла выполнять свою работу, не раскрывая им исходный код?
  • 0как я могу отобразить содержимое этой вкладки на основе события
  • 1Лучший способ создать этот класс Locus
  • 1Предложение xml linq orderby не работает так, как должно быть
  • 0Как я могу ограничить группировку и перетаскивание внутри TreeView Kendo UI
  • 1Кнопка не видна из-за DataGrid
  • 0Свойство AngularJS не связано с первым вызовом
  • 0Как передать объект в качестве параметра функции скрипта Java на onClick
  • 0Заставить AngularJS ui-router / app ждать данные $ http для предотвращения FOUC
  • 0Веб-браузер компилирует элементы CSS в алфавитном порядке
  • 1Сохранение файлового объекта с помощью matplotlib savefig, создание tar-файла из нескольких рисунков SVG
  • 0почему при использовании сервиса не отображается предупреждение?

Сообщество Overcoder

#
7 лет, 2 месяца назад

(отредактировано

7 лет, 2 месяца назад)

Темы:

23

Сообщения:

175

Участник с: 16 ноября 2013

Доброго дня!

Вопрос следующего характера:

MariaDB [metro]> select sum (holiday) from tabel_plane;
ERROR 1630 (42000): FUNCTION metro.sum does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
MariaDB [metro]> select sum (holiday) from metro.tabel_plane;
ERROR 1630 (42000): FUNCTION metro.sum does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
MariaDB [metro]>

Собственно, агрегатная фнкция sum () должна быть глобальной, насколько я понимаю… Или я чего-то не понимаю? Как её вызвать? Или как создать свою агрегатную функцию?

lampslave

#
7 лет, 2 месяца назад

Темы:

32

Сообщения:

4800

Участник с: 05 июля 2011

Функции чувствительны к регистру.

Anton8830

#
7 лет, 2 месяца назад

Темы:

23

Сообщения:

175

Участник с: 16 ноября 2013

lampslave
Функции чувствительны к регистру.

MariaDB [(none)]> select sum(holiday) from metro.tabel_plane;
+--------------+
| sum(holiday) |
+--------------+
|       160000 |
+--------------+
1 row in set (0.02 sec)

MariaDB [(none)]>

Anton8830

#
7 лет, 2 месяца назад

Темы:

23

Сообщения:

175

Участник с: 16 ноября 2013

К пробелам они тоже чувствительны… :-(

MariaDB [metro]> select sum(holiday) from tabel_plane;
+--------------+
| sum(holiday) |
+--------------+
|       160000 |
+--------------+
1 row in set (0.02 sec)

MariaDB [metro]> select sum (holiday) from tabel_plane;
ERROR 1630 (42000): FUNCTION metro.sum does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
MariaDB [metro]>

lampslave

#
7 лет, 2 месяца назад

Темы:

32

Сообщения:

4800

Участник с: 05 июля 2011

Хм, получается, про регистр я наврал :( Но общий смысл сохранятеся, надо как в доке писать, тогда проблем не будет.

Понравилась статья? Поделить с друзьями:
  • Mtp код ошибки 1
  • Mysql ошибка 504
  • Mysql ошибка 233
  • Mtk addr files ошибка x002
  • Mysql ошибка 18456