zoukankan      html  css  js  c++  java
  • DB2 存储过程应用(返回值和输出参数应用)


    我弄了小半天才弄出来,希望对有需要的朋友有所帮助和提示。欢迎光临如转载请说明出处。
    DROP SPECIFIC PROCEDURE DB2INST1.SQL121129100123456;

    #SYNC 10;

    SET SCHEMA TYCOON_SP;

    SET CURRENT PATH = "SYSIBM","SYSFUN","SYSPROC","NORTHTYCOON";

    CREATE PROCEDURE DB2INST1.SP_UP_P_INV_WASTE
     (IN "IN_CREATE_WHEN" DATE,
      IN "IN_NAME" CHARACTER(20),
      IN "IN_SCHOOL" SMALLINT,
      IN "IN_TIME" TIMESTAMP,
      IN "IN_ID" INTEGER,
      OUT "OUT_NUM" INTEGER
     )
      SPECIFIC DB2INST1.SQL121129100123456
      LANGUAGE SQL
      NOT DETERMINISTIC
      CALLED ON NULL INPUT
      EXTERNAL ACTION
      OLD SAVEPOINT LEVEL
      MODIFIES SQL DATA
      INHERIT SPECIAL REGISTERS
      P1: BEGIN
    --DECLARE RESULTCOUNT CURSOR WITH RETURN FOR
     DECLARE NUM INTEGER;
     DECLARE OUT_COUNT INTEGER;
     
         SET OUT_COUNT = 0;
         SET NUM=(SELECT COUNT(1)  from(
                    SELECT * FROM TABLE_CHOOL
     ) as TB);
    --OPEN RESULTCOUNT;

    IF (0 = NUM) THEN
       P2: BEGIN
          SET OUT_COUNT = 1;
          UPDATE TABLE_CHOOL
          SET CREATE_WHEN = IN_CREATE_WHEN,NAME =IN_NAME,SCHOOL=IN_SCHOOL,TIME=IN_TIME,
          WHERE ID=IN_ID;
       END P2;
    ELSEIF (1<= NUM) THEN
        SET OUT_COUNT = 999;
    END IF;
        SET OUT_NUM = OUT_COUNT;
    RETURN OUT_NUM;


    END P1;

    #SYNC 20;

  • 相关阅读:
    Mac快捷键符号解释及用法介绍
    Mac使用小技巧:Fn键的妙用技巧
    Mac快捷键大全
    idea 开发SpringBoot项目并打包docker镜像部署到节点上
    .netcore linux开机自启脚本
    javascript Event Loop
    mysql函数使用技巧
    MySql查找慢查询sql
    js优先队列和链表
    mysql性能优化
  • 原文地址:https://www.cnblogs.com/northeastTycoon/p/2794662.html
Copyright © 2011-2022 走看看