標籤:-- refer: -- http://www.cnblogs.com/gnielee/archive/2009/09/09/1563154.html-- http://www.cnblogs.com/yudy/archive/2012/07/18/2597874.htmlCREATE OR REPLACE TYPE ty_str_split IS TABLE OF VARCHAR2 (4000);CREATE OR REPLACE FUNCTION splitstr(p_string
標籤:功能介紹:首先是進行無欄位的彙總,然後依次對每個欄位進行彙總 建立表: View Code 插入測試資料: View Code ROLLUP:Select t.classid,t.studentname,Sum(t.score) From Score t Group By Rollup(t.classid,t.studentname); 查詢結果: Cube:Select
標籤:sql訂單表,與訂單資訊表(多個訂單資訊列有同一個訂單id)查出所有訂單以及其資訊並按照訂單分頁select * from(select a. * , (DENSE_RANK() OVER(ORDER BY id DESC)) AS numindex from(SELECT o. * , DENSE_RANK() OVER(ORDER BY o.id DESC) AS rn from order o) a where rn <= 10) where numindex >
標籤:分析: 首先要存在一個數群組類型,然後才能去定義陣列變數,所以編寫PL/SQL如下:declare --定義一個數群組類型 type a_type is table of number; a a_type := a_type();begin a.extend(3); a(1) := 1; a(2) := 2; a(3) := 3; for cou in 1 .. a.count loop
標籤: 在Oracle中,having一定要結合group by使用,但在mysql中,情況就不一樣了。能夠單獨使用。C:\Documents and Settings\guogang>sqlplus test/testSQL*Plus: Release 10.2.0.1.0 - Production on 星期二 8月 12 09:09:58 2014Copyright (c) 1982, 2005, Oracle. All rights