1.基本結構CREATE OR REPLACE PROCEDURE 預存程序名字(參數1 IN NUMBER,參數2 IN NUMBER,參數3 OUT NUMBER) IS變數1 INTEGER := 預設值;變數2 DATE;BEGIN…EXCEPTIONWHEN 異常類別 THEN…WHEN OTHERS THEN…END 預存程序名字;2.基本操作變數賦值 V_TEST := 1;動態賦值 SELECT COL1,COL2,… INTO VAR1,VAR2,… FROM … WHERE
From: http://www.cnblogs.com/attraction/archive/2004/06/04/13489.aspx 預存程序返回記錄集: CREATE OR REPLACE PACKAGE pkg_test AS TYPE myrctype IS REF CURSOR; PROCEDURE get (p_id NUMBER, p_rc OUT myrctype); END pkg_test; / CREATE OR REPLACE PACKAGE
1.查看主機名稱:SQL> select host_name from v$instance;HOST_NAME----------------------------------------------------------------mycomputer-PC2.主要三張表中的資料:(1)emp 員工表SQL> set line 120;SQL> select * from emp;EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO-
嵌套SQL的查詢速度比較分析文章中使用Oracle內建的HR資料庫,故代碼可以直接進行測試。代碼一:select t.employee_id, t.first_name, t.phone_number from HR.Employees t where t.first_name like 'A%'or t.first_name like 'B%'or t.first_name like 'H%'or t.first_name like 'K%'or t.first_name like '
ORDER BY 是用來對select結果排序的,很簡單,但是也總結一下吧。 1. 按列名排序,預設是升序的。 單列升序:select<column_name> from <table_name> order by <column_name>; 單列降序:select <column_name> from table_name order by <column_name> desc; 多列升序:select
alter any cluster 修改任意簇的許可權 alter any index 修改任意索引的許可權 alter any role 修改任意角色的許可權 alter any sequence 修改任意序列的許可權 alter any snapshot 修改任意快照的許可權 alter any table 修改任意表的許可權 alter any trigger 修改任意觸發器的許可權 alter cluster 修改擁有簇的許可權 alter
怎樣查看oracle當前的串連數呢?只需要用下面的SQL語句查詢一下就可以了。select * from v$session where username is not nullselect username,count(username) from v$session where username is not null group by username #查看不同使用者的串連數select count(*) from v$session #串連數Select count(*)
1. 查看所有資料表空間大小 SQL> select tablespace_name,sum(bytes)/1024/1024 from dba_data_files 2 group by tablespace_name; 2. 已經使用的資料表空間大小SQL> select tablespace_name,sum(bytes)/1024/1024 from dba_free_space 2 group by tablespace_name; 3. 所以使用空間可以這樣計算
簡單貼出主要部分代碼。.sql--定義包create or replace package PKG_G_SelectSp as type p_G_Cursor is ref cursor;procedure P_G_GetPagingData( q_Sql varchar2, rowCountPage number, indexNowPage number, totalRows out number, totalPages out number, p_corsor out
在oracle10中寫好了預存程序,代碼如下:CREATE OR REPLACE Procedure Proc_Insert( sName in varchar2, sAge in int, sExeTime in varchar2)isbegin Insert into T_TEST(C_ID, C_NAME, C_AGE, C_INTIME, C_EXETIME)