少年阿賓

          那些青春的歲月

            BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
            500 Posts :: 0 Stories :: 135 Comments :: 0 Trackbacks

          1、建立存儲過程
          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 閱讀(491) 評論(0)  編輯  收藏 所屬分類: mysql
          主站蜘蛛池模板: 厦门市| 邹城市| 镶黄旗| 三穗县| 兴海县| 灌阳县| 霍林郭勒市| 新巴尔虎右旗| 河间市| 清新县| 晴隆县| 出国| 明星| 阿拉尔市| 木里| 乌兰县| 西充县| 巩义市| 苍山县| 龙岩市| 石林| 剑阁县| 南城县| 饶阳县| 汉源县| 惠州市| 义乌市| 禄丰县| 南靖县| 吉隆县| 通榆县| 临高县| 兴安盟| 韶山市| 青河县| 永宁县| 永和县| 卢湾区| 信丰县| 赣州市| 福鼎市|