標籤:序列,觸發器等相關的使用微軟下的Sqlserver實現增長只要設定列identitycreate table myTable(id int identity(1,1) primary key not null,name varchar(15));MySql下實現自增長只要設定列auto_incrementcreate table myTable(id int auto_increment primary key not null,name
標籤:------------------------抽象資料類型-------------建立地址類型,一定要加as object,還可以在類型中加過程或方法create or replace type address as object ( province varchar2(10), --省份屬性 city varchar2(10) --市屬性) not final; --not final表示該類型可以有子類型 --定義一個子類型--under
標籤:oracle當多表union時遇到nvarchar2類型時報錯 字元集不匹配對使用nvarchar的地方,加上 to_char( nvarchar 的變數或欄位 )如:select to_char(name),price from aa union allselect to_char(name),price from bb 3張表aa,bb,cc都有 name price 欄位 查詢價格最高的前3位姓名select * from(select
標籤:1、查詢可以恢複的時間點 select * from V$SQL where SQL_TEXT like ‘%update MAP_OPTCBL_POINT_70 set shape%‘2、資料恢複到建立的表,根據時間戳記create table newTable as select * from oldTabl
標籤:昨天看有個文章說到的失效對象重新編譯的問題,然後發現自己公司裡也出現莫名其妙的失效對象。--建立自動編譯失效過程事務記錄表declare tabcnt integer := 0;begin select count(*) into tabcnt from dba_tables where table_name=‘RECOMPILE_LOG‘; if tabcnt = 0 then execute immediate ‘create table
標籤:partition outer join實現將稀疏資料轉為稠密資料,舉例:with t as (select deptno, job, sum(sal) sum_sal from emp group by deptno, job),tt as (select distinct job from t)select b.deptno, a.job, sum_sal from tt a left join t b partition by (b.deptno) on a.job =
標籤:Oracle 伺服器啟後,使用Toad 用戶端串連oracle 時候,遇到下面的錯誤:oracle ORA-12514: TNS: no listenerTNS: listener does not currently know of SID give in connect descriptor 第一步:啟動TNS監聽[[email protected] ~]$ lsnrctl startLSNRCTL for Linux: Version 11.2.0.1.0 -
標籤:1.文法結構:select…start with…connect by…prior例如:有一個單位(unit)表 有三個欄位 ID ,NAME,PARENTID(單位ID,單位名稱,上級的單位ID) 1.1 查詢該單位下面的所有單位select t.id,t.name,t.parentid from unit t start with t.id=‘單位的ID‘ connect by prior t.id=