DBAsupport.com Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: ORA-20002: 501 Bad syntax error

  1. #1
    Join Date
    Apr 2003
    Posts
    2

    ORA-20002: 501 Bad syntax error

    Hi,

    I intend to send a simple smtp mail using the builtin UTL_SMTP package.

    But i get the following error:-
    ORA-20002: 501 Bad syntax error

    Here is my code:-
    CREATE OR REPLACE PROCEDURE mail
    IS
    BEGIN
    DECLARE
    v_connection UTL_SMTP.CONNECTION;

    BEGIN v_connection := UTL_SMTP.OPEN_CONNECTION(,25);
    dbms_output.put_line('Connection Opened');

    UTL_SMTP.HELO(v_connection,);
    dbms_output.put_line('After calling helo');

    UTL_SMTP.MAIL(v_connection,'test@myhost.com');
    dbms_output.put_line('Sender set');

    UTL_SMTP.RCPT(v_connection,'test1@myhost.com');
    dbms_output.put_line('Recipient Set');

    UTL_SMTP.DATA(v_connection,'Sent From PL/SQL');
    dbms_output.put_line('Message body set');

    UTL_SMTP.QUIT(v_connection);
    dbms_output.put_line('Connection Closed');
    end;
    END;
    /

    Here is the output:-

    SQL> exec mail
    Connection Opened
    After calling helo
    BEGIN mail; END;

    *
    ERROR at line 1:
    ORA-20002: 501 Bad address syntax
    ORA-06512: at "SYS.UTL_SMTP", line 86
    ORA-06512: at "SYS.UTL_SMTP", line 204
    ORA-06512: at "ADMIN.MAIL", line 13
    ORA-06512: at line 1


    I tried sending mails to my smtp server via java mailing API and i am
    successful. So i am wondering wat i am doing wrong up there in Oracle.
    I have JServer enabled, i also ran the initplsj.sql successfully.

    Please help.
    Regards,
    Leo.

  2. #2
    Join Date
    Jan 2003
    Location
    Hull, UK
    Posts
    220
    Hi,

    I think one cant give....mytest@host.com

    Pl. try to give a valid address and see if it works.

    HTH

    Cheers
    SS

  3. #3
    Join Date
    Mar 2001
    Location
    Reading, U.K
    Posts
    598
    hi,
    check this part
    1)
    v_connection := UTL_SMTP.OPEN_CONNECTION('this is emptyinur code',25);

    2)
    UTL_SMTP.HELO(v_connection,'this is emptyinur code');

    Cheers!
    Cheers!
    OraKid.

  4. #4
    Join Date
    Mar 2001
    Location
    Reading, U.K
    Posts
    598
    oh! huh! i though its as compilation error...
    sorry guys
    Cheers!
    Cheers!
    OraKid.

  5. #5
    Join Date
    Apr 2003
    Posts
    2
    check this part
    1)
    v_connection := UTL_SMTP.OPEN_CONNECTION('this is emptyinur code',25);

    2)
    UTL_SMTP.HELO(v_connection,'this is emptyinur code');

    >>> already had checked with bogus smtp host - i got expected error - Service not available


    I think one cant give....mytest@host.com

    Pl. try to give a valid address and see if it works.

    >>> i gave actual valid e mail id's, accounts for which exist. didnt post them here cz they belong to actual live people

  6. #6
    Join Date
    Jan 2003
    Location
    Hull, UK
    Posts
    220
    Hi,

    Just try this,,,

    $ORACLE_HOME/javavm/install/initjvm.sql $ORACLE_HOME/javavm/install/init_security.sql
    $ORACLE_HOME/rdbms/admin/initplsj.sql

    just in case if all the java classes havent been loaded properly.

    HTH

    SS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width