程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> Oracle數據庫 >> Oracle數據庫基礎 >> ORACLE 自動發郵件代碼(3

ORACLE 自動發郵件代碼(3

編輯:Oracle數據庫基礎
 FUNCTION GET_FILE (P_FILE VARCHAR2, P_GET INT)
RETURN VARCHAR2
IS
--p_get=1 表示返回目錄
--p_get=2 表示返回文件名
L_FILE VARCHAR2 (1000);
BEGIN
IF INSTR (P_FILE, '\') > 0
THEN
--Windows
IF P_GET = 1
THEN
L_FILE := SUBSTR (P_FILE, 1, INSTR (P_FILE, '\', -1) - 1);
ELSIF P_GET = 2
THEN
L_FILE :=
SUBSTR (P_FILE, - (LENGTH (P_FILE) - INSTR (P_FILE, '\', -1)));
END IF;
ELSIF INSTR (P_FILE, '/') > 0
THEN
--Linux/unix
IF P_GET = 1
THEN
L_FILE := SUBSTR (P_FILE, 1, INSTR (P_FILE, '/', -1) - 1);
ELSIF P_GET = 2
THEN
L_FILE :=
SUBSTR (P_FILE, - (LENGTH (P_FILE) - INSTR (P_FILE, '/', -1)));
END IF;
END IF;
RETURN L_FILE;
END;
---------------------------------------------刪除directory------------------------------------
PROCEDURE DROP_DIRECTORY (P_DIRECTORY_NAME VARCHAR2)
IS
BEGIN
EXECUTE IMMEDIATE 'drop directory ' || P_DIRECTORY_NAME;
EXCEPTION
WHEN OTHERS
THEN
NULL;
END;
--------------------------------------------------創建directory-----------------------------------------
PROCEDURE CREATE_DIRECTORY (P_DIRECTORY_NAME VARCHAR2, P_DIR VARCHAR2)
IS
BEGIN
EXECUTE IMMEDIATE 'create directory '
|| P_DIRECTORY_NAME
|| ' as '''
|| P_DIR
|| '''';
EXECUTE IMMEDIATE 'grant read,write on directory '
|| P_DIRECTORY_NAME
|| ' to public';
EXCEPTION
WHEN OTHERS
THEN
RAISE;
END;
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved