• [织梦吧]唯一域名:www.dedecms8.com,织梦DedeCMS学习平台.

当前位置: > 编程与数据库 > oracle教程 >

ORACLE自动发邮件代码(3)

来源: www.dedecms8.com 编辑:织梦吧 时间:2012-04-16点击:

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;
    --------------------------------------------分割邮件地址或者附件地址--------------------

About D8

  • ©2014 织梦吧(d8) DedeCMS学习交流平台
  • 唯一网址 www.DedeCMS8.com 网站地图
  • 联系我们 1978130638@qq.com ,  QQ