遇到了符号“。”当期待以下之一

时间:2015-02-22 10:00:33

标签: plsql

create or replace procedure zivtest is
utl_mail.send_attach_varchar2 varchar2(100) :=utl_mail;

mail_subject varchar2(255) := 'zivtest'||sysdate;
mail_message varchar2(1000):='zivtest'
                                  ||'<br>'||'User count of all active users in all Realms';
recipients_list varchar2(255) :='user@user.com';
p_sender        varchar2(50) := 'user@user.com';
data            clob;
data_header      varchar2(255);
--E_too_much_values exception;

begin

for item IN ( select decode(r.irl_id,1,'UPSEC',2,'PC',3,'CSM',6,'DMROAM',7,'WORKFLOW',8,'CSS_DEALER',10,'CCBATCH',14,'CSS',61,'COL',81,'CRM'
                         ,82,'FIU',83,'OCM',84,'BOA',127,'SAPI') realm,
              count (a.user_id) users
              from sec_idm_user a , SEC_IDM_REALM_A r
              where a.iu_rlid=r.irl_id
              and a.iu_lock='N'
              and a.iu_last_login >= sysdate -90
              group by r.irl_id) LOOP

 if data is not null then
        utl_mail.send_attach_varchar2(
          sender =>         p_sender,
          recipients =>     recipients_list,
          subject =>        mail_subject,
          message =>        mail_message,
          mime_type =>      'text/html; charset=WINDOWS-1255',
          attachment  =>    data_header || data ,
          att_filename =>   'USER_COUNT.csv');


  end if ;

END LOOP;


END;

我该如何解决这个问题?

当我尝试编译它时出现以下错误:

PLS-00103: Encountered the symbol "." when expecting one of the following:
<an identifier> <a double-quoted delimited-identifier>    current 

1 个答案:

答案 0 :(得分:3)

您看到此错误,因为第二行

utl_mail.send_attach_varchar2 varchar2(100) :=utl_mail;

没有意义。您正在尝试声明名为utl_mail.send_attach_varchar2的变量。

你需要的是安装utl_mail包,以便能够使用程序utl_mail.send_attach_varchar2