--列出各個部門中工資高於本部門的平均工資的員工數和部門號,並按部門號排序select * from emp e1,(select round(avg(sal),2) sal,deptno from emp group by deptno) e2 where e1.sal>e2.sal and e1.deptno=e2.deptno order by e1.deptno asc; 建立test表 --行轉列的測試create table test(id number
t_medflow 表擁有1千萬資料 FlowId是主鍵 擁有主鍵索引 統計總數量 select count(FLOWID) from t_medflow t 用時:1.5秒 select count(*) from t_medflow t 用時:1.46秒 多次測試效率差不多 添加條件查詢 select count(FLOWID) from t_medflow t where pname like '%中%' 用時:25
union/union all運算:將查詢的返回組合成一個結果, union all不過濾重複。 SELECT product_id FROM order_itemsUNIONSELECT product_id FROM inventories;SELECT location_id FROM locations UNION ALL SELECT location_id FROM departments; intersect運算:返回查詢結果中相同的部分。
在sqlplus中建立如下的內容:1、程式包 create or replace package types as type cursorType is ref cursor; end; / 程式包已建立。 2、函數create or replace function sp_ListEmp return types.cursortype as l_cursor types.cursorType; begin open l_cursor for select id, title
SQL> select count(*) from v$session #當前的串連數 SQL> Select count(*) from v$session where status='ACTIVE' #並發串連數 SQL> select value from v$parameter where name = 'processes' --資料庫允許的最大串連數 SQL> show parameter processes #最大串連 SQL>
Oracle查看trace 檔案步驟 1.獲得當前trace檔案產生路徑 SQL> select tracefile from v$process where addr in (select paddr from v$session where sid in (select sid from v$mystat)); TRACEFILE
J2EE應用中與Oracle資料庫的串連 作者:洪建 在J2EE應用程式開發中,應用程式與資料庫連接的建立是我們經常遇到的問題之一。在這裡我主要談談在本地應用程式中通過OCI方式、thin方式和JdbcOdbc橋方式串連Oracle資料庫,在iPlanet Application Server 6.5和Sun Java System Application Server 7中對Oracle資料庫連接池的配置以及應用中如何從串連池中獲得串連。