Pular para o conteúdo
Visualizando 2 posts - 1 até 2 (de 2 do total)
  • Autor
    Posts
  • #79906
    Phricioli
    Participante

      😥

      Pessoal , preciso de uma ajuda preciso enviar email pelo Oracle com anexo, buscando em um diretório Windows, até ai tudo bem…
      O problema que ao rodar a procedure caso o anexo seja maior que 1mb acontece o erro.ja tentei com o UTL_MAIL.Send_Attach_Varchar etc
      Alguém poderia me dar uma dica ? Arquivos pequenos são enviados normalmente como anexo..
      Fico no aguardo dos companheiros..

      ORA-06502: PL/SQL: numeric or value error: raw variable length too long
      ORA-06512: at “SYS.UTL_ENCODE”, line 243
      ORA-06512: at “SYS.UTL_MAIL”, line 133
      ORA-06512: at “SYS.UTL_MAIL”, line 576
      ORA-06512: at “SYS.UTL_MAIL”, line 666
      ORA-06512: at “ATOPROT.ENVIA_MAIL”, line 16
      ORA-06512: at line 1

      CREATE OR REPLACE function envia_mail( pRemetente in VarChar2,
      pDestinatario in VarChar2,
      pArquivo in VarChar2,
      pAssunto in VarChar2,
      pTexto in VarChar2,
      pCcopia in VarChar2 default null )
      Return Integer
      Is
      fHandle UTL_FILE.FILE_TYPE ;
      rConteudo RAW( 32767 ) ;
      Begin
      — Abre o arquivo para leitura em bytes -> ‘rb’
      fHandle := UTL_FILE.FOpen( ‘diremail’ , pArquivo, ‘rb’ ) ;
      UTL_FILE.Get_Raw( fHandle, rConteudo ) ;
      UTL_FILE.FClose( fHandle ) ;
      UTL_MAIL.Send_Attach_Raw(
      sender => pRemetente,
      recipients => pDestinatario,
      cc => pCcopia,
      subject => pAssunto,
      message => pTexto,
      attachment => rConteudo,
      att_filename => pArquivo
      ) ;
      Return( 1 ) ;
      –Exception
      — When Others Then
      — Raise_Application_Error( -20101, ‘Arquivo Invalido, ou nao existe.’ ) ;
      End ;
      /

      #79913
      DanielB
      Participante

        SymptomsIf the size of the attachment using UTL_MAIL.SEND_ATTACH_RAW exceeding 32767 Bytes it gives the following errors:

        ORA-06525: Length Mismatch for CHAR or RAW data
        ORA-06512: at “SYS.UTL_FILE”, line 119
        ORA-06512: at “SYS.UTL_FILE”, line 1100
        ORA-06512: at “PACKAGE.PROCEDURE”, line 15
        ORA-06512: at line 1

        When using UTL_MAIL.SEND_ATTACH_RAW with attaching a file which is less than 32767 bytes, it sends the mail successfully.

        Cause
        UTL_MAIL.SEND_ATTACH_RAW requires a RAW as a parameter. Maximum size for RAW is 32K.

        Solution
        Use UTL_SMTP to utilize attachments larger then 32K

      Visualizando 2 posts - 1 até 2 (de 2 do total)
      • Você deve fazer login para responder a este tópico.
      plugins premium WordPress