drop PROCEDURE IF EXISTS tt;
CREATE PROCEDURE tt(
para text,
OUT para1 DECIMAL(18, 6),
OUT para2 DECIMAL(18, 6)
)
BEGIN
    DECLARE Count int;
    DECLARE i int;

DECLARE v_id int;
    DECLARE v_insurance_amount DECIMAL(18, 6);
    DECLARE v_rate DECIMAL(18, 6);

SET i = 1;
    SET Count = ExtractValue(para, 'count(/list/com.xk.insalesystem.pojo.premiumCalculation.HouseholdPropertyAddtionalInsurance/id)');
    WHILE i <= Count DO
            SET v_id = ExtractValue(para, '/list/com.xk.insalesystem.pojo.premiumCalculation.HouseholdPropertyAddtionalInsurance[$i]/id');
            SET v_insurance_amount = ExtractValue(para, '/list/com.xk.insalesystem.pojo.premiumCalculation.HouseholdPropertyAddtionalInsurance[$i]/insurance_amount');
            SET v_rate = ExtractValue(para, '/list/com.xk.insalesystem.pojo.premiumCalculation.HouseholdPropertyAddtionalInsurance[$i]/rate');
            IF v_id = 1 THEN
                SET para1 = v_insurance_amount * v_rate;
            END IF;
            IF v_id = 2 THEN
                SET para2 = v_insurance_amount * v_rate;
            END IF;
        SET i = i + 1;
    END WHILE;
end;

call tt('<list>
  <com.xk.insalesystem.pojo.premiumCalculation.HouseholdPropertyAddtionalInsurance>
    <id>1</id>
    <insurance_amount>1000</insurance_amount>
    <rate>0.35</rate>
    <premium_amount>0.0</premium_amount>
  </com.xk.insalesystem.pojo.premiumCalculation.HouseholdPropertyAddtionalInsurance>
  <com.xk.insalesystem.pojo.premiumCalculation.HouseholdPropertyAddtionalInsurance>
    <id>2</id>
    <insurance_amount>300</insurance_amount>
    <rate>0.4</rate>
    <premium_amount>0.0</premium_amount>
  </com.xk.insalesystem.pojo.premiumCalculation.HouseholdPropertyAddtionalInsurance>
</list>', @a, @b);
SELECT @a, @b;

mysql xml 参数的更多相关文章

  1. C# 调用Mysql 带参数存储过程

    使用C#调用Mysql 带参数的存储过程: 1.创建带参数的存储过程:USP_Temp_Test 2.两个参数:IN 参数为 P_XML , OUT 参数为 P_ErrorOut 3.C#代码调用该存 ...

  2. shell编程系列23--shell操作数据库实战之mysql命令参数详解

    shell编程系列23--shell操作数据库实战之mysql命令参数详解 mysql命令参数详解 -u 用户名 -p 用户密码 -h 服务器ip地址 -D 连接的数据库 -N 不输出列信息 -B 使 ...

  3. CentOS 6.3下Zabbix监控MySQL数据库参数

    系统环境:CentOS 6.3 x64  http://www.linuxidc.com/Linux/2012-12/76583.htm mysql:    mysql-5.6.10 http://w ...

  4. 1201MySQL配置文件mysql.ini参数详解

    转自http://www.cnblogs.com/feichexia/archive/2012/11/27/mysqlconf.html my.ini(Linux系统下是my.cnf),当mysql服 ...

  5. (转)MySQL配置文件mysql.ini参数详解、MySQL性能优化

    本文转自:http://www.cr173.com/html/18331_1.html my.ini(Linux系统下是my.cnf),当mysql服务器启动时它会读取这个文件,设置相关的运行环境参数 ...

  6. MySQL配置文件mysql.ini参数详解、MySQL性能优化

    my.ini(Linux系统下是my.cnf),当mysql服务器启动时它会读取这个文件,设置相关的运行环境参数. my.ini分为两块:Client Section和Server Section.  ...

  7. MySQL配置文件mysql.ini参数详解

    my.ini(Linux系统下是my.cnf),当mysql服务器启动时它会读取这个文件,设置相关的运行环境参数. my.ini分为两块:Client Section和Server Section. ...

  8. 在Linux最大打开文件数限制下 MySQL 对参数的调整

    http://www.actionsky.com/docs/archives/78  2016年4月7日  周文雅 目录 1 起因 2 说明 3 MySQL调整参数的方式 3.1 计算 request ...

  9. skip-grant-tables:非常有用的mysql启动参数

    skip-grant-tables:非常有用的mysql启动参数   介绍一个非常有用的mysql启动参数—— --skip-grant-tables.顾名思义,就是在启动mysql时不启动grant ...

随机推荐

  1. Codevs 3728 联合权值

    问题描述 无向连通图G有n个点,n-1条边.点从1到n依次编号,编号为i的点的权值为Wi ,每 条边的长度均为1.图上两点(u,v)的距离定义为u点到v点的最短距离.对于图G上的点 对(u,v),若它 ...

  2. try{}、catch(){}、throw语句

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http ...

  3. Thinkphp 验证码

    一.生成验证码 $Verify = new \Think\Verify(); $Verify->entry(); 生成的验证码信息会保存到session中,里面包含数据有: array('ver ...

  4. Notification中使用Glide

    之前一直在琢磨Glide自定义使用中的一些经验:今天简单的分享下Notification中使用Glide去加载icon方法: 我们都知道使用android通知时,一般可能会有如下代码: Notific ...

  5. 项目组织与管理SPM(理论基础)

  6. 获取ip ,百度地图坐标点 和 在 后台调用 url()

        protected  void getip()         {             string ips = HttpContext.Current.Request.UserHostA ...

  7. Java 使用GDAL 读写 shapefile

    读取shp文件,并把它转化为json import org.gdal.ogr.*; import org.gdal.ogr.Driver; import org.gdal.gdal.*; public ...

  8. Python —基本数据类型

    运算符 1.算数运算: 2.比较运算: 3.赋值运算: 4.逻辑运算: 5.成员运算: 基本数据类型 1.数字 int(整型) 在32位机器上,整数的位数为32位,取值范围为-2**31-2**31- ...

  9. JSPatch打补丁

    http://www.cnblogs.com/dsxniubility/p/5080875.html http://www.jianshu.com/p/0cb81bf23d7a

  10. 无题 MVC

    1. MVC 里controller 返回匿名类型, 在View里是访问不了匿名类型的字段,因为它是Internal Private, 必须定义强类型 2. 扩展view的方法 public stat ...