/* if you want using left */select SUBSTR('mystr', 1, 3) from dual;
-- result : mys/* if you want using right */select SUBSTR('mystr', -3) from dual;
-- result : str/* if you want using substring */select SUBSTR('mystr', 3, 2) from dual;
-- result : st
replace(sourcetext, findstr, replacestr)
select REPLACE('mystr', 's', 'o') from dual;
-- result : myotr
Like including _ character
select*from all_tables where table_name like'TBL\_%';
Math
mod
select mod(10, 7) from dual;
-- result : 3
Others
Find String from Procedure source
SELECT*FROM ALL_SOURCE
WHERETEXTLIKE'%EVENTSTRING%'ORDER BY TYPE, NAME, LINE;
SELECT TO_CHAR (ADD_MONTHS (SYSDATE, -1), 'YYYYMM') AS m1
, TO_CHAR (ADD_MONTHS (SYSDATE, -2), 'YYYYMM') AS m2
, TO_CHAR (ADD_MONTHS (SYSDATE, -3), 'YYYYMM') AS m3
FROM dual;
Create DDL script
-- if use long when ddl script be truncatedset long 100000selectdbms_metadata.get_ddl('TABLE','TableName','Owner') from dual;
selectdbms_metadata.get_ddl('Procedure','ProcedureName','Owner') from dual;
コメント
コメントを投稿