oracle 自定義 聚合函數

Oracle自定義聚合函數實現字符串連接的聚合

create or replace type string_sum_obj as object (?
--聚合函數的實質就是一個對象?
???? sum_string varchar2(4000),?
???? static function ODCIAggregateInitialize(v_self in out string_sum_obj) return number,?
???? --對象初始化?
???? member function ODCIAggregateIterate(self in out string_sum_obj, value in varchar2) return number,?
???? --聚合函數的迭代方法(這是最重要的方法)?
???? member function ODCIAggregateMerge(self in out string_sum_obj, v_next in string_sum_obj) return number,?
???? --當查詢語句并行運行時,才會使用該方法,可將多個并行運行的查詢結果聚合?
??????
???? member function ODCIAggregateTerminate(self in string_sum_obj, return_value out varchar2 ,v_flags in number) return number?
???? --終止聚集函數的處理,返回聚集函數處理的結果.?
)?
/?
create or replace type body string_sum_obj is?
???? static function ODCIAggregateInitialize(v_self in out string_sum_obj) return number is?
???? begin?
???????? v_self := string_sum_obj(null);?
???????? return ODCICONST.Success;?
???? end;?
???? member function ODCIAggregateIterate(self in out string_sum_obj, value in varchar2) return number is?
???? begin?
????????? /* 連接 */????
????????? self.sum_string := self.sum_string || value;?
????????? return ODCICONST.Success;?
????????? /* 最大值 */?
????????? if self.sum_string<value then?
????????????? self.sum_string:=value;?
????????? end if;?
????????? /* 最小值 */?
????????? if self.sum_string>value then?
?????? self.sum_string:=value;???????????
????????? end if;?
???????????
????????? return ODCICONST.Success;?
???? end;?
???? member function ODCIAggregateMerge(self in out string_sum_obj, v_next in string_sum_obj) return number is?
???? begin?
????????? /* 連接 */????
????????? self.sum_string := self.sum_string || v_next.sum_string;?
????????? return ODCICONST.Success;?
????????? /* 最大值 */?
????????? if self.sum_string<v_next.sum_string then?
????????????? self.sum_string:=v_next.sum_string;?
????????? end if;?

????????? /* 最小值 */?
????????? if self.sum_string>v_next.sum_string then?
????????????? self.sum_string:=v_next.sum_string;???????????
????????? end if;?
???????????
????????? return ODCICONST.Success;?
???? end;?
???? member function ODCIAggregateTerminate(self in string_sum_obj, return_value out varchar2 ,v_flags in number) return number is?
???? begin?
????????? return_value:= self.sum_string;?
????????? return ODCICONST.Success;?
???? end;?
end;?
/?
create or replace function ConnStrSum(value Varchar2) return Varchar2?
???? parallel_enable aggregate using string_sum_obj;

轉載于:https://www.cnblogs.com/tiandi/p/4821695.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/247296.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/247296.shtml
英文地址,請注明出處:http://en.pswp.cn/news/247296.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Vue3里的setup中使用vuex

useStore 這里我們可以直接從vuex 4.X中解構出useStore方法&#xff0c;就可以在setup中使用vuex的相關函數 template 使用$store <template><div><h2>{{ $store.state.count }}</h2><button click"increaseCount">點擊</button…

JQ 取CHECKBOX選中項值

備忘錄 $("[namecheckbox]:checked").each(function(){ alert((this).val()); }) ;轉載于:https://www.cnblogs.com/showblog/archive/2010/09/13/1825099.html

vue3 echarts5 graph關系圖譜 點擊圖例節點消失線不消失重復生成問題

