• <bdo id='yhuKw'></bdo><ul id='yhuKw'></ul>
    <tfoot id='yhuKw'></tfoot>

    <small id='yhuKw'></small><noframes id='yhuKw'>

    <i id='yhuKw'><tr id='yhuKw'><dt id='yhuKw'><q id='yhuKw'><span id='yhuKw'><b id='yhuKw'><form id='yhuKw'><ins id='yhuKw'></ins><ul id='yhuKw'></ul><sub id='yhuKw'></sub></form><legend id='yhuKw'></legend><bdo id='yhuKw'><pre id='yhuKw'><center id='yhuKw'></center></pre></bdo></b><th id='yhuKw'></th></span></q></dt></tr></i><div id='yhuKw'><tfoot id='yhuKw'></tfoot><dl id='yhuKw'><fieldset id='yhuKw'></fieldset></dl></div>

  • <legend id='yhuKw'><style id='yhuKw'><dir id='yhuKw'><q id='yhuKw'></q></dir></style></legend>

      1. MySQL CREATE FUNCTION 语法

        MySQL CREATE FUNCTION Syntax(MySQL CREATE FUNCTION 语法)
        • <tfoot id='uXrwb'></tfoot>
            <i id='uXrwb'><tr id='uXrwb'><dt id='uXrwb'><q id='uXrwb'><span id='uXrwb'><b id='uXrwb'><form id='uXrwb'><ins id='uXrwb'></ins><ul id='uXrwb'></ul><sub id='uXrwb'></sub></form><legend id='uXrwb'></legend><bdo id='uXrwb'><pre id='uXrwb'><center id='uXrwb'></center></pre></bdo></b><th id='uXrwb'></th></span></q></dt></tr></i><div id='uXrwb'><tfoot id='uXrwb'></tfoot><dl id='uXrwb'><fieldset id='uXrwb'></fieldset></dl></div>
              <legend id='uXrwb'><style id='uXrwb'><dir id='uXrwb'><q id='uXrwb'></q></dir></style></legend>
                <tbody id='uXrwb'></tbody>

                <bdo id='uXrwb'></bdo><ul id='uXrwb'></ul>

                1. <small id='uXrwb'></small><noframes id='uXrwb'>

                2. 本文介绍了MySQL CREATE FUNCTION 语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试在 MySQL 中创建一个函数:

                  I am trying to create a function in MySQL:

                  这里是SQL代码:

                  CREATE FUNCTION F_Dist3D (x1 decimal, y1 decimal) 
                  RETURNS decimal
                  DETERMINISTIC
                  BEGIN 
                   DECLARE dist decimal;
                   SET dist = SQRT(x1 - y1);
                   RETURN dist;
                  END;
                  

                  我收到以下错误:

                  #1064 - You have an error in your SQL syntax; 
                  check the manual that corresponds to your MySQL 
                  server version for the right syntax to use near '' at line 10
                  

                  我在 phpMyAdmin 中运行这个 create 语句.这个功能有什么问题?

                  I am running this create statement in phpMyAdmin. What is wrong with this function?

                  推荐答案

                  你必须用 $$ 之类的东西覆盖你的 ; 分隔符,以避免这种错误.

                  You have to override your ; delimiter with something like $$ to avoid this kind of error.

                  在函数定义之后,您可以将分隔符重新设置为 ;.

                  After your function definition, you can set the delimiter back to ;.

                  这应该有效:

                  DELIMITER $$
                  CREATE FUNCTION F_Dist3D (x1 decimal, y1 decimal) 
                  RETURNS decimal
                  DETERMINISTIC
                  BEGIN 
                    DECLARE dist decimal;
                    SET dist = SQRT(x1 - y1);
                    RETURN dist;
                  END$$
                  DELIMITER ;
                  

                  这篇关于MySQL CREATE FUNCTION 语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to delete duplicate records in mysql database?(如何删除mysql数据库中的重复记录?)
                  Python Pandas write to sql with NaN values(Python Pandas 使用 NaN 值写入 sql)
                  MySQL Insert amp; Joins(MySQL 插入 amp;加入)
                  MySQL concat() to create column names to be used in a query?(MySQL concat() 创建要在查询中使用的列名?)
                  NodeJS responded MySQL timezone is different when I fetch directly from MySQL(当我直接从 MySQL 获取时,NodeJS 响应 MySQL 时区不同)
                  WHERE datetime older than some time (eg. 15 minutes)(WHERE 日期时间早于某个时间(例如 15 分钟))

                  <i id='Kkzcs'><tr id='Kkzcs'><dt id='Kkzcs'><q id='Kkzcs'><span id='Kkzcs'><b id='Kkzcs'><form id='Kkzcs'><ins id='Kkzcs'></ins><ul id='Kkzcs'></ul><sub id='Kkzcs'></sub></form><legend id='Kkzcs'></legend><bdo id='Kkzcs'><pre id='Kkzcs'><center id='Kkzcs'></center></pre></bdo></b><th id='Kkzcs'></th></span></q></dt></tr></i><div id='Kkzcs'><tfoot id='Kkzcs'></tfoot><dl id='Kkzcs'><fieldset id='Kkzcs'></fieldset></dl></div>
                3. <legend id='Kkzcs'><style id='Kkzcs'><dir id='Kkzcs'><q id='Kkzcs'></q></dir></style></legend>
                    <tbody id='Kkzcs'></tbody>

                  <small id='Kkzcs'></small><noframes id='Kkzcs'>

                  <tfoot id='Kkzcs'></tfoot>
                      <bdo id='Kkzcs'></bdo><ul id='Kkzcs'></ul>