oracle怎么验证email,如何在Oracle中发送Email

这个博客介绍了一个Oracle PL/SQL包`demo_mail`,用于发送邮件。包中包含了多种方法,如简单的`mail`过程用于发送纯文本邮件,以及更复杂的API如`begin_mail`、`write_text`、`end_mail`等,支持HTML、非ASCII字符、附件和多部分邮件。此外,还提供了一个会话管理功能,允许在一次会话中发送多封邮件以提高性能。
摘要由CSDN通过智能技术生成

CREATE OR REPLACE PACKAGE demo_mail IS

----------------------- Customizable Section -----------------------

-- Customize the SMTP host, port and your domain name below.

smtp_host VARCHAR2(256) := 'smtp.eygle.com';

smtp_port PLS_INTEGER := 25;

smtp_domain VARCHAR2(256) :='eygle.com';

-- Customize the signature that will appear in the email's MIME header.

-- Useful for versioning.

MAILER_ID CONSTANT VARCHAR2(256) :='Mailer by Eygle';

--------------------- End Customizable Section ---------------------

-- A unique string that demarcates boundaries of parts in a multi-part email

-- The string should not appear inside the body of any part of the email.

-- Customize this if needed or generate this randomly dynamically.

BOUNDARY CONSTANT VARCHAR2(256) := '-----7D81B75CCC90D2974F7A1CBD';

FIRST_BOUNDARY CONSTANT VARCHAR2(256) := '--' || BOUNDARY || utl_tcp.CRLF;

LAST_BOUNDARY CONSTANT VARCHAR2(256) := '--' || BOUNDARY || '--' ||

utl_tcp.CRLF;

-- A MIME type that denotes multi-part email (MIME) messages.

MULTIPART_MIME_TYPE CONSTANT VARCHAR2(256) := 'multipart/mixed; boundary="'||

BOUNDARY || '"';

MAX_BASE64_LINE_WIDTH CONSTANT PLS_INTEGER := 76 / 4 * 3;

-- A simple email API for sending email in plain text in a single call.

-- The format of an email address is one of these:

-- someone@some-domain

-- "Someone at some domain"

-- Someone at some domain

-- The recipients is a list of email addresses separated by

-- either a "," or a ";"

PROCEDURE mail(sender IN VARCHAR2,

recipients IN VARCHAR2,

subject IN VARCHAR2,

message IN VARCHAR2);

-- Extended email API to send email in HTML or plain text with no size limit.

-- First, begin the email by begin_mail(). Then, call write_text() repeatedly

-- to send email in ASCII piece-by-piece. Or, call write_mb_text() to send

-- email in non-ASCII or multi-byte character set. End the email with

-- end_mail().

FUNCTION begin_mail(sender IN VARCHAR2,

recipients IN VARCHAR2,

subject IN VARCHAR2,

mime_type IN VARCHAR2 DEFAULT 'text/plain',

priority IN PLS_INTEGER DEFAULT NULL)

RETURN utl_smtp.connection;

-- Write email body in ASCII

PROCEDURE write_text(conn IN OUT NOCOPY utl_smtp.connection,

message IN VARCHAR2);

-- Write email body in non-ASCII (including multi-byte). The email body

-- will be sent in the database character set.

PROCEDURE write_mb_text(conn IN OUT NOCOPY utl_smtp.connection,

message IN VARCHAR2);

-- Write email body in binary

PROCEDURE write_raw(conn IN OUT NOCOPY utl_smtp.connection,

message IN RAW);

-- APIs to send email with attachments. Attachments are sent by sending

-- emails in "multipart/mixed" MIME format. Specify that MIME format when

-- beginning an email with begin_mail().

-- Send a single text attachment.

PROCEDURE attach_text(conn IN OUT NOCOPY utl_smtp.connection,

data IN VARCHAR2,

mime_type IN VARCHAR2 DEFAULT 'text/plain',

inline IN BOOLEAN DEFAULT TRUE,

filename IN VARCHAR2 DEFAULT NULL,

last IN BOOLEAN DEFAULT FALSE);

-- Send a binary attachment. The attachment will be encoded in Base-64

-- encoding format.

