程式碼
select RELEASE_NAME
from FND_PRODUCT_GROUPS;
取得 Oracle ERP Workflow 版本
程式碼
select TEXT
from WF_RESOURCES
where NAME = 'WF_VERSION';
select RELEASE_NAME
from FND_PRODUCT_GROUPS;
select TEXT
from WF_RESOURCES
where NAME = 'WF_VERSION';
select col1, col2, ... from table [where condition ...] start with 要放在最上層的條件 connect by [prior] Child_Column = Parent_Column [order [siblings] by sort ...]
-- 建立 Temp Table create table tom_tree( tree_id number , parent_id number , tree_name varchar2(30) ); -- 新增資料 insert into tom_tree values( 0, null, 'top' ); insert into tom_tree values( 1, 0, '1' ); insert into tom_tree values( 2, 0, '2' ); insert into tom_tree values( 3, 1, '1_1' ); insert into tom_tree values( 4, 1, '1_2' ); insert into tom_tree values( 5, 2, '2_1' ); insert into tom_tree values( 6, 2, '2_2' ); insert into tom_tree values( 7, 2, '2_3' ); commit; -- Treeview 查詢 select level , tree_name , lpad( ' ', (Level - 1) * 3, ' ') || tree_name -- 增加這個欄位的顯示, 會有層次感 from tom_tree start with parent_id is null connect by prior tree_id = parent_id;
if( str.matches("[a-zA-Z0-9|\\.]*") )
{
true 的處理 … // 只有英文數字的處理
}
else
{
flase 的處理 … // 有其他自元的處理
}
SELECT A.*
FROM ( SELECT *
FROM tableName
ORDER BY dbms_random.value
) A
WHERE rownum <= N;
SELECT dbms_random.value
FROM DUAL;
SELECT ceil( dbms_random.value * 1000 )
FROM DUAL;
SELECT lpad( ceil( dbms_random.value * 1000 ), 3, '0' )
FROM DUAL;
select *
from emp
where rownum >= n and rownum <= m;
-- 在 Oracle 12c 以前, 利用 subquery 與 rownum 實現 select b.* from (select a.* from emp a order by a.name ) b where rownum <= n; -- 在 Oracle 12c 以後, 利用 fetch 即可 select a.* from emp a order by a.name fetch first n rows only;
-- 在 Oracle 12c 以前, 利用 subquery 與 rownum 實現 select * from (select rownum bRn , b.* from (select rownum aRn , a.* from emp a order by a.name ) b ) where bRn between n and m; -- 在 Oracle 12c 以後, 利用 fetch 與 offset 即可 select a.* from emp a order by a.name offset (n-1) rows -- 略過 n-1 筆, 也就是從第 n 筆開始 fetch next (m - n + 1) rows only; -- 取幾筆資料, n ~ m 共有 (m - n + 1) 筆
-- 建立 Temp Table CREATE TABLE TOM_1 ( A1 varchar(3) , qty number ); CREATE TABLE TOM_2 ( A2 varchar(3) , qty number ); -- 新增資料到 Temp Table Insert into TOM_1 values( 'A', 2 ); Insert into TOM_1 values( 'C', 3 ); Insert into TOM_1 values( 'E', 5 ); Insert into TOM_1 values( 'X', 3 ); Insert into TOM_2 values( 'A', 1 ); Insert into TOM_2 values( 'B', 2 ); Insert into TOM_2 values( 'C', 3 ); Insert into TOM_2 values( 'D', 4 ); Insert into TOM_2 values( 'X', 3 ); -- Union 結果: A, B, C, D, E, X Select A1 A from Tom_1 Union Select A2 A from Tom_2 Order by A; -- Intersect 結果: A, C, X Select A1 A from Tom_1 Intersect Select A2 A from Tom_2 Order by A; -- Minus (Table 1 - Table 2) 結果: E Select A1 A from Tom_1 Minus Select A2 A from Tom_2 Order by A; -- Minus (Table 2 - Table 1) 結果: B, D Select A2 A from Tom_2 Minus Select A1 A from Tom_1 Order by A; -- Drop Temp Table Drop Table Tom_1; Drop Table Tom_2;
此 Trace 可以得知 Form 目前的作業,
在哪些物件 (Form / Block / Item) 觸發了哪些 Trigger,
而且這些 Trigger 中執行了哪些 Built-in Function