GalaxyPilot —— D.S


                  生命不熄,戰斗不止
          數據加載中……

          ORACLE中使用動態游標的例子

          create or replace function get_ope_popedom(sta_id varchar2) return varchar2
            /*
             * NAME:
             *   get_ope_popedom
             *
             * PARAMETER:
             *   sta_id   - 車站編號,多個站時以逗號分隔
             *
             * RETURN:
             *   --對應車站編號的車站名稱,多個站時以逗號分隔
             *
             * AUTHOR:
             *   舵手
             *
             * DESCRIPTION:
             *   --根據傳入的車站編號返回相應的車站名稱
             *
             */
          as
          Result varchar2(1000);
          name_temp varchar2(40);
          type cursor_t is ref cursor;
          emp_cur cursor_t ;
          begin
            OPEN emp_cur FOR 'SELECT sta_name FROM station_code where sta_code =:1'
            using sta_id;
            LOOP
                FETCH emp_cur INTO name_temp;
                If (emp_cur%NOTFOUND) Then
                   EXIT;
                End if;
                Result := Result || name_temp || ',';
            end loop;
            close emp_cur;
            Result := substr(Result,1,(length(Result)-1));
            return(Result);
          end get_ope_popedom;
          /

          posted on 2006-03-14 11:02 舵手 閱讀(3588) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 金昌市| 尉犁县| 修水县| 孟州市| 济阳县| 四子王旗| 鹤庆县| 灌云县| 永川市| 临桂县| 闻喜县| 通江县| 贵阳市| 区。| 磴口县| 宣城市| 泰来县| 桐乡市| 饶阳县| 正定县| 蒙自县| 峡江县| 碌曲县| 皋兰县| 和平县| 寿光市| 张家口市| 远安县| 涞水县| 芷江| 无棣县| 昆山市| 定日县| 平阳县| 邵东县| 芦山县| 贞丰县| 兰州市| 临洮县| 玉门市| 察隅县|