Linux版本CentOS 6.3OS環境VMware Workstation9.0.0 build-812388oracle安裝檔案位置: G:\Program Files\Red Hat Enterprise Linux 4\Exchange Data\ORACLE\oracle-xe-10.2.0.1-1.0.i386.rpm1 Down Load RPM from following
eg: 相關解析:表t_pi_part 欄位 id code namevalue 1 222 avalue 2 222 bvalue 3 333 c給code相同的part code 添加行標,根據id 排序 select p.* ,row_number()over(partition by p.code order order by a.id desc) as row_index from t_pi_part
表結構create table U ( NAME CHAR(64) not null, ID INTEGER not null PRIMARY KEY)tablespace CICI;comment on table U is '使用者表'; create table GROU ( NAME CHAR(64) not null, ID INTEGER not null PRIMARY KEY)tablespace CICI;comment on table GROU is
exists (sql 返回結果集為真) notexists (sql 不返回結果集為真) 如下: 表A 表B 表A和表B是1對多的關係 A.ID => B.AID select a.id from A where exists (select a.id from b where a.id = b.aid); select a.id from Awhere not exists ( select a.id from b where a.id = b.aid
create or replace procedure P_CHANGE_FK_STATUS(IN_TABLE in varchar2,IN_TYPE IN VARCHAR2,IN_ACTION IN VARCHAR2) is--失效或者生效指定表的外鍵-- IN_table :表名-- IN_TYPE :必須為 R 代表外鍵-- IN_ACTION :DISABLE 或者 ENABLEV_TABLE VARCHAR2(30);V_ACTION VARCHAR2(10);V_SQL
create or replace package PAGEQUERY_PACK is -- Author : ADMINISTRATOR -- Created : 2013/1/13 15:47:30 -- Purpose : FEN YE CHA XUN -- Public type declarations TYPE CUR IS REF CURSOR; -- Public function and procedure declarations
重點關注9:用EXISTS替代IN.重點關注案例 :尋找DEPT_1部門的人員姓名9.1 SQL語句--子查詢select pname from t_person where deptid in ( select deptid from t_department where deptname like 'DEPT_1');--exsistselect pname from t_person where exists ( select * from
oracle認為 null 最大。升序排列,預設情況下,null值排後面。降序排序,預設情況下,null值排前面。有幾種辦法改變這種情況:(1)用 nvl 函數或decode 函數 將null轉換為一特定值(2)用case文法將null轉換為一特定值(oracle9i以後版本支援。和sqlserver類似):order by (case mycol when null then ’北京漂客’ else mycol end)(3)使用nulls first 或者nulls