少年阿賓

          那些青春的歲月

            BlogJava :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
            500 Posts :: 0 Stories :: 135 Comments :: 0 Trackbacks

          1、建立存儲(chǔ)過程
          create procedure pabin4()
          BEGIN
          declare status,id int;
          declare az,ax varchar(100) default '';
          declare mycur cursor for select * from abin5;
          declare continue handler for not found set status=1;
          open mycur;
           set status=0;
           loopLabel:LOOP

            fetch mycur into id,az;

            if status = 0 then
             if az is not null then
              set ax=CONCAT(az,'mycur');
             else
              set ax=CONCAT('mysql','mycur');
             end if;
             insert into abin5 values (id,ax);
            end if;

            if status = 1 then
             leave loopLabel;
            end if;

            end loop;
          close mycur;
          END

           

           

           2、測試語句

          call pabin4()
           

          posted on 2012-09-16 03:16 abin 閱讀(488) 評(píng)論(0)  編輯  收藏 所屬分類: mysql
          主站蜘蛛池模板: 宕昌县| 芒康县| 汪清县| 郓城县| 营口市| 定襄县| 七台河市| 无锡市| 都安| 师宗县| 青川县| 宁都县| 丰镇市| 通城县| 海门市| 麦盖提县| 财经| 钟山县| 太谷县| 华宁县| 循化| 乐陵市| 定州市| 尤溪县| 陇西县| 垦利县| 德庆县| 安龙县| 花莲市| 全椒县| 安化县| 阳春市| 苍梧县| 邵阳市| 浦北县| 徐州市| 阿坝县| 乐平市| 阿荣旗| 天峨县| 仙游县|