BEGIN
DECLARE i INT default 0;
DECLARE num int default 0;
DECLARE count1 int default 0;
DECLARE count2 int default 0;
DECLARE headerid varchar(50);
DECLARE warehouse varchar(50);
SELECT @num:=COUNT(*) FROM config_header WHERE recordType='EDI_URL';
DELETE FROM config_detail where recordType='EDI_URL';
WHILE i < @num DO
select @headerid:=id,@warehouse:=warehouseCode from config_header WHERE recordType='EDI_URL' limit i,1;
INSERT INTO config_detail(headerId,recordType,identifier,warehouseCode,description,value1,value2,value3) VALUES(@headerid,'EDI_URL','CSM',@warehouse,'EDI-CSM','http://ip:prot/','http://ip:prot/','http://ip:prot/');
INSERT INTO config_detail(headerId,recordType,identifier,warehouseCode,description,value1,value2,value3) VALUES(@headerid,'EDI_URL','CRM',@warehouse,'EDI-CRM','http://ip:prot/','http://ip:prot/','http://ip:prot/');
INSERT INTO config_detail(headerId,recordType,identifier,warehouseCode,description,value1,value2,value3) VALUES(@headerid,'EDI_URL','MDM',@warehouse,'EDI-MDM','http://ip:prot/','http://ip:prot/','http://ip:prot/');
INSERT INTO config_detail(headerId,recordType,identifier,warehouseCode,description,value1,value2,value3) VALUES(@headerid,'EDI_URL','SAPPI',@warehouse,'EDI-SAPPI','http://ip:prot/','http://ip:prot/','http://ip:prot/');
INSERT INTO config_detail(headerId,recordType,identifier,warehouseCode,description,value1,value2,value3) VALUES(@headerid,'EDI_URL','DCO2C',@warehouse,'EDI-DCO2C','http://ip:prot/','http://ip:prot/','http://ip:prot/');
INSERT INTO config_detail(headerId,recordType,identifier,warehouseCode,description,value1,value2,value3) VALUES(@headerid,'EDI_URL','CEM',@warehouse,'EDI-CEM','http://ip:prot/','http://ip:prot/','http://ip:prot/');
INSERT INTO config_detail(headerId,recordType,identifier,warehouseCode,description,value1,value2,value3) VALUES(@headerid,'EDI_URL','SRM',@warehouse,'EDI-SRM','http://ip:prot/','http://ip:prot/','http://ip:prot/');
SET i = i + 1 ;
SELECT @headerid headerids;
END WHILE ;
END

navicat 给mysql 添加存储过程(函数)的更多相关文章

  1. MySQL存储过程中的3种循环,存储过程的基本语法,ORACLE与MYSQL的存储过程/函数的使用区别,退出存储过程方法

    在MySQL存储过程的语句中有三个标准的循环方式:WHILE循环,LOOP循环以及REPEAT循环.还有一种非标准的循环方式:GOTO,不过这种循环方式最好别用,很容易引起程序的混乱,在这里就不错具体 ...

  2. mysql使用存储过程&函数实现批量插入

    写这边文章的目的,是想结合mysql 存储过程+函数完成一个批量删除的功能吧...正好也好加深下对procedure和function的熟练操作吧...废话不多说,我就直接上表结构啦哈,如下: cre ...

  3. MySQL创建存储过程/函数需要的权限

    alter routine---修改与删除存储过程/函数 create routine--创建存储过程/函数 execute--调用存储过程/函数 下面有一篇介绍MySQL所有权限的博文 http:/ ...

  4. mysql查看存储过程函数

    查询数据库中的存储过程和函数 select `name` from mysql.proc where db = 'xx' and `type` = 'PROCEDURE'   //存储过程       ...

  5. mysql 事务 存储过程 函数

    一:事务: 开启一个事务可以包含一些SQL语句,这些sql语句要么同时成功, 要么一个都别想成功, 称之我事务的原子性 事务用于将某些操作的多个SQL 作为原子性操作, 一旦有某一个出现错误, 即可以 ...

  6. 利用navicat写mysql的存储过程

    最近项目经理让我给新的活动的预留一个插入红包和查看详情的sql,方便在项目出问题的做一些紧急操作,我想了下这里面还涉及到挺多逻辑和挺多表的一句句查也不方便啊,干脆写到存储过程里,于是开始在navica ...

  7. Mysql语法:navicat for mysql 添加注释

    在 navicat 中有三种注释的书写方式: 以 # 开头的字符串,可以多个 # 连续以 – 开头的字符串,注意:只能是 – ,而且 – 后面需要加一个半角空格以 /* */ 包围的字符串,类似于 J ...

  8. rds - mysql修改存储过程/函数的方式

    rds 不支持账户A 给账户B 创建授权存储过程,只能是当前登录账户给自己创建,要登陆对应账户删除原有存储过程重新创建即为修改. 例子如下: 先登陆新账号然后执行如下sql语句即可: DROP PRO ...

  9. 使用Navicat for MySQL添加外键约束

    转载:http://blog.csdn.net/u013215018/article/details/54981216 现在有两个表一张是Roles表(角色表),一张是RoleUser表(用户角色) ...

随机推荐

  1. CodeForces - 1201B Zero Array

    You are given an array a1,a2,-,ana1,a2,-,an. In one operation you can choose two elements aiai and a ...

  2. 大数据开发-Spark-初识Spark-Graph && 快速入门

    1.Spark Graph简介 GraphX 是 Spark 一个组件,专门用来表示图以及进行图的并行计算.GraphX 通过重新定义了图的抽象概念来拓展了 RDD: 定向多图,其属性附加到每个顶点和 ...

  3. Linux-关于Bash

    目录 关于Bash Bash是什么? Bash的一些特性 关于Bash Bash是什么? Bash是一个命令处理器,通常运行于文本窗口中,并能执行用户直接输入的命令. Bash还能从文件中读取命令,这 ...

  4. WOJ1022 Competition of Programming 贪心 WOJ1023 Division dp

    title: WOJ1022 Competition of Programming 贪心 date: 2020-03-19 13:43:00 categories: acm tags: [acm,wo ...

  5. l2-002 链表去重 (未解决)

    L2-002. 链表去重 时间限制 300 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 给定一个带整数键值的单链表L,本题要求你编写程序,删除 ...

  6. Git使用出现Automatic merge failed; fix conflicts and then commit the result.解决方法

    产生原因 首先这个问题产生的原因是因为你git pull 的时候会分为两步,第一步先从远程服务器上拉下代码,第二步进行merge,但是merge时候失败了就会产生上述问题. 解决方法: 丢弃本地提交, ...

  7. git branch All In One

    git branch All In One Git Branch Management https://git-scm.com/book/en/v2/Git-Branching-Branch-Mana ...

  8. React 17 All In One

    React 17 All In One v17.0.1 https://reactjs.org/blog/2020/10/20/react-v17.html https://reactjs.org/b ...

  9. React components render order All In One

    React components render order All In One components render order / components lifecycle DOM tree ren ...

  10. react hooks useEffect 取消 promise

    react hooks useEffect 取消 promise cancel promise https://github.com/facebook/react/issues/15006#issue ...