const myChart ref(null);const myCharts ref(null);onMounted(() > {// 這種會導致線仍然存在 重復生成myCharts.value echarts.init(myChart.value);myCharts.value.setOption(option);});return {myChart,myCharts,}; 現象&#xff1a;如下圖1 點擊圖例類目2&#xf…

非常完整的coco screator socketio

https://github.com/SeaPlanet/cocoscreator_chat 前端源碼 https://github.com/socketio/socket.io-client https://cdnjs.com/libraries/socket.io 轉載于:https://www.cnblogs.com/suneil/p/11288628.html

JavaScript 中 obj.hasOwnProperty(prop) 方法

語法 obj.hasOwnProperty(prop) 參數 prop 要檢測的屬性的 String 字符串形式表示的名稱&#xff0c;或者 Symbol。 返回值 用來判斷某個對象是否含有指定的屬性的布爾值 Boolean。 描述 所有繼承了 Object 的對象都會繼承到 hasOwnProperty 方法。這個方法可以用來檢測…

python面向對象初識

面向對象編程 1.面向對象初步了解 ? 面向過程編程與函數編程對比&#xff1a; s1 ajdsgkaffddha count 0 for i in s1:count 1 print(f字符串的長度為{count}) # 面向過程編程每計算一次便使用一次for循環def my_len(s): # 計算數據類型長度的函數&#xff0c;可重復使用…

Vue3 VSCode新建項目報錯The template root requires exactly one element.

1.首先我們點擊左側第四個圖標插件2.輸入框搜索vetur插件3.點擊設置圖標&#xff0c;再點擊擴展設置4.搜素vetur>validation>template&#xff0c;取消vetur>validation>template的勾選 然后就不會報錯了

計算機視覺概述

關于計算機視覺的介紹性文章&#xff0c;包括計算機視覺的定義&#xff0c;和人類視覺的區別以及涉及到的學科等等。 1. 什么是計算機視覺 計算機視覺既是工程領域&#xff0c;也是科學領域中的一個富有挑戰性重要研究領域。計算機視覺是一門綜合性的學科&#xff0c;它已經吸引…

Java生鮮電商平臺-電商支付流程架構實戰

Java生鮮電商平臺-電商支付流程架構實戰 說明&#xff1a;我一直秉承的就是接地氣的業務架構實戰。我的文章都有一個這樣的核心。 1. 業務場景 2. 解決問題。 3.代碼實現。 4.代碼重構。 5.總結與復盤。 6.缺點與防范 一、場景描述 想必大家都曾遇到過這個問題&#xff0c;在電…

vue3.0 AntDesignVue2.0 table的rowkey報錯問題解決方法

Warning: [antdv: Each record in table should have a unique key prop,or set rowKey to an unique primary key.] Warning: [antdv: Table] Each record in dataSource of table should have a unique key prop, or set rowKey of Table to an unique primary key 提示因為…

模式識別掃盲

模式識別是對表征事物或現象的各種形式的信息進行處理和分析&#xff0c;以對事物或現象進行描述、辨認、分類和解釋的過程&#xff0c;是信息科學和人工智能的重要組成部分。英文“Pattern”源于法文“Patron”&#xff0c;本來是指可作為大家典范的理想的人&#xff0c;或用以…

vue2項目使用codemirror插件實現代碼編輯器功能

1、使用npm安裝依賴 npm install --save codemirror 2、在頁面中放入如下代碼 <template><textarea ref"mycode" class"codesql" v-model"code" style"height:200px;width:600px;"></textarea> </template>…

CentOS 6.5系統安裝配置LAMP(Apache+PHP5+MySQL)服務器環境

安裝篇&#xff1a; 一、安裝Apache yum install httpd #根據提示&#xff0c;輸入Y安裝即可成功安裝 /etc/init.d/httpd start#啟動Apache 備注&#xff1a;Apache啟動之后會提示錯誤&#xff1a; 正在啟動 httpd:httpd: Could not reliably determine the servers fully qual…

前端有用的庫

HTML awesome-html5 精選的HTML5資源精選清單 CSS tailwindcss 與Tailwind CSS相關的很棒的事情awesome-css-frameworks 很棒的CSS框架列表awesome-css-cn CSS 資源大全中文版&#xff0c;內容包括&#xff1a;CSS預處理器、框架、CSS結構、代碼風格指南、命名習慣等等awesom…

計算機視覺牛人(轉載)(最早在自動化所論壇上發現的)

paper畢竟是死的, 寫paper的人才是活的. 那么我現在研究一下cv圈的格局, 按師承關系, 借鑒前人, 我總結a tree stucture of cv guys.David Marr----->Shimon Ullman (Weizmann) ----->Eric Grimson (MIT)----->Daniel Huttenlocher (Cornell)----->Pedro Felzenszw…

Java生鮮電商平臺-促銷系統的架構設計與源碼解析

Java生鮮電商平臺-促銷系統的架構設計與源碼解析 說明&#xff1a;本文重點講解現在流行的促銷方案以及源碼解析,讓大家對促銷&#xff0c;納新有一個深入的了解與學習過程. 促銷系統是電商系統另外一個比較大&#xff0c;也是比較復雜的系統&#xff0c;作為一個賣貨的&#x…

vue3中websocket用法

1.0 認識 websocket #1.0.1 什么是 websocket 和 http 協議類似&#xff0c;websocket 也是是一個網絡通信協議&#xff0c;是用來滿足前后端數據通信的。 #1.0.2 websocket 相比于 HTTP 的優勢 HTTP 協議&#xff1a;客戶端與服務器建立通信連接之后&#xff0c;服務器端只…

介紹幾個醫學圖像處理會議

Information Processing in Medical Imaging &#xff0c; IPMI &#xff0c;醫學圖像處理最頂級的會議&#xff0c;兩年召開一次&#xff0c;全球大概入選 50 篇左右&#xff0c;一個非常小圈子的會&#xff0c;據說通常是關在一個偏僻的地方開一周&#xff0c;會議口頭報告提…

python翻譯

translator.py # -*- coding: utf-8 -*- # author: inspurer(月小水長) # pc_type lenovo # create_time: 2019/4/6 15:44 # file_name: translator.py # github https://github.com/inspurer # qq郵箱 2391527690qq.co…

promise并發

一、Pomise.all的使用 Promise.all可以將多個Promise實例包裝成一個新的Promise實例。同時&#xff0c;成功和失敗的返回值是不同的&#xff0c;成功的時候返回的是一個結果數組&#xff0c;而失敗的時候則返回最先被reject失敗狀態的值。 let p1 new Promise((resolve, rej…