易截截图软件、单文件、免安装、纯绿色、仅160KB

使用Oracle发送邮件

CREATE OR REPLACE PROCEDURE sendemailtest
(mailmsg IN Varchar2)
IS    
   --using mail server to send email.
   mailconn         UTL_SMTP.connection;
   mailhost         VARCHAR2 (20);
   mailfrom         VARCHAR2 (30);
  
BEGIN
   --(1) open connection to mail server.
   mailhost := 'xxx.xxx.xxx.xxx';
   mailfrom := 'Test@MailAddress.com';
   mailconn := UTL_SMTP.open_connection(mailhost);
   UTL_SMTP.helo (mailconn, mailhost);
   UTL_SMTP.mail (mailconn, mailfrom);
   --(2) set recipients.  
   UTL_SMTP.rcpt (mailconn, 'ToMail@MailAddress.com');
   --(3) send content.
   UTL_SMTP.open_data (mailconn);
   UTL_SMTP.write_data(mailconn, 'Date: '||to_char(sysdate,'yyyy/mm/dd hh24:mi:ss')|| UTL_TCP.crlf);
   UTL_SMTP.write_data(mailconn, 'from: fromWho' || UTL_TCP.crlf);
   UTL_SMTP.write_data(mailconn, 'To: ToWho' || UTL_TCP.crlf);
   UTL_SMTP.write_data(mailconn, 'Subject: TestSendMail' || UTL_TCP.crlf);
   UTL_SMTP.write_data(mailconn, 'MIME-Version: 1.0' || UTL_TCP.crlf);
   UTL_SMTP.write_data(mailconn, 'Content-Type: text/html; charset=utf-8' || UTL_TCP.crlf );
   UTL_SMTP.write_data(mailconn, 'Content-Transfer-Encoding: "8Bit"' || UTL_TCP.crlf);
  
   UTL_SMTP.write_data (mailconn, UTL_TCP.crlf || mailmsg);
   UTL_SMTP.close_data (mailconn);
  
   --(4) close connection.
   UTL_SMTP.quit (mailconn);
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line (SUBSTR (SQLERRM, 1, 100));
END;


相关文档:

oracle树结构查询

 
connect by 是结构化查询中用到的,其基本语法是:
select ... from tablename start with 条件1
connect by 条件2
where 条件3;
例:
select * from table
start with org_id = 'HBHqfWGWPy'
connect by prior org_id = parent_id;
 
简单说来是将一个树状结构存储在一张表里,比如一个表 ......

ORACLE OMF介绍

先看Oracle 官方解释
Oracle managed file (OMF)
A file that is created automatically by the Oracle database server when it is needed and automatically deleted when it is no longer needed.
 
如何判断你的数据库是否为支持OMF
SQL> show parameter db_create_file_dest;
 
NAME  & ......

oracle中in,not in和exists,not exists之间的区别

 
 
         一直听到的都是说尽量用exists不要用in,因为exists只判断存在而in需要对比值,所以exists比较快,但看了看网上的一些东西才发现根本不是这么回事。
下面这段是抄的
Select * from T1 where x in ( select y from T2 )
执行的过程相当于:
select * ......

Oracle 批量导入Sequence

 select 'create sequence '||sequence_name||  
       ' minvalue '||min_value||  
       ' maxvalue '||max_value||  
       ' start with '||last_number||  
&n ......

Oracle与DB2中序列处理

1、序列定义    
   ORACLE:   
             CREATE SEQUENCE <sequence_name>
          INCREMENT BY <integer>
    &n ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号