PROCEDURE attach_base64(conn IN OUT NOCOPY utl_smtp.connection,

data IN RAW,

mime_type IN VARCHAR2 DEFAULT 'application/octet',

inline IN BOOLEAN DEFAULT TRUE,

filename IN VARCHAR2 DEFAULT NULL,

last IN BOOLEAN DEFAULT FALSE);

-- Send an attachment with no size limit. First, begin the attachment

-- with begin_attachment(). Then, call write_text repeatedly to send

-- the attachment piece-by-piece. If the attachment is text-based but

-- in non-ASCII or multi-byte character set, use write_mb_text() instead.

-- To send binary attachment, the binary content should first be

-- encoded in Base-64 encoding format using the demo package for 8i,

-- or the native one in 9i. End the attachment with end_attachment.

PROCEDURE begin_attachment(conn IN OUT NOCOPY utl_smtp.connection,

mime_type IN VARCHAR2 DEFAULT 'text/plain',

inline IN BOOLEAN DEFAULT TRUE,

filename IN VARCHAR2 DEFAULT NULL,

transfer_enc IN VARCHAR2 DEFAULT NULL);

-- End the attachment.

PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,

last IN BOOLEAN DEFAULT FALSE);

-- End the email.

PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection);

-- Extended email API to send multiple emails in a session for better

-- performance. First, begin an email session with begin_session.

-- Then, begin each email with a session by calling begin_mail_in_session

-- instead of begin_mail. End the email with end_mail_in_session instead

-- of end_mail. End the email session by end_session.

FUNCTION begin_session RETURN utl_smtp.connection;

-- Begin an email in a session.

PROCEDURE begin_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection,

sender IN VARCHAR2,

recipients IN VARCHAR2,

subject IN VARCHAR2,

mime_type IN VARCHAR2 DEFAULT 'text/plain',

priority IN PLS_INTEGER DEFAULT NULL);

-- End an email in a session.

PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection);

-- End an email session.

PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection);

END;

/

CREATE OR REPLACE PACKAGE BODY demo_mail IS

-- Return the next email address in the list of email addresses, separated

-- by either a "," or a ";". The format of mailbox may be in one of these:

-- someone@some-domain

-- "Someone at some domain"

-- Someone at some domain

FUNCTION get_address(addr_list IN OUT VARCHAR2) RETURN VARCHAR2 IS

addr VARCHAR2(256);

i pls_integer;

FUNCTION lookup_unquoted_char(str IN VARCHAR2,

chrs IN VARCHAR2) RETURN pls_integer AS

c VARCHAR2(5);

i pls_integer;

len pls_integer;

inside_quote BOOLEAN;

BEGIN

inside_quote := false;

i := 1;

len := length(str);

WHILE (i <= len) LOOP

c := substr(str, i, 1);

IF (inside_quote) THEN

IF (c = '"') THEN

inside_quote := false;

ELSIF (c = '\\') THEN

i := i + 1; -- Skip the quote character

END IF;

GOTO next_char;

END IF;

IF (c = '"') THEN

inside_quote := true;

GOTO next_char;

END IF;

IF (instr(chrs, c) >= 1) THEN

RETURN i;

END IF;

<>

i := i + 1;

END LOOP;

RETURN 0;

END;

BEGIN

addr_list := ltrim(addr_list);

i := lookup_unquoted_char(addr_list, ',;');

IF (i >= 1) THEN

addr := substr(addr_list, 1, i - 1);

addr_list := substr(addr_list, i + 1);

ELSE

addr := addr_list;

addr_list := '';

END IF;

