本文所以練習都是基於oracle內建提供的一個資料庫進行的。資料庫中包含員工表emp。部門資訊表dept。員工工資工總表下面是三個表的表結構:一:基本查詢語句1.最簡單的查詢所有列語句Select * from emp;2.查詢指定列表的查詢語句Select empno ,ename,sal from emp;注意:oracle預設的字元型和日期型資料是靠左對齊。而數字資料是靠右對齊3.帶有簡單算術運算子的簡單查詢:Select empno ,ename,sal +500 from emp;注意
好長時間沒寫過預存程序了,這幾天項目中剛好要用到預存程序,沒想到一點都記不起來了,又翻了翻以前記錄的資料,才算完成。--建立一個預存程序 傳入兩個參數, in 表示傳入的參數,返回的參數用out表示create or replace procedure count1(starttime in varchar2,endtime in varchar2 ) as-- 用遊標接收資料cursor mycu is select t1.* ,b1.namefrom (select p.duty
http://www.blogjava.net/liaojiyong/archive/2007/10/26/156094.html1、啟動資料庫:oracle@suse92:~> sqlplus /nolog SQL*Plus: Release 9.2.0.4.0 - Production on Fri Jan 20 02:29:37 2006 Copyright (c) 1982, 2002, Oracle Corporation. All rights
type tt_type is table of varchar2(32) INDEX BY BINARY_INTEGER; --使用”,”將分割字串轉換為數組,返回為數組個數, --閆磊 Email:Landgis@126.com,yanleigis@21cn.com 2002.06.03編寫 function toArray(Liststr in varchar2, V1 out tt_type) return integer is --FieldNames轉化為數組
--刪除括弧內的東西function delmatch(str in varchar2, firstmatch in varchar2, aftermatch in varchar2) return varchar2 is p1 integer; p2 integer; delstr varchar2(4000); begin p1 := instr(str,
(環境Oracle 9i,所有語句在sqlplus下執行) 1、invalid對象的查詢查詢invalid對象的總個數 select count(*) from dba_objects where status='INVALID'; 分類查詢invalid對象的個數select owner,object_type,count(*) from dba_objects where status='INVALID' group by owner,object_type;查詢對象的詳細資料select
create or replace procedure modifychartovarchar is -- cursor c1 is select t.TABLE_NAME, t.COLUMN_NAME, t.DATA_LENGTH from all_tab_columns t where t.OWNER = 'LANDUSER' and t.DATA_TYPE = 'CHAR' and t.TABLE_NAME in (select
1、SET AUTOTRACE參數SET AUTOTRACE OFF ---------------- 不產生AUTOTRACE 報告,這是預設模式SET AUTOTRACE ON EXPLAIN ------ AUTOTRACE只顯示最佳化器執行路徑報告 SET AUTOTRACE ON STATISTICS -- 只顯示執行統計資訊SET AUTOTRACE ON ----------------- 包含執行計畫和統計資訊 SET AUTOTRACE TRACEONLY ------