mysql自定义函数与过程中写法的注意事项
BEGIN
#Routine body goes here...
/*
update szzx_goods_common set gc_id=i where gc_name=(SELECT gc_name from szzx_goods_class where gc_id=i);
*/
DECLARE i,goodsid int(11);
declare goodsname,img varCHAR(200);
set i=104;
WHILE i<1815 do
SELECT image_url,goods_id into img,goodsid from goods_image where image_id=i;
#SELECT goods_id into goodsid from ecm_goods_image where imgage_id=i;
SELECT goods_name into goodsname from ecm_goods where goods_id=goodsid;
select goods_id into goodsid from szzx_goods where goods_name=goodsname;
INSERT into szzx_goods_images(goods_commonid,store_id,goods_image,goods_image_sort)VALUES(goodsid,1,img,1);
set i=i+1; End WHILE;
RETURN 0;
ENd
1、在使用使用变量时先定义变量后最下面再赋值。多个变量类型一致,可以用 declare 变量名1,变量名2这样的格式。
2、在函数或过程中用select 语句给变量赋值时,格式应为:select 字段1,字段2 into 变量1,变量2 from 表名 格式
mysql自定义函数与过程中写法的注意事项的更多相关文章
- mysql自定义函数并在存储过程中调用,生成一千万条数据
mysql 自定义函数,生成 n 个字符长度的随机字符串 -- sql function delimiter $$ create function rand_str(n int) returns VA ...
- MySQL自定义函数(四十六)
MySQL自定义函数 一.什么是MYSQL自定义函数? mysql当中的自定义函数,我们简称为UDF,它实际上是一种对MySQL扩展的途径,其用法与内置函数相同. 二.自定义函数应该具备哪些条件? 我 ...
- mysql 自定义函数
原文:http://www.cnblogs.com/zhangminghui/p/4113160.html 引言 MySQL本身提供了内置函数,这些函数的存在给我们日常的开发和数据操作带来了很大的便利 ...
- MySQL 自定义函数CREATE FUNCTION实例
分享一个MySQL 自定义函数CREATE FUNCTION的实例.mysql> delimiter $$mysql> CREATE FUNCTION myFunction-> (i ...
- MySQL自定义函数与存储过程
1.前置条件 MySQL数据库中存在表user_info,其结构和数据如下: mysql> desc user_info; +-----------+----------+------+---- ...
- MySql创建函数与过程,触发器, shell脚本与sql的相互调用。
一:函数 1:创建数据库和表deptartment, mysql> use DBSC; Database changed mysql), ), )); Query OK, rows affect ...
- mysql自定义函数语法
创建函数 DELIMITER $$DROP FUNCTION IF EXISTS `test` $$CREATE FUNCTION `test`(a int ,b int)RETURNS int BE ...
- java mysql自定义函数UDF之调用c函数
正如sqlite可以定义自定义函数,它是通过API定义c函数的,不像其他,如这里的mysql.sqlite提供原生接口就可以方便的调用其他语言的方法,同样的mysql也支持调用其它语言的方法. goo ...
- MySQL自定义函数
用户自定义函数(user-defined function,UDF)是一种对MySQL扩展的途径,其用法与内置函数相同. 自定义函数两个必要条件: 参数:可以有另个或多个 返回值:只能有一个 创建自定 ...
随机推荐
- 《Linux内核分析》第八周笔记 进程的切换和系统的一般执行过程
20135132陈雨鑫 + 原创作品转载请注明出处 + <Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 ...
- Practice2 结对子之“小学四则运算”
开发环境:Eclipse,js,css,html 程序完成的方向: 1.可以出表达式里含有负整数(负整数最小不小于-100)的题目,且负数需要带括号,用户输入的结果不用带括号.如: 2*(-4) = ...
- github更新,发布地址,燃尽图,总结
github地址:https://github.com/Lingchaoyang 网盘发布地址:http://pan.baidu.com/s/1qXgHiyC 燃尽图: 团队得分(100分制): 杨灵 ...
- DrangonBorns
团队介绍 团队名称:DrangonBorns(龙裔) 团队博客:http://www.cnblogs.com/DragonBorns/ 团队队长:蒲建国 队长博客链接:htt ...
- Kitematic when login show Error:Tunning socket could not be established
https://cn.bing.com/search?q=tunning+socket+could+not+be+established&qs=n&form=QBRE&sp=- ...
- React onWheel
<!DOCTYPE html><html><head lang="en"> <meta charset="UTF-8" ...
- Angular require(抄别的)
require参数的值可以用下面的前缀进行修饰,这会改变查找控制器时的行为:?如果在当前指令中没有找到所需要的控制器,会将null作为传给link函数的第四个参数.^如果添加了^前缀,指令会在上游的指 ...
- 微信小程序入門學習資料鏈接
https://blog.csdn.net/github_38847071/article/details/73250258 https://blog.csdn.net/lily2016n/artic ...
- appium学习记录1
xpath定位: 语法 driver.find_element_by_xpath("//android.widget.EditText[@index="登陆"/../pr ...
- codeforces 793B. Igor and his way to work
B. Igor and his way to work time limit per test 3 seconds memory limit per test 256 megabytes input ...