i := lookup_unquoted_char(addr, '

IF (i >= 1) THEN

addr := substr(addr, i + 1);

i := instr(addr, '>');

IF (i >= 1) THEN

addr := substr(addr, 1, i - 1);

END IF;

END IF;

RETURN addr;

END;

-- Write a MIME header

PROCEDURE write_mime_header(conn IN OUT NOCOPY utl_smtp.connection,

name IN VARCHAR2,

value IN VARCHAR2) IS

BEGIN

utl_smtp.write_data(conn, name || ': ' || value || utl_tcp.CRLF);

END;

-- Mark a message-part boundary. Set to TRUE for the last boundary.

PROCEDURE write_boundary(conn IN OUT NOCOPY utl_smtp.connection,

last IN BOOLEAN DEFAULT FALSE) AS

BEGIN

IF (last) THEN

utl_smtp.write_data(conn, LAST_BOUNDARY);

ELSE

utl_smtp.write_data(conn, FIRST_BOUNDARY);

END IF;

END;

------------------------------------------------------------------------

PROCEDURE mail(sender IN VARCHAR2,

recipients IN VARCHAR2,

subject IN VARCHAR2,

message IN VARCHAR2) IS

conn utl_smtp.connection;

BEGIN

conn := begin_mail(sender, recipients, subject);

write_text(conn, message);

end_mail(conn);

END;

------------------------------------------------------------------------

FUNCTION begin_mail(sender IN VARCHAR2,

recipients IN VARCHAR2,

subject IN VARCHAR2,

mime_type IN VARCHAR2 DEFAULT 'text/plain',

priority IN PLS_INTEGER DEFAULT NULL)

RETURN utl_smtp.connection IS

conn utl_smtp.connection;

BEGIN

conn := begin_session;

begin_mail_in_session(conn, sender, recipients, subject, mime_type,

priority);

RETURN conn;

END;

------------------------------------------------------------------------

PROCEDURE write_text(conn IN OUT NOCOPY utl_smtp.connection,

message IN VARCHAR2) IS

BEGIN

utl_smtp.write_data(conn, message);

END;

------------------------------------------------------------------------

PROCEDURE write_mb_text(conn IN OUT NOCOPY utl_smtp.connection,

message IN VARCHAR2) IS

BEGIN

utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(message));

END;

------------------------------------------------------------------------

PROCEDURE write_raw(conn IN OUT NOCOPY utl_smtp.connection,

message IN RAW) IS

BEGIN

utl_smtp.write_raw_data(conn, message);

END;

------------------------------------------------------------------------

PROCEDURE attach_text(conn IN OUT NOCOPY utl_smtp.connection,

data IN VARCHAR2,

mime_type IN VARCHAR2 DEFAULT 'text/plain',

inline IN BOOLEAN DEFAULT TRUE,

filename IN VARCHAR2 DEFAULT NULL,

last IN BOOLEAN DEFAULT FALSE) IS

BEGIN

begin_attachment(conn, mime_type, inline, filename);

write_text(conn, data);

end_attachment(conn, last);

END;

------------------------------------------------------------------------

PROCEDURE attach_base64(conn IN OUT NOCOPY utl_smtp.connection,

data IN RAW,

mime_type IN VARCHAR2 DEFAULT 'application/octet',

inline IN BOOLEAN DEFAULT TRUE,

filename IN VARCHAR2 DEFAULT NULL,

last IN BOOLEAN DEFAULT FALSE) IS

i PLS_INTEGER;

len PLS_INTEGER;

BEGIN

begin_attachment(conn, mime_type, inline, filename, 'base64');

-- Split the Base64-encoded attachment into multiple lines

i := 1;

len := utl_raw.length(data);

WHILE (i < len) LOOP

IF (i + MAX_BASE64_LINE_WIDTH < len) THEN

utl_smtp.write_raw_data(conn,

utl_encode.base64_encode(utl_raw.substr(data, i,

MAX_BASE64_LINE_WIDTH)));

ELSE

utl_smtp.write_raw_data(conn,

utl_encode.base64_encode(utl_raw.substr(data, i)));

END IF;

utl_smtp.write_data(conn, utl_tcp.CRLF);

i := i + MAX_BASE64_LINE_WIDTH;

END LOOP;

end_attachment(conn, last);

END;

------------------------------------------------------------------------

PROCEDURE begin_attachment(conn IN OUT NOCOPY utl_smtp.connection,

mime_type IN VARCHAR2 DEFAULT 'text/plain',

inline IN BOOLEAN DEFAULT TRUE,

filename IN VARCHAR2 DEFAULT NULL,

transfer_enc IN VARCHAR2 DEFAULT NULL) IS

BEGIN

write_boundary(conn);

write_mime_header(conn, 'Content-Type', mime_type);

