Re: [oracle_br] Re: Enviar e-mail pelo Oracle com Conteúdo HTML
Chiappa, obrigado pela indicação. Teria me enviar esta nota? O acesso ao metalink que temos está temporariamente suspenso. Atenciosamente. - Original Message - From: jlchiappa To: oracle_br@yahoogrupos.com.br Sent: Thursday, February 22, 2007 11:34 AM Subject: [oracle_br] Re: Enviar e-mail pelo Oracle com Conteúdo HTML Em PL/SQL o tamanho máximo de uma string é 32767, ponto, não tem como vc aumentar. O que vc deverá fazer é RE-ESCREVER a rotina de modo a trabalhar com "pedaços" de informação, e já que vc NÃO sabe nada de java E tem bd 10g (aonde NÃO é mais necessário vc usar java pra enviar e-mail, a package UTL_MAIL substituiu isso) eu diria pra vc seguir a nota Subject: How To Send Attachments Of Size Greater Than 32 KB Using UTL_SMTP Package , Doc ID: Note:357385.1 no metalink. []s Chiappa --- Em oracle_br@yahoogrupos.com.br, "Augusto Cesar R. Costa" <[EMAIL PROTECTED]> escreveu > > Pessoal, bom dia. > Estou precisando de uma ajuda, se alguém já tiver algo pronto ou souber como fazer agradeço. > Tenho uma rotina que envia e-mail com conteúdo em html através do Oracle, utilizando Java Stored Procedure. > O problema é que o body do e-mail é montado utilizando uma variável varchar2 de tamanho 32767, e, estou precisando aumentar o tamanho do body deste e-mail. Pensei em utilizar campo CLOB para a montagem do body do e-mail, mas não consegui fazer isso pois a varíavel que a Java Stored Procedure recebe como parâmetro é do tipo string. > Não consigo alterar o fonte da Java Stored Procedure por não conhecer nada de Java. > De antemão aviso que não é possível dividir o e-mail em vários. > As informações em relação a versão do Oracle e do SO estão a seguir: > > BANNER > -- > Oracle Database 10g Release 10.2.0.3.0 - 64bit Production > PL/SQL Release 10.2.0.3.0 - Production > CORE 10.2.0.3.0 Production > > TNS for Linux: Version 10.2.0.3.0 - Production > NLSRTL Version 10.2.0.3.0 - Production > > O Linux utilizado é o Red Hat EL 4. > > Segue abaixo os fontes da rotina de envio de e-mail, infelizmente não tenho os créditos de quem fez. > > Atenciosamente. > Augusto Cesar Rodovalho Costa > > > -- --- > PACKAGE em PL/SQL que executa a Java Stored Procedure > -- --- > > CREATE OR REPLACE PACKAGE SendMailJPkg AS > -- EOL is used to separate text line in the message body; > EOL CONSTANT STRING(2) := CHR(13) || CHR(10); > TYPE ATTACHMENTS_LIST IS TABLE OF VARCHAR2(4000); > -- high-level interface with collections; > PROCEDURE SendMail(SMTPServerName IN STRING > ,Sender IN STRING > ,Recipient IN STRING > ,CcRecipient IN STRING DEFAULT '' > ,BccRecipient IN STRING DEFAULT '' > ,Subject IN STRING DEFAULT '' > ,Body IN STRING DEFAULT '' > ,ErrorMessage OUT STRING, > Attachments IN ATTACHMENTS_LIST DEFAULT NULL); > > PROCEDURE SendMailHTML(SMTPServerName IN STRING > ,Sender IN STRING > ,Recipient IN STRING > ,CcRecipient IN STRING > ,BccRecipient IN STRING > ,Subject IN STRING > ,Body IN STRING > ,ErrorMessage OUT STRING); > END SendMailJPkg; > > CREATE OR REPLACE PACKAGE BODY SendMailJPkg AS > > PROCEDURE ParseAttachment(Attachments IN ATTACHMENTS_LIST > ,AttachmentList OUT VARCHAR2) > IS > AttachmentSeparator CONSTANT VARCHAR2(12) := '///'; > > BEGIN > -- boolean short-circuit is used here; > IF Attachments IS NOT NULL AND Attachments.COUNT > 0 THEN > > AttachmentList := Attachments(Attachments.FIRST); > -- scan the collection if there is more than one element. If there > -- is not, skip the next part for parsing elements 2 and above. If there > -- is, skip the first element since it has been already processed > IF Attachments.COUNT > 1 THEN > FOR I IN Attachments.NEXT(Attachments.FIRST).. Attachments.LAST LOOP > AttachmentList := AttachmentList || AttachmentSeparator || Attachments(I); > END LOOP; > ELSE > -- whe have to terminate the list with the one element with /// for the java function > AttachmentList := AttachmentList || AttachmentSeparator; > END IF; > > ELSE > AttachmentList := ''; > END IF; > > END ParseAttachment; > > -- forward declaration; > FUNCTION JSendMail(SMTPServerName IN STRING > ,Sender IN STRING > ,Recipient IN STRING > ,CcRecip
[oracle_br] Re: Enviar e-mail pelo Oracle com Conteúdo HTML
Em PL/SQL o tamanho máximo de uma string é 32767, ponto, não tem como vc aumentar. O que vc deverá fazer é RE-ESCREVER a rotina de modo a trabalhar com "pedaços" de informação, e já que vc NÃO sabe nada de java E tem bd 10g (aonde NÃO é mais necessário vc usar java pra enviar e-mail, a package UTL_MAIL substituiu isso) eu diria pra vc seguir a nota Subject: How To Send Attachments Of Size Greater Than 32 KB Using UTL_SMTP Package , Doc ID: Note:357385.1 no metalink. []s Chiappa --- Em oracle_br@yahoogrupos.com.br, "Augusto Cesar R. Costa" <[EMAIL PROTECTED]> escreveu > > Pessoal, bom dia. > Estou precisando de uma ajuda, se alguém já tiver algo pronto ou souber como fazer agradeço. > Tenho uma rotina que envia e-mail com conteúdo em html através do Oracle, utilizando Java Stored Procedure. > O problema é que o body do e-mail é montado utilizando uma variável varchar2 de tamanho 32767, e, estou precisando aumentar o tamanho do body deste e-mail. Pensei em utilizar campo CLOB para a montagem do body do e-mail, mas não consegui fazer isso pois a varíavel que a Java Stored Procedure recebe como parâmetro é do tipo string. > Não consigo alterar o fonte da Java Stored Procedure por não conhecer nada de Java. > De antemão aviso que não é possível dividir o e-mail em vários. > As informações em relação a versão do Oracle e do SO estão a seguir: > > BANNER > > Oracle Database 10g Release 10.2.0.3.0 - 64bit Production > PL/SQL Release 10.2.0.3.0 - Production > CORE 10.2.0.3.0 Production > > TNS for Linux: Version 10.2.0.3.0 - Production > NLSRTL Version 10.2.0.3.0 - Production > > O Linux utilizado é o Red Hat EL 4. > > Segue abaixo os fontes da rotina de envio de e-mail, infelizmente não tenho os créditos de quem fez. > > Atenciosamente. > Augusto Cesar Rodovalho Costa > > > --- > PACKAGE em PL/SQL que executa a Java Stored Procedure > --- > > CREATE OR REPLACE PACKAGE SendMailJPkg AS > -- EOL is used to separate text line in the message body; > EOL CONSTANT STRING(2) := CHR(13) || CHR(10); > TYPE ATTACHMENTS_LIST IS TABLE OF VARCHAR2(4000); > -- high-level interface with collections; > PROCEDURE SendMail(SMTPServerName IN STRING > ,Sender IN STRING > ,Recipient IN STRING > ,CcRecipient IN STRING DEFAULT '' > ,BccRecipient IN STRING DEFAULT '' > ,Subject IN STRING DEFAULT '' > ,Body IN STRING DEFAULT '' > ,ErrorMessage OUT STRING, > Attachments IN ATTACHMENTS_LISTDEFAULT NULL); > > PROCEDURE SendMailHTML(SMTPServerName IN STRING > ,Sender IN STRING > ,Recipient IN STRING > ,CcRecipient IN STRING > ,BccRecipient IN STRING > ,Subject IN STRING > ,Body IN STRING > ,ErrorMessage OUT STRING); > END SendMailJPkg; > > CREATE OR REPLACE PACKAGE BODY SendMailJPkg AS > > PROCEDURE ParseAttachment(Attachments IN ATTACHMENTS_LIST > ,AttachmentList OUT VARCHAR2) > IS >AttachmentSeparator CONSTANT VARCHAR2(12) := '///'; > > BEGIN >-- boolean short-circuit is used here; >IF Attachments IS NOT NULL AND Attachments.COUNT > 0 THEN > > AttachmentList := Attachments(Attachments.FIRST); > -- scan the collection if there is more than one element. If there > -- is not, skip the next part for parsing elements 2 and above. If there > -- is, skip the first element since it has been already processed > IF Attachments.COUNT > 1 THEN > FOR I IN Attachments.NEXT(Attachments.FIRST).. Attachments.LAST LOOP > AttachmentList := AttachmentList || AttachmentSeparator || Attachments(I); > END LOOP; > ELSE > -- whe have to terminate the list with the one element with /// for the java function > AttachmentList := AttachmentList || AttachmentSeparator; > END IF; > >ELSE >AttachmentList := ''; >END IF; > > END ParseAttachment; > > -- forward declaration; > FUNCTION JSendMail(SMTPServerName IN STRING > ,Sender IN STRING > ,Recipient IN STRING > ,CcRecipient IN STRING > ,BccRecipient IN STRING > ,Subject IN STRING > ,Body IN STRING > ,ErrorMessage OUT STRING > ,Attachments IN STRING) > RETURN NUMBER; > > -- high-level interface with collections; > PROCEDURE SendMail(SMTPServerName IN STRING > ,Sender IN ST