標籤:--函數的建立create function func1(dno number)return NUMBER--必須帶有傳回值is v_max number;--定義傳回值 begin select max(sal) into v_max--賦值 from emp where deptno= dno; RETURN v_max;--返回 end;--函數的調用,只能是運算式的一部分,不能單獨調用 select * from emp where sal= func1
標籤:預存程序預存程序如下:Create procedure gokul_proc( pId in number, pName in varchar2, OutCur OUT G_PKG_REFCUR.rcDataCursor ) isBEGIN Open OutCur For select * from gokul_table ob where ob.active_staus-‘Y‘ AND ob.id=pId AND
標籤: create or replace trigger TRI_PrintTest before delete or insert or update on TEST_EXAM --觸發事件 for each row -- 每修改一行都需要調用此過程 begin dbms_output.put_line(:new.IDNEW); --IDNEW欄位更新後的值 dbms_output.put_line(:old.
標籤:1.列出至少有一個員工的所有部門。(兩個表聯集查詢,及group by...having的用法)select dname from dept where deptno in(select deptno from emp group by deptno having count(*)>1);2.列出薪金比“SMITH”多的所有員工。(經典的自串連查詢)select ename from emp where sal>(select sal from emp
標籤:oracle schema user 資料庫理論中資料庫使用者和資料庫模式並沒有必然的聯絡,詳細的資料庫模式解釋可以在這裡找到:http://stackoverflow.com/questions/2674222/what-is-purpose-of-database-schemaA database schema is a way to logically group objects
標籤: java如何將一組對象傳入Oracle預存程序,例子如下:CREATE OR REPLACE TYPE TEST_OBJECT AS OBJECT ( id number, name varchar2(32));CREATE OR REPLACE TYPE TABLES_ARRAY AS VARRAY(100) OF TEST_OBJECT;drop table test purge;create table test( id number, name varchar2