IF (filename IS NOT NULL) THEN

IF (inline) THEN

write_mime_header(conn, 'Content-Disposition',

'inline; filename="'||filename||'"');

ELSE

write_mime_header(conn, 'Content-Disposition',

'attachment; filename="'||filename||'"');

END IF;

END IF;

IF (transfer_enc IS NOT NULL) THEN

write_mime_header(conn, 'Content-Transfer-Encoding', transfer_enc);

END IF;

utl_smtp.write_data(conn, utl_tcp.CRLF);

END;

------------------------------------------------------------------------

PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,

last IN BOOLEAN DEFAULT FALSE) IS

BEGIN

utl_smtp.write_data(conn, utl_tcp.CRLF);

IF (last) THEN

write_boundary(conn, last);

END IF;

END;

------------------------------------------------------------------------

PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection) IS

BEGIN

end_mail_in_session(conn);

end_session(conn);

END;

------------------------------------------------------------------------

FUNCTION begin_session RETURN utl_smtp.connection IS

conn utl_smtp.connection;

BEGIN

-- open SMTP connection

conn := utl_smtp.open_connection(smtp_host, smtp_port);

utl_smtp.helo(conn, smtp_domain);

RETURN conn;

END;

------------------------------------------------------------------------

PROCEDURE begin_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection,

sender IN VARCHAR2,

recipients IN VARCHAR2,

subject IN VARCHAR2,

mime_type IN VARCHAR2 DEFAULT 'text/plain',

priority IN PLS_INTEGER DEFAULT NULL) IS

my_recipients VARCHAR2(32767) := recipients;

my_sender VARCHAR2(32767) := sender;

BEGIN

-- Specify sender's address (our server allows bogus address

-- as long as it is a full email address (xxx@yyy.com).

utl_smtp.mail(conn, get_address(my_sender));

-- Specify recipient(s) of the email.

WHILE (my_recipients IS NOT NULL) LOOP

utl_smtp.rcpt(conn, get_address(my_recipients));

END LOOP;

-- Start body of email

utl_smtp.open_data(conn);

-- Set "From" MIME header

write_mime_header(conn, 'From', sender);

-- Set "To" MIME header

write_mime_header(conn, 'To', recipients);

-- Set "Subject" MIME header

write_mime_header(conn, 'Subject', subject);

-- Set "Content-Type" MIME header

write_mime_header(conn, 'Content-Type', mime_type);

-- Set "X-Mailer" MIME header

write_mime_header(conn, 'X-Mailer', MAILER_ID);

-- Set priority:

-- High Normal Low

-- 1 2 3 4 5

IF (priority IS NOT NULL) THEN

write_mime_header(conn, 'X-Priority', priority);

END IF;

-- Send an empty line to denotes end of MIME headers and

-- beginning of message body.

utl_smtp.write_data(conn, utl_tcp.CRLF);

IF (mime_type LIKE 'multipart/mixed%') THEN

write_text(conn, 'This is a multi-part message in MIME format.' ||

utl_tcp.crlf);

END IF;

END;

------------------------------------------------------------------------

PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection) IS

BEGIN

utl_smtp.close_data(conn);

END;

------------------------------------------------------------------------

PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection) IS

BEGIN

utl_smtp.quit(conn);

END;

END;

/

