oracle触发器怎么调用存储过程,触发器如何调用存储过程?

CREATE OR REPLACE PROCEDURE send_mail (

p_rec_email   IN   VARCHAR2,

p_message     IN   VARCHAR2,

p_subject     IN   VARCHAR2 DEFAULT (   xxxx'

|| TO_CHAR (SYSDATE,

'yyyy-mm-dd hh24:mi:ss'

)

),

p_sender      IN   VARCHAR2 DEFAULT ('ORACLE SYSTEM')

)

IS

v_mailhost   VARCHAR2 (30)       := xxxx.com';

mail_conn    UTL_SMTP.connection;

msg          VARCHAR2 (4000);

p_user       VARCHAR2 (30)       := 'domain\user';

p_pass       VARCHAR2 (30)       := '********';

BEGIN

msg :=

'Date:'

|| TO_CHAR (SYSDATE, 'dd mon yy hh24:mi:ss')

|| UTL_TCP.crlf

|| 'From: '

|| p_sender

|| '

|| p_sender

|| '>'

|| UTL_TCP.crlf

|| 'To: '

|| p_rec_email

|| '

|| p_rec_email

|| '>'

|| UTL_TCP.crlf

|| 'Subject: '

|| p_subject

|| UTL_TCP.crlf

|| UTL_TCP.crlf

|| p_message;

-- dbms_output.put_line(msg);

mail_conn := UTL_SMTP.open_connection (v_mailhost, '25');

UTL_SMTP.ehlo (mail_conn, v_mailhost);

UTL_SMTP.command (mail_conn, 'AUTH LOGIN');

UTL_SMTP.command

(mail_conn,

UTL_RAW.cast_to_varchar2

(UTL_ENCODE.base64_encode (UTL_RAW.cast_to_raw (p_user)

)

)

);

UTL_SMTP.command

(mail_conn,

UTL_RAW.cast_to_varchar2

(UTL_ENCODE.base64_encode (UTL_RAW.cast_to_raw (p_pass)

)

)

);

UTL_SMTP.mail (mail_conn, p_sender);

UTL_SMTP.rcpt (mail_conn, p_rec_email);

UTL_SMTP.DATA (mail_conn, msg);

UTL_SMTP.quit (mail_conn);

EXCEPTION

WHEN OTHERS

THEN

DBMS_OUTPUT.put_line (DBMS_UTILITY.format_error_stack);

DBMS_OUTPUT.put_line (DBMS_UTILITY.format_call_stack);

END send_mail;

本人是个新手从坛子里找到了utl_smtp的使用方法,测试也通过了。(sql> 下),可用触发器如何调用?

create or replace trigger INSERT_MAIL

after insert or update ON table

FOR EACH ROW

begin

send_mail(p_rec_email => :new.user_email);

end;

报如下错误Compilation errors for TRIGGER DEVS.INSERT_MAIL

Error: PLS-00201: identifier 'SEND_MAIL' must be declared

Line: 7

Text: send_mail(p_rec_email => :new.user_email);

Error: PL/SQL: Statement ignored

Line: 7

Text: send_mail(p_rec_email => :new.user_email);

那位大侠帮帮忙,谢谢!

还有p_message如何加入好几列信息(同一行)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值