Oracle P/L SQL实现发送Email、浏览网页等网络操作功能 Oracle P/L SQL实现发送Email、浏览网页等网络操作功能,以下是此过程包的头部,包体经常打包处理plb,感兴趣用户可以下载下来。 --.使用聚合函数实现 多行合并 Drop Type Strcat_type; Drop Function f_StrCat; Drop Package UTL_INet; Variable ls_ObjectName VarChar2(128); Begin Select Sequence_Name Into :ls_ObjectName From User_Sequences Where Sequence_Name = 'SYS_RAND_ID'; DBMS_Output.Put_Line( :ls_ObjectName ); Exception When No_Data_Found Then Execute Immediate 'Create Sequence SYS_RAND_ID minvalue 1 maxValue 99999999999999999 Start With 1 increment by 1 cache 5 cycle order'; End; / --1、创建类型 Create Or Replace Type Strcat_type As Object ( cat_string varchar2(4000), Static Function ODCIAggregateInitialize(cs_ctx In Out strcat_type) Return Number, Member Function ODCIAggregateIterate(self In Out strcat_type,value in varchar2) Return Number, Member Function ODCIAggregateMerge(self In Out strcat_type,ctx2 In Out strcat_type) Return Number, Member Function ODCIAggregateTerminate(self In Out strcat_type,ReturnValue Out varchar2,flags in Number) Return Number ); / --2. 创建类型体 Create Or Replace Type Body Strcat_type Is Static Function ODCIAggregateInitialize( cs_ctx In Out strcat_type )Return Number is Begin cs_ctx := strcat_type( Null ); Return ODCIConst.Success; End; Member Function ODCIAggregateIterate( self In Out strcat_type, value In varchar2 ) Return Number is Begin if self.cat_string is Null or Instr( self.cat_string, value ) = 0 Then self.cat_string := self.cat_string || ','|| value; End if; Return ODCIConst.Success; End; Member Function ODCIAggregateTerminate( self In Out strcat_type, ReturnValue Out varchar2, flags In Number) Return Number is Begin ReturnValue := ltrim(rtrim( self.cat_string,','),',' ); Return ODCIConst.Success; End; Member Function ODCIAggregateMerge( self In Out strcat_type, ctx2 In Out strcat_type) Return Number is Begin if self.cat_string is Null or Instr( self.cat_string, ctx2.cat_string ) = 0 Then self.cat_string := self.cat_string || ',' || ctx2.cat_string; End if; Return ODCIConst.Success; End; End; / --3.创建函数: 使用聚合函数实现 多行合并 Create or Replace Function f_StrCat( as_input Varchar2 ) Return Varchar2 PARALLEL_ENABLE AGGREGATE USING strcat_type; / Grant Execute on f_StrCat To Public; --End of 使用聚合函数实现 多行合并 Create Or Replace Package UTL_INet AS Type VarChar_Type is Table of VarChar2(400) Index By Binary_Integer; Type Number_Type is Table of Number(12,4) Index By Binary_Integer; Type DynamicCursor is ref Cursor; --动态游标 --Purpose : 获得汉字拼音编码 Type ut_PYIndex_191_List is Varray( 191 ) OF Number; Type ut_PYIndex_List is Varray( 10 ) OF ut_PYIndex_191_List; is_OracleDirectory Constant VarChar2(20) := 'ATTACH_DIR'; --内部附件生成目录(Oracle的目录) --Clob叠加比较慢,先用VarChar2叠加到4000个字符后才叠加到Clob字段 --UTL_INet.p_ClobCAT( Procedure p_ClobCAT( ac_HTMLText in Out Clob, as_CatText in Out VarChar2, as_Str in VarChar2 Default Null ); --字符串根据特定分隔符分来 --Select UTL_INet.f_SplitString( 'A,B,C', xx, ',' ) From dual; Function f_SplitString( as_SourStr in out Clob, --输入字符串A,B,C as_Separator in VarChar2 Default '/' --分拆依据的分隔符, )Return VarChar2; --分拆结果A --将Clob内容写入物理文件 --Exec UTL_INet.p_PutClob2File( as_FileName => 'aa.sql', ac_Text => 'test sql' ); Procedure p_PutClob2File( as_SubDir in VarChar2, --目录名 as_FileName in VarChar2, --文件名 ac_Text in Clob, --文件内容 as_Overwrite in VarChar default 'Y', --标志位:Y:覆盖文件内容,N:追加 as_OraVersion in VarChar default 'N' --标志位:Y:写入Oracle版本信息 ); --序号自动递增计算 --e.g.: 输入:HLXU99349021,返回:HLXU99349022 --范例: Select UTL_INet.f_AutoNum( 'HLXU99349021' ), UTL_INet.f_AutoNum( 'ABA', -1 ), UTL_INet.f_AutoNum( 'ABZ' ) from Dual; Function f_AutoNum( as_OldNum in VarChar2, --原字符串 ai_Step in Number Default 1, --步长,默认是递增加1, ai_DigitXXX in Number Default Null --累计序号位数 XXX )Return VarChar2; --字符串加解密,返回一串32位长的字符串 --Select UTL_INet.f_MD5( 'TestPassword' ) From Dual; Function f_MD5( as_SourceStr in Varchar2 --需要加密的字符串 ) Return Varchar2; --将Email地址去头去尾,剩下最简单的Email地址,如"TSI Customer Service" <cs@csdn.com>变成cs@csdn.com Function f_GetNakedEmailAddr( as_DisplayEmail In VarChar2, as_Including in Char Default 'N' --Y: 返回<cs@csdn.com> )Return VarChar2; --测试发送Email邮箱是否正确 Function f_TestEmailAccount( ac_Connection out Nocopy UTL_SMTP.Connection, as_SMTPHost in VarChar2, --邮件服务器 mail.csdn.com ai_SMTPPort in PLS_Integer Default 25, --邮件服务器端口 as_SMTPAuth in VarChar2 Default 'Y', --发送密码验证 as_Username in VarChar2 Default Null, --邮件用户 as_Password in VarChar2 Default Null, --邮件口令 as_WalletPath in VarChar2 Default Null, as_WalletPwd in VarChar2 Default Null )Return Boolean; ------------------------------------------------ 写邮件头和邮件内容------------------------- Procedure p_WriteRawData( ac_Conn in Out Nocopy UTL_SMTP.Connection, as_Partname in VarChar2, as_Value in VarChar2, as_Splite in VarChar2 Default ':', as_CRLF in VarChar2 Default UTL_TCP.CRLF ); ----------------------------------------------发送附件------------------------------------- Procedure p_MailAttachment( ac_Conn in Out Nocopy UTL_SMTP.Connection, as_Filename in VarChar2, as_Boundary in VarChar2, as_Encode in VarChar2 Default 'base64', as_MimeType in VarChar2 Default 'text/plain', as_ContentID in VarChar2 Default Null, -- ab_Inline in Boolean Default False --True将文本内容直接在邮件内容显示出来,并出现在附件,False不显示只出现在附件 ); -----------------自动签名的生成,签名生成显示后还出现此签名文件为附件,尚未解决------------------------------- Procedure p_GetMailSignature( ac_Conn in Out Nocopy UTL_SMTP.Connection, as_Boundary in VarChar2, as_Encode in VarChar2 Default 'base64', as_SignatureLogo in VarChar2 Default Null, as_SignatureText in VarChar2 Default Null ); --发送Email前必须将ewallet.p12拷贝到C:\OracleAttachDir目录 --发送电子邮件 --Exec UTL_INet.p_SendEmail( 'csdn@gmail.com', 'Test 主题Subject', 'Mail body(邮件内容)' ); Procedure p_SendEmail( as_Sender in VarChar2, as_Recipient in VarChar2, as_CC in VarChar2 Default Null, as_BCC in VarChar2 Default Null, as_Subject in VarChar2, ac_Message in Clob, as_AttachLists in VarChar2 Default Null, --多个用逗号,分开 as_SMTPHost in VarChar2, --邮件服务器 ai_SMTPPort in PLS_Integer Default 25, --邮件服务器端口 as_SMTPAuth in VarChar2 Default 'Y', --发送密码验证 as_WalletPath in VarChar2 Default Null, as_WalletPwd in VarChar2 Default Null, as_Username in VarChar2 Default Null, as_Password in VarChar2 Default Null, as_RunResult out VarChar2, --返回信息,OK成功,其他返回错误 as_SignatureLogo in VarChar2 Default Null, as_SignatureText in VarChar2 Default Null, as_Encode in VarChar2 Default 'base64', ai_Priority In Pls_Integer Default Null ); Function f_LoadHTMLFromURL( as_URL in VarChar2, as_CharSet in VarChar2 Default 'UTF-8' )Return Clob; --生成HTML报表表头 --Exec f_HTMLTableHead( 'Tab1', '20:Table Name;20:Records' ); Function f_HTMLTableHead( as_TableID in VarChar2, --表ID as_WidthColumns in VarChar2, --表头内容,用分号;隔开,宽度与标题用冒号:隔开 as_BgColor in VarChar2 Default 'CCCCCC' --标题背景色 )Return VarChar2; --生成HTML报表主体内容 --Exec UTL_INet.f_HTMLTableBody( '' ); Function f_HTMLTableBody( as_BodyText in VarChar2, --主体内容,多个用分号;隔开 as_Align in VarChar2 Default Null --格式(居,靠左,靠右) )Return VarChar2; --获取汉字拼音字母表 --Select UTL_INet.f_getChineseSpell( '获取汉字拼音' ) from dual; Function f_getChineseSpell( as_CNStr in VarChar2, --文 as_First in VarChar2 Default Null --空返回完整拼音,其他返回拼音首字母 )Return VarChar2; --二进制转换成十进制函数 --Select UTL_INet.f_Bin2Dec( '10111011' ) From dual; Function f_Bin2Dec( as_Bin in VarChar2 )Return Number; --十进制转换成二进制函数 --Select UTL_INet.f_Dec2Bin( 187 ) From dual; Function f_Dec2Bin( an_Dec in Number )Return VarChar2; --十进制转换成三十二进制函数 --Select UTL_INet.f_Dec2Hex( 187 ) From dual; Function f_Dec2Hex( an_Dec in Number )Return VarChar2; --三十二进制转换成十进制函数 --Select UTL_INet.f_Hex2Dec( '5R' ) From dual; Function f_Hex2Dec( as_Hex in VarChar2 )Return Number; --生成12位随机数 --Select UTL_INet.f_Rand() From dual; Function f_Rand( as_PreFix in VarChar2 Default '00', --未满个数字符补充串 an_Nums in Number Default 12 )Return VarChar2; --繁体字转化成简体字(传入的汉字,若有繁体自动转化为简体) Function f_ft2jt( as_Text in VarChar2 --传入的汉字 )Return VarChar2; --简体字转化成繁体字(传入的汉字,若有简体自动转化为繁体) Function f_jt2ft( as_Text in VarChar2 --传入的汉字 )Return VarChar2; -- -------------------------------------------------------------------------- -- Description : SOAP related Functions for consuming web services. Type t_Request is Record ( Method VarChar2(256), Namespace VarChar2(256), Body VarChar2(32767), EnvelopeTag VarChar2(30) ); Type t_Response is Record ( Doc XMLType, EnvelopeTag VarChar2(30) ); Function f_NewRequest( as_Method in VarChar2, as_Namespace in VarChar2, as_EnvelopeTag in VarChar2 Default 'SOAP-ENV' )Return t_Request; Procedure p_AddParameter( as_Request in out Nocopy t_Request, as_Name in VarChar2, as_Type in VarChar2, as_Value in VarChar2 ); Function f_Invoke( as_Request in out Nocopy t_Request, as_URL in VarChar2, as_Action in VarChar2 )Return t_Response; Function f_GetReturnValue( as_Response in out Nocopy t_Response, as_Name in VarChar2, as_Namespace in VarChar2 )Return VarChar2; --列出当前目录下所有文件清单,可以指定扩展名,是否包含子目录,返回的文件名用|分割开来 Function f_ListDirectory( as_SubDir in VarChar2, as_Ext in VarChar2 Default Null, as_IncludingSubDir in Char Default 'N' )Return Clob; --将数值翻译成文大写、英文大写 --Select f_Digit2Char( 24822.80, 'EN_Amount' ) From dual; Function f_Digit2Char( an_Amount in Number, --要被翻译的数值 as_Option in VarChar2 --翻译选择项 )Return VarChar2; --发送短信 Function f_SendSMS( as_MobilePhone in VarChar2, --手机号码 as_SMSText in VarChar2, --短信内容 as_SMSURL in VarChar2, as_SMSUserID in VarChar2, as_SMSPasswd in VarChar2 )Return VarChar2; --删除某个指定文件 Procedure p_RemoveFile( as_SubDir in VarChar2, --路径 as_FileName in VarChar2 --多个用逗号,分开 ); --从文件读内容 Function f_GetTextFromFile( as_SubDir in VarChar2, --目录名 as_FileName in VarChar2, --文件名 as_NewLine in VarChar2 Default UTL_TCP.CRLF --换行符 )Return Clob; END UTL_INet; /
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值