Plsql - utl_tcp

hi,
I have a utl_tcp.connection.
When I create it (I call the open_connection function) I can define the timeout parameter.
I want to change the timeout parameter before each read.
How can I do that?
thanks.

<pre>
CREATE OR REPLACE PROCEDURE email(p_target IN VARCHAR2,
p_subj IN VARCHAR2,
p_message IN VARCHAR2) IS
v_eol VARCHAR2(2) := chr(13)||chr(10); -- EOL CHARACTERS
v_sender VARCHAR2(50) := '[email protected]';
mailhost VARCHAR2(35) := 'mail.vicisoft.com';
mail_connection utl_smtp.connection;
BEGIN
mail_connection := utl_smtp.open_connection(mailhost,25);
utl_smtp.helo(mail_connection,mailhost);
utl_smtp.mail(mail_connection,v_sender);
utl_smtp.rcpt(mail_connection,p_target);
utl_smtp.Data(mail_connection,'From:'||v_sender||v_eol||'To:'||p_target||V_Eol||'Subject:'
||p_subj||v_eol||v_eol||p_message||v_eol);
utl_smtp.quit(mail_connection);
EXCEPTION
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20002,'ERROR IN EMAIL => '||SQLCODE||':
'||SQLERRM);
END;
</pre>
Regards
Alok Dubey

Similar Messages

  • Simple -ERR from plsql using utl_tcp

    1  CREATE OR REPLACE PROCEDURE SEND_MAIL (
    2    msg_from    varchar2 := 'oracle',
    3    msg_to      varchar2,
    4    msg_subject varchar2 := 'E-Mail message from your database',
    5    msg_text    varchar2 := '' )
    6  IS
    7    c  utl_tcp.connection;
    8    rc integer;
    9  BEGIN
    10    c := utl_tcp.open_connection('192.168.0.150',110);       -- open the SMTP port 25 on local ma
    11    dbms_output.put_line(utl_tcp.get_line(c, TRUE));
    12    rc := utl_tcp.write_line(c, 'HELO localhost');
    13    dbms_output.put_line(utl_tcp.get_line(c, TRUE));
    14    rc := utl_tcp.write_line(c, 'MAIL FROM: '||msg_from);
    15    dbms_output.put_line(utl_tcp.get_line(c, TRUE));
    16    rc := utl_tcp.write_line(c, 'RCPT TO: '||msg_to);
    17    dbms_output.put_line(utl_tcp.get_line(c, TRUE));
    18    rc := utl_tcp.write_line(c, 'DATA');                 -- Start message body
    19    dbms_output.put_line(utl_tcp.get_line(c, TRUE));
    20    rc := utl_tcp.write_line(c, 'Subject: '||msg_subject);
    21    rc := utl_tcp.write_line(c, '');
    22    rc := utl_tcp.write_line(c, msg_text);
    23    rc := utl_tcp.write_line(c, '.');                    -- End of message body
    24    dbms_output.put_line(utl_tcp.get_line(c, TRUE));
    25    rc := utl_tcp.write_line(c, 'QUIT');
    26    dbms_output.put_line(utl_tcp.get_line(c, TRUE));
    27    utl_tcp.close_connection(c);                         -- Close the connection
    28  EXCEPTION
    29    when others then
    30         raise_application_error(
    31             -20000, 'Unable to send e-mail message from pl/sql because of: '||
    32             sqlerrm);
    33* END;
    QL> exec send_mail(msg_to =>'[email protected]',-
                       msg_text =>'Hi, this is a sample message for checking plsql program'-
    OK Lotus Notes POP3 server version Release 8.0 ready on Corporate/XXX.
    [b]ERR Unknown command: "HELO"
    ERR Unknown command: "MAIL"
    ERR Unknown command: "RCPT"
    ERR Unknown command: "DATA"
    ERR Unknown command: "Subject:"
    ERR Unknown command: "Hi,"
    L/SQL procedure successfully completed.Hi,
    I'm try to run plsql program for sending email through it, And this coding is copied from orafaq, than i replace my smtp port address, but i face this error, please givwe me suggestion.
    version: oracle 8i
    O.S: Win xp
    venki

    <pre>
    CREATE OR REPLACE PROCEDURE email(p_target IN VARCHAR2,
    p_subj IN VARCHAR2,
    p_message IN VARCHAR2) IS
    v_eol VARCHAR2(2) := chr(13)||chr(10); -- EOL CHARACTERS
    v_sender VARCHAR2(50) := '[email protected]';
    mailhost VARCHAR2(35) := 'mail.vicisoft.com';
    mail_connection utl_smtp.connection;
    BEGIN
    mail_connection := utl_smtp.open_connection(mailhost,25);
    utl_smtp.helo(mail_connection,mailhost);
    utl_smtp.mail(mail_connection,v_sender);
    utl_smtp.rcpt(mail_connection,p_target);
    utl_smtp.Data(mail_connection,'From:'||v_sender||v_eol||'To:'||p_target||V_Eol||'Subject:'
    ||p_subj||v_eol||v_eol||p_message||v_eol);
    utl_smtp.quit(mail_connection);
    EXCEPTION
    WHEN OTHERS THEN
    RAISE_APPLICATION_ERROR(-20002,'ERROR IN EMAIL => '||SQLCODE||':
    '||SQLERRM);
    END;
    </pre>
    Regards
    Alok Dubey

  • Plsql - set a timeout on utl_tcp connection

    hi,
    I have a utl_tcp connection and I want to define the timeout parameter before each read.
    How? thanks...

    UTL_TCP pretty much runs directly on the standards sockets interface. It does very little to no additional abstraction, or inserting additional management/state code in between you the caller, and the sockets interface. So it is pretty much standard (client) tcp socket programming as far as using UTL_TCP is concerned.
    How are you making the write message socket calls via UTL_TCP ?
    You will only "immediately" see a connection error on socket write when it is done in blocking mode - and "immediately" can mean several minutes of waiting for that blocking call to complete and return an error using the native socket interface.
    Note that the A side will only know that the B side is gone when the B side sends a tcp packet with the FIN bit set in the header. As the B side crashes, that does not happen. So the protocol stack on A still believes (quite correctly) that the B side is still there. The A side needs to actively use the connection and send something to the B side in order to determine the B side is gone. And the speed of this "failure" is pretty much dependent on the infrastructure in-between and the time it takes for that tcp packet to die and the A side protocol stack receiving a RST telling it to reset its connection as it failed.
    tcp was designed to be very robust. It does not simply throw in the towel.. {noformat} ;-) {noformat}

  • Sending Email from PLSql Oracle 8.0.6

    Has anyone got any ideas or achieved this: Sending Email from PLSql for Oracle version 8.0.6 using the limited technology support in this version, i.e. UTL_SMTP & UTL_TCP are not supported.
    Any help will be greatly appreciated.

    Sending Email from PLSql for Oracle version 8.0.6 using the limited technology
    support in this version, i.e. UTL_SMTP & UTL_TCP are not supported.That's because they use Java and Java doesn't work with versions older than 8i. Does 8.0 support external procedures (I went straight from 7.3.4 to 8.1.6)? If so you might be able to cobble together some C to interface with smtp on the OS. Otherwise I think you're looking at writing some client-side application to do this.
    Cheers, APC

  • Write to word document from oracle plsql

    Hi,
    Please provide methods to create and write to a word document from ORACLE PLSQL.We tried using UTL FILE package but it writes as ascii text.

    Divs wrote:
    The server m/c operating system is unix.so we need to invoke the procedure from Unix Os.In that case - not possible. For Windows COM (Component Object Model) to work, Oracle database need to be able to call and load the COM dynamic link libraries.
    Not to say that it is not possible. Have never used DCOM (the Distributed COM interface), and not exactly sure what it requires. Assuming that DCOM is not usable from a Linux perspective, you can still provide a manual interface. You create a NT tcp/ip service that exposes the COM interface calls that you need - in a secure fashion (even better - you can provide a higher level abstraction layer for the COM interface that does the specific job you need to be done).
    From Oracle you can then use PL/SQL's UTL_TCP package to open a connection to it and via this service craft a Word document on that Windows server.
    Are there web services for MS Office? I know Google is pushing that aspect hard (and embroiled in lawsuits with the US government and Microsoft about tender awards in this aspect). Now if Microsoft has "+office-on-the-web+", then one can create a Word document via a web browser. This means that there is an underlying web service - and that this can be called and used. The Evolution (Open Source Mail Reader) project for example uses the MS Exchange web service interface to provide a seamless interface to Exchange mail accounts (have used this everyday for a number of years now).
    The real question I would however ask is why Word specifically? Why not a more common format like PDF? You can even consider generating XML instead. Both Microsoft and Open Office and others are supporting XML formatted word processing documents (as oppose to older proprietary and binary formats).
    And why not use a Report Writer? I'm a big fan of doing as much as possible in Oracle (using PL/SQL most of the time). But certain things, like generating Word-style documents would be better done (and more flexible too) using a Report Writer.

  • Oracle PLSQL Send mail Issue.

    Hi All,
    I used to send some emails using oracle PLSQL code in both 10 g and 11g.But now days mail is getting triggered without any body in both the 10g and 11g versions.
    Some mails are triggering perfectly.I am unable to sort out the issue, please help me in this concern.

    Code that i have used is:
    create or replace
    PROCEDURE Sendmail(V_MAILHOST VARCHAR2,V_FROM VARCHAR2,V_TO clob ,V_CC VARCHAR2, V_SUBJECT VARCHAR2,V_MSGTEXT VARCHAR2,V_MODULE VARCHAR2) AS
      l_mail_conn   UTL_SMTP.connection;
      l_subject      VARCHAR2(100):='test mail';
      l_msg_text   VARCHAR2(500):='hi , testing alert mail';
      v_reply      utl_smtp.reply;
      L_RECIPIENTS  clob;
      l_recipients1  clob;
      V_TO1            clob;
      v_errmsg        VARCHAR2(500);
      mul_recip        NUMBER;
      mul_recip1        NUMBER;
      slen             NUMBER:=1;
      slen1             NUMBER:=1;
      V_errcode        VARCHAR2(500);
    BEGIN
      l_mail_conn:= UTL_SMTP.open_connection(v_mailhost,25);
       v_reply :=UTL_SMTP.helo(l_mail_conn, v_mailhost);
       v_reply :=UTL_SMTP.mail(l_mail_conn, v_from);
      -- V_TO1:=null;--'[email protected]';
       SELECT INSTR(V_TO,',') INTO mul_recip FROM dual;
        IF mul_recip =0
        THEN
             utl_smtp.rcpt(l_mail_conn, V_TO );
        ELSE
            WHILE(INSTR(V_TO,',',slen) > 0)
            LOOP
                  l_recipients := SUBSTR(V_TO, slen, INSTR(SUBSTR(V_TO,slen),',')-1);
                  slen := slen+INSTR(SUBSTR(V_TO, slen),',');
                utl_smtp.rcpt(l_mail_conn, l_recipients);
            END LOOP;
                l_recipients := SUBSTR(V_TO, slen);
                utl_smtp.rcpt(l_mail_conn, l_recipients);
        END IF;    
         IF V_CC IS NOT NULL
         THEN
          SELECT INSTR(V_CC,',') INTO mul_recip1 FROM dual;
        IF mul_recip1 =0
        THEN
             utl_smtp.rcpt(l_mail_conn, V_CC );
        ELSE
            WHILE(INSTR(V_CC,',',slen1) > 0)
            LOOP
                  l_recipients1 := SUBSTR(V_CC, slen1, INSTR(SUBSTR(V_CC,slen1),',')-1);
                  slen1 := slen1+INSTR(SUBSTR(V_CC, slen1),',');
                utl_smtp.rcpt(l_mail_conn, l_recipients1);
            END LOOP;
                l_recipients1 := SUBSTR(V_CC, slen1);
                utl_smtp.rcpt(l_mail_conn, l_recipients1);
        END IF;    
    END IF;        
    v_reply :=utl_smtp.open_data(l_mail_conn );
    utl_smtp.write_data(l_mail_conn, 'From: ' || V_FROM || utl_tcp.crlf);
    utl_smtp.write_data(l_mail_conn, 'Subject: ' || v_subject || utl_tcp.crlf);
    utl_smtp.write_data(l_mail_conn, 'To: ' || V_TO || utl_tcp.crlf);
    utl_smtp.write_data(l_mail_conn, 'CC: ' || V_CC || utl_tcp.crlf);
    utl_smtp.write_data(l_mail_conn, 'Content-Type: text/html' || utl_tcp.crlf);
    UTL_SMTP.WRITE_DATA(L_MAIL_CONN, V_MSGTEXT );
      if length(V_TO)>=4000 then
      dbms_output.put_line('none');
      else
       insert into MAIL_LOG(MAILFROM, MAILTO, SUBJECT, LOGGED_DATE, MAIL_STATUS, MAILCC, MAILTEXT,MODULE_ID)
          VALUES(V_FROM,v_to,V_SUBJECT,SYSDATE,'sent',V_CC,V_MSGTEXT,V_MODULE);
        end if;
        utl_smtp.close_data(l_mail_conn );
        utl_smtp.quit(l_mail_conn);
    EXCEPTION
    WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN
        BEGIN
          UTL_SMTP.QUIT(l_mail_conn);
        EXCEPTION
          WHEN UTL_SMTP.TRANSIENT_ERROR OR UTL_SMTP.PERMANENT_ERROR THEN
            NULL; -- When the SMTP server is down or unavailable, we don't have
                  -- a connection to the server. The QUIT call will raise an
                  -- exception that we can ignore.
        END;
         v_errmsg:='Failed to send mail due to the following error: ' ||SQLERRM||' errcode '||SQLCODE||'from :'||V_FROM|| ' V_TO '||V_TO;
    INSERT INTO MAIL_LOG(MAILFROM, MAILTO, SUBJECT, LOGGED_DATE, MAIL_STATUS, MAILCC, MAILTEXT,MODULE_ID)
    VALUES(V_FROM,v_to,V_SUBJECT,SYSDATE,v_errmsg,V_CC,V_MSGTEXT,V_MODULE);
    END Sendmail;

  • Validate server availability with utl_tcp

    Hi,
    I'm using plsql code to process a request and send back a valid URL (some kind of Load Balancing between two hosts). For example, one asks for an Oracle Forms Server and the database could return any of those two servers : http://host1.domain.local/forms/frmservlet?config=x and http://host2.domain.local/forms/frmservlet?config=x. The thing is I need to validate that the host is reachable before return it back to the user.
    I tried with utl_tcp.open_connection and UTL_HTTP.begin_request (which I supposed is using utl_tcp) but if a server is down the timer will expired only after 20 seconds which is way to long for the user. Is there any way in PL/SQL to open a connection and timeout after 2 or 3 seconds or to ping a server ? If not I think I'll create a JAVA class.
    Thank you
    Francis

    Well... You could have a background process that checks every second and then updates a table with a timestamp and then have the foreground process check the timestamp and if it is > some number of seconds then assume that it is not as available as you want it to be.
    But loadbalancing middlewhere by using the DB seems to be the wrong way... Doesn't Oracle Forms Server let you do a round robin loadbalancing with detecting down nodes? Or have the DNS server do it or something like that.

  • Run shell script from plsql

    You can use utl_tcp to do http posting, send email, and ftp files. Has anyone ever executed a unix shell script from plsql on a remote unix box?

    I am actually asking about running a script file on a remote machine, not on the host. A java procedure or c file extproc call could be used to call a host script file.
    A key limitation of this java procedure method is shown in the ask tom reference:
    if you can do it from sever A on the command line (outside of oracle), we can do
    it inside the database.
    Solve that problem and we'll go from there. Oracle cannot bypass the OS and do
    magical things beyond what you've set up at the OS level.
    since utl.tcp opens a tcp connection, can you open a telnet session using utl_tcp and low level command formatting? I didnt have much trouble creating a plsql based ftp client, has anyone seen a plsql based telnet client?

  • Send mail to multiple user using plsql

    Hi
    I wrote plsql block as below
    ===========
    mail_conn := UTL_SMTP.open_connection (mailhost, 25);
    UTL_SMTP.helo (mail_conn, mailhost);
    UTL_SMTP.mail (mail_conn, p_sender);
    UTL_SMTP.rcpt (mail_conn, p_recipient);
    UTL_SMTP.rcpt (mail_conn, p_cc);
    UTL_SMTP.rcpt (mail_conn, p_bcc);     
    UTL_SMTP.DATA (mail_conn,
    'From: '
    || p_sender
    || UTL_TCP.crlf
    || 'To: '
    || p_recipient
    || UTL_TCP.crlf
    || 'Cc: '
    || p_cc
    || UTL_TCP.crlf
    || 'Cc: '
    || p_bcc
    || UTL_TCP.crlf
    || 'Subject: '
    || p_subject
    || UTL_TCP.crlf
    || p_message
    UTL_SMTP.quit (mail_conn);
    ==========
    when I pass single-single user id in To,From,CC,Bcc mail goes through. But when I have multiple emaild mail doesn't go through.
    How do I fix this?
    second problem is when I don't provide Bcc or provide Bcc value null even single email ids mail doesn't go.
    I can have some id as bcc for workaround but first issue is blocking me.
    Any help appreciated.
    Thanks
    Ajay

    CREATE OR REPLACE TRIGGER EmailOnServerErr AFTER SERVERERROR ON DATABASE
    DECLARE
       mail_conn       UTL_SMTP.connection;
       crlf            VARCHAR2(2) := chr(13)||chr(10);
       msg             VARCHAR2(32760);
       sid_name        VARCHAR2(16);
       bdump_dest      VARCHAR2(128);
       smtp_relay      VARCHAR2(32) := 'MyMailRelay';
       recipient_address  VARCHAR2(64) := '[email protected]';
       sender_address     VARCHAR2(64) := '[email protected]';
       mail_port       NUMBER := 25;
       log_file_handle UTL_FILE.FILE_TYPE;
       log_file_dir    VARCHAR2(256) := 'ERR_LOG_DIR';
       log_file_name   VARCHAR2(256) := 'OracleErrors.log';
       maxlinesize     NUMBER := 32767;
       session_rec     sys.v_$session%ROWTYPE;
       audit_rec       sys.dba_audit_trail%ROWTYPE;
       auditing        BOOLEAN;
       LinesOfSQL      BINARY_INTEGER;
       offending_sql   DBMS_STANDARD.ora_name_list_t;
       CURSOR bdump_cur IS
          SELECT TRIM(value)
          FROM v$parameter
          WHERE name = 'background_dump_dest'
       CURSOR sid_cur IS
          SELECT TRIM(instance_name)
          FROM v$instance
       CURSOR session_cur IS
          SELECT s.*
          FROM v$session s
          WHERE s.sid = dbms_support.mysid
       CURSOR audit_trail_cur(AUDSID IN NUMBER) IS
          SELECT *
          FROM dba_audit_trail
          WHERE sessionid = AUDSID
    BEGIN
       IF (USER = 'SYSTEM' OR USER = 'SYS') THEN
          -- Ignore this error
          NULL;
       ELSIF IS_SERVERERROR (1034) THEN
          -- Ignore this error
          NULL;
       ELSE
          -- get the sid
          OPEN sid_cur;
          FETCH sid_cur INTO sid_name;
          CLOSE sid_cur;
          -- get the location of the alert log
          OPEN bdump_cur;
          FETCH bdump_cur INTO bdump_dest;
          CLOSE bdump_cur;
          -- get the session information
          OPEN session_cur;
          FETCH session_cur INTO session_rec;
          CLOSE session_cur;
          -- get the audit_trail information if it exists
          OPEN audit_trail_cur(session_rec.audsid);
          FETCH audit_trail_cur INTO audit_rec;
          auditing := audit_trail_cur%FOUND;
          CLOSE audit_trail_cur;
          IF session_rec.program = 'MyProgram.exe' THEN
             NULL;  -- ignore actions from MyProgram - that's where I do maintenance
          ELSE
             -- compose the message
             msg := 'Subject: Oracle error '||' on '||sid_name||crlf;
             msg := msg||'To: '||recipient_address||crlf;
             msg := msg||'For more information see the alert log file located at:'||crlf;
             msg := msg||bdump_dest||'/alert_'||sid_name||'.log'||crlf;
             msg := msg||'or the error log file: $'||log_file_dir||'/'||log_file_name||crlf;
             msg := msg||'Error Time='||TO_CHAR(SYSDATE,'DD-Mon-YYYY HH24:MI:SS')||crlf;
             msg := msg||DBMS_UTILITY.FORMAT_CALL_STACK||crlf;
             LinesOfSQL := sql_txt(offending_sql);
             msg := msg||'Offending SQL is:'||crlf;
             FOR loop_counter IN offending_sql.FIRST..offending_sql.LAST
             LOOP
                msg := msg||offending_sql(loop_counter);
             END LOOP;
             msg := msg||crlf||'----- PL/SQL Error Stack -----'||crlf;
             msg := msg||DBMS_UTILITY.FORMAT_ERROR_STACK||crlf;
             msg := msg||'V$SESSION.SADDR='   ||session_rec.saddr   ||crlf;
             msg := msg||'V$SESSION.SID='     ||session_rec.sid     ||crlf;
             msg := msg||'V$SESSION.SERIAL#=' ||session_rec.serial# ||crlf;
             msg := msg||'V$SESSION.AUDSID='  ||session_rec.audsid  ||crlf;
             msg := msg||'V$SESSION.PADDR='   ||session_rec.paddr   ||crlf;
             msg := msg||'V$SESSION.USER#='   ||session_rec.user#   ||crlf;
             msg := msg||'V$SESSION.USERNAME='||session_rec.username||crlf;
             msg := msg||'V$SESSION.COMMAND=' ||session_rec.command ||crlf;
             msg := msg||'V$SESSION.OWNERID=' ||session_rec.ownerid ||crlf;
             msg := msg||'V$SESSION.TADDR='   ||NVL(session_rec.taddr   ,'Null')||crlf;
             msg := msg||'V$SESSION.LOCKWAIT='||NVL(session_rec.lockwait,'Null')||crlf;
             msg := msg||'V$SESSION.STATUS='  ||NVL(session_rec.status  ,'Null')||crlf;
             msg := msg||'V$SESSION.SERVER='  ||NVL(session_rec.server  ,'Null')||crlf;
             msg := msg||'V$SESSION.SCHEMA#=' ||session_rec.schema#||crlf;
             msg := msg||'V$SESSION.SCHEMANAME=' ||NVL(session_rec.schemaname,'Null')||crlf;
             msg := msg||'V$SESSION.OSUSER='     ||NVL(session_rec.osuser    ,'Null')||crlf;
             msg := msg||'V$SESSION.PROCESS='    ||NVL(session_rec.process   ,'Null')||crlf;
             msg := msg||'V$SESSION.MACHINE='    ||NVL(session_rec.machine   ,'Null')||crlf;
             msg := msg||'V$SESSION.TERMINAL='   ||NVL(session_rec.terminal  ,'Null')||crlf;
             msg := msg||'V$SESSION.PROGRAM='    ||NVL(session_rec.program   ,'Null')||crlf;
             msg := msg||'V$SESSION.TYPE='       ||NVL(session_rec.type      ,'Null')||crlf;
             msg := msg||'V$SESSION.SQL_ADDRESS='    ||session_rec.sql_address  ||crlf;
             msg := msg||'V$SESSION.SQL_HASH_VALUE=' ||NVL(TO_CHAR(session_rec.sql_hash_value) ,'Null')||crlf;
             msg := msg||'V$SESSION.PREV_SQL_ADDR='  ||session_rec.prev_sql_addr||crlf;
             msg := msg||'V$SESSION.PREV_HASH_VALUE='||NVL(TO_CHAR(session_rec.prev_hash_value),'Null')||crlf;
             msg := msg||'V$SESSION.MODULE='     ||NVL(session_rec.module              ,'Null')||crlf;
             msg := msg||'V$SESSION.MODULE_HASH='||NVL(TO_CHAR(session_rec.module_hash),'Null')||crlf;
             msg := msg||'V$SESSION.ACTION='     ||NVL(session_rec.action              ,'Null')||crlf;
             msg := msg||'V$SESSION.ACTION_HASH='||NVL(TO_CHAR(session_rec.action_hash),'Null')||crlf;
             msg := msg||'V$SESSION.CLIENT_INFO='||NVL(session_rec.client_info         ,'Null')||crlf;
             msg := msg||'V$SESSION.FIXED_TABLE_SEQUENCE='||NVL(TO_CHAR(session_rec.fixed_table_sequence),'Null')||crlf;
             msg := msg||'V$SESSION.ROW_WAIT_OBJ#='  ||NVL(TO_CHAR(session_rec.row_wait_obj#)  ,'Null')||crlf;
             msg := msg||'V$SESSION.ROW_WAIT_FILE#=' ||NVL(TO_CHAR(session_rec.row_wait_file#) ,'Null')||crlf;
             msg := msg||'V$SESSION.ROW_WAIT_BLOCK#='||NVL(TO_CHAR(session_rec.row_wait_block#),'Null')||crlf;
             msg := msg||'V$SESSION.ROW_WAIT_ROW#='  ||NVL(TO_CHAR(session_rec.row_wait_row#)  ,'Null')||crlf;
             msg := msg||'V$SESSION.LOGON_TIME='     ||NVL(TO_CHAR(session_rec.logon_time,'DD-Mon-YYYY HH24:MI:SS'),'Null')||crlf;
             msg := msg||'V$SESSION.LAST_CALL_ET='   ||NVL(TO_CHAR(session_rec.last_call_et)   ,'Null')||crlf;
             msg := msg||'V$SESSION.PDML_ENABLED='   ||NVL(session_rec.pdml_enabled   ,'Null')||crlf;
             msg := msg||'V$SESSION.FAILOVER_TYPE='  ||NVL(session_rec.failover_type  ,'Null')||crlf;
             msg := msg||'V$SESSION.FAILOVER_METHOD='||NVL(session_rec.failover_method,'Null')||crlf;
             msg := msg||'V$SESSION.FAILED_OVER='    ||NVL(session_rec.failed_over    ,'Null')||crlf;
             msg := msg||'V$SESSION.RESOURCE_CONSUMER_GROUP='||NVL(session_rec.resource_consumer_group,'Null')||crlf;
             msg := msg||'V$SESSION.PDML_STATUS='    ||NVL(session_rec.pdml_status    ,'Null')||crlf;
             msg := msg||'V$SESSION.PDDL_STATUS='    ||NVL(session_rec.pddl_status    ,'Null')||crlf;
             msg := msg||'V$SESSION.PQ_STATUS='      ||NVL(session_rec.pq_status      ,'Null')||crlf;
             IF auditing THEN
                msg := msg||'DBA_AUDIT_TRAIL.OS_USERNAME='  ||NVL(audit_rec.os_username,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.USERNAME='     ||NVL(audit_rec.username   ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.USERHOST='     ||NVL(audit_rec.userhost   ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.TERMINAL='     ||NVL(audit_rec.terminal   ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.TIMESTAMP='    ||TO_CHAR(audit_rec.timestamp,'DD-Mon-YYYY HH24:MI:SS')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.OWNER='        ||NVL(audit_rec.owner      ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.OBJ_NAME='     ||NVL(audit_rec.obj_name   ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.ACTION='       ||audit_rec.action   ||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.ACTION_NAME='  ||NVL(audit_rec.action_name   ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.NEW_OWNER='    ||NVL(audit_rec.new_owner     ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.NEW_NAME='     ||NVL(audit_rec.new_name      ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.OBJ_PRIVILEGE='||NVL(audit_rec.obj_privilege ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.SYS_PRIVILEGE='||NVL(audit_rec.sys_privilege ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.ADMIN_OPTION=' ||NVL(audit_rec.admin_option  ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.GRANTEE='      ||NVL(audit_rec.grantee       ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.AUDIT_OPTION=' ||NVL(audit_rec.audit_option  ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.SES_ACTIONS='  ||NVL(audit_rec.ses_actions   ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.LOGOFF_TIME='  ||NVL(TO_CHAR(audit_rec.logoff_time)  ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.LOGOFF_LREAD=' ||NVL(TO_CHAR(audit_rec.logoff_lread) ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.LOGOFF_PREAD=' ||NVL(TO_CHAR(audit_rec.logoff_pread) ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.LOGOFF_LWRITE='||NVL(TO_CHAR(audit_rec.logoff_lwrite),'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.LOGOFF_DLOCK=' ||NVL(audit_rec.logoff_dlock  ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.COMMENT_TEXT=' ||NVL(audit_rec.comment_text  ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.SESSIONID='    ||audit_rec.sessionid   ||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.ENTRYID='      ||audit_rec.entryid     ||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.STATEMENTID='  ||audit_rec.statementid ||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.RETURNCODE='   ||audit_rec.returncode  ||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.PRIV_USED='    ||NVL(audit_rec.priv_used,'Null')||crlf;
             END IF;
             msg := msg||'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-'||crlf||crlf;
             -- write the message to the error log file
             log_file_handle := UTL_FILE.FOPEN (log_file_dir, log_file_name, 'A',maxlinesize);
             UTL_FILE.PUT_LINE(log_file_handle,msg);
             UTL_FILE.FCLOSE(log_file_handle);
             -- send the message by Email
             mail_conn := UTL_SMTP.open_connection(smtp_relay, mail_port);
             UTL_SMTP.HELO(mail_conn, smtp_relay);
             UTL_SMTP.MAIL(mail_conn, sender_address);
             UTL_SMTP.RCPT(mail_conn, recipient_address);
             UTL_SMTP.DATA(mail_conn, msg);
             UTL_SMTP.QUIT(mail_conn);
          END IF; -- client_program = MyProgram.exe
       END IF;
    END;
    /

  • Calling Corba Java from PLSQL

    Hi,
    My question is about calling java functions from PLSQL. What we have is in-house developed java classes registered at the TAO CORBA service on Unix platform. We developed a PLSQL package that calls other PLSQL functions and procedures without problem. We also need to call Java functions registered at the CORBA service. I know that calling standard Java functions is not problem via loading with loadjava and publishing as PLSQL procedure and functions. However, I found that CORBA is no longer supported starting from Oracle 9g r2. Still, I wonder wether there is a way to call these java functions registered at CORBA without loading and publishing? Any help will be greatly appreciated.
    Thanx in advance,
    Sincerely,
    Asaf
    Software Architect

    Hi,
    I would just like to mention that we decided to utilize TCP sockets in PLSQL utilizing the UTL_TCP package. Socket interface is also implemented at the Java module and hence we can call the related the interface functions via UTL_TCP socket interface. I hope this might help those who face a similar problem.
    Sincerely
    Asaf

  • Error while trying to access a SSWA PLSQL function

    Hi,
    I am trying to access a report as a web page by defining the function as follows :
    Type : SSWA PLSQL FUNCTION
    HTML Call : OracleOASIS.RunReport
    Parameters : report=EMPDET
    This function is attached to the menu and when I try to access the page I get this error.
    "Error: The requested URL was not found, or cannot be served at this time.
    Incorrect usage."
    The URL that shows in the page is as follows(<server:port> I removed the server name and port) :
    http://<server:port>/dev60cgi/rwcgi60?GDEV_APPS+DESFORMAT=HTML+SERVER=GDEV_APPS+report=EMPDET+p_session_id=A9C71A70B9B1D9BD2DCC0FC3AF9BC324+p_user_id=1133+p_responsibility_id=50230+p_application_id=800+p_security_group_id=0+p_language_code=US+NLS_LANG=AMERICAN_AMERICA+NLS_DATE_FORMAT=DD-MON-RRRR+NLS_NUMERIC_CHARACTERS=.%2C+NLS_DATE_LANGUAGE=AMERICAN+NLS_SORT=BINARY+paramform=NO
    Surprisingly other functions which are defined in this manner work fine. Do I need to register my report anywhere or are there any other settings I need to do for the report to show up.
    Can someone let me know.
    Thanks

    Hi ;
    pelase check below which could be similar error like yours
    Troubleshooting of Runtime Errors of Customer Intelligence Reports [ID 284829.1]
    Regard
    Helios

  • Error while consuming PLSQL Webservice through BPEL

    HI ,
    I have created a simple PLSQL Web service called "HelloWorld" and it got successfully deployed .
    When I tried to test this webservice through BPEL Process Manager , its showing me error everytime that ( Could not create object of class 'dimple.HelloWorldWebServiceUser'; nested exception is: java.lang.ClassNotFoundException: dimple.HelloWorldWebServiceUser</summary> ) .
    Please anyone help me out with this problem .
    Thanks
    Prashant Dwivedi

    HI ,
    I have created a simple PLSQL Web service called "HelloWorld" and it got successfully deployed .
    When I tried to test this webservice through BPEL Process Manager , its showing me error everytime that ( Could not create object of class 'dimple.HelloWorldWebServiceUser'; nested exception is: java.lang.ClassNotFoundException: dimple.HelloWorldWebServiceUser</summary> ) .
    Please anyone help me out with this problem .
    Thanks
    Prashant Dwivedi

  • The simplest way for plsql procedure to return multiple rows

    Hi,
    What is the simplest way for plsql procedure to return multiple rows (records). There are many combination of ways to do it but I am looking for a solution that is appropriate for plsql beginners. Many solutions use cursors, cursor variables, collections and more that kind of things that are complex on the face of it. Is it somehow possible to achieve the same with less effort?
    Sample query would be: SELECT * FROM EMPLOYEES;
    I want to use returned rows in APEX to compose APEX SQL(in that context plsql) report.
    It is enough to use just SELECT * FROM EMPLOYEES query in APEX but I want to use plsql procedure for that.
    Thank you!

    Hi,
    It depends :-).
    With +...that is appropriate for plsql beginners...+ in mind... it still depends!
    The list of techniques (ref cursors, cursor variables, collections, arrays, using explict SQL) you have referenced in your post can be made to work. but...
    +Is it somehow possible to achieve the same with less effort?+ Less effort : That needs to be defined (measured). Especially in the context of pl/sql beginners (who is a beginner?) .
    What is the level of "programming experience" ?
    What is the level of understanding of "Relational Result set" as processible in Oracle?
    If you are looking for
    Process_the_set_of rows_in APEX () kind of capabilitywhich "abstracts/hides" relation database from developers when working on relation database, it may not be the best approach (at least strategically). Because I believe it already is abstracted enough.
    I find REF CUROSOR most effective for such use, when the "begginer" has basic understanding of processing SQL result set .
    So in a nut shell, the techniques (that you already are familiar with) are the tools available. I am not aware of any alternative tools (in pure Oracle) that will simplify / hide basics from develpers.
    vr,
    Sudhakar B.

  • Generate Query in PLSQL to return Well Formed XML with Multiple records

    Hi there
    This is very urgent. I am trying to create a PLSQL query that should retrieve all records from oracle database table "tbl_Emp" in a well formed xml format. The format is given below
    *<Employees xmlns="http://App.Schemas.Employees" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">*
    *<Employee>*
    *<First_Name></First_Name>*
    *<Last_Name></Last_Name>*
    *</Employee>*
    *<Employee>*
    *<First_Name></First_Name>*
    *<Last_Name></Last_Name>*
    *</Employee>*
    *</Employees>*
    To retrieve data in above format, I have been trying to create a query for long time as below
    SELECT XMLElement("Employees",
    XMLAttributes('http://App.Schemas.Employees' AS "xmlns",
    *'http://www.w3.org/2001/XMLSchema-instance' AS "xmlns:xsi"),*
    XMLElement("Employee", XMLForest(First_Name, Last_Name)))
    AS "RESULT"
    FROM tbl_Emp;
    But it does not give me the required output. It creates <Employees> tag with each individual record which I don't need. I need <Employees> tag to be the root tag and <Employee> tag to repeat and wrap each individual record. Please help me in this as this is very urgent. Thanks.

    Hi,
    Please remember that nothing is "urgent" here, and repeating that it is will likely produce the opposite effect.
    If you need a quick answer, provide all necessary details in the first place :
    - db version
    - test case with sample data and DDL
    That being said, this one's easy, you have to aggregate using XMLAgg :
    SELECT XMLElement("Employees"
           , XMLAttributes(
               'http://App.Schemas.Employees' AS "xmlns"
             , 'http://www.w3.org/2001/XMLSchema-instance' AS "xmlns:xsi"
           , XMLAgg(
               XMLElement("Employee"
               , XMLForest(
                   e.first_name as "First_Name"
                 , e.last_name  as "Last_Name"
           ) AS "RESULT"
    FROM hr.employees e
    ;

  • Business Event not triggering the PLSQL procedure.. What to do?

    We need to call a plsql procedure when the GL Approval workflow has ended with approval. I thought i could do this by customizing the relevant business event.
    We are on EBS 12.1.3 with RDBMS : 11.2.0.3.0.
    I saw that the business event oracle.apps.gl.Journals.journal.approve was disabled currently. I enabled it and created a subscription for it. Subscription was a PLSQL procedure. Currently, for test purpose only thing it is doing is to insert a row into a table.
    Business Event Subscription settings:
    System: ORDEBS.SYSTEM.COM
    Triggering Event
    Source Type:Local
    Event Filter: oracle.apps.gl.Journals.journal.approve
    Execution Condition
    Phase: 100
    Status: Enabled
    Rule Data: Message
    Action Type:Custom
    On Error: Stop and Rollback
    Action
    PL/SQL Rule Function: XX_GL_APPROVE_BE_PKG.Get_Attributes
    Priority: Normal
    Documentation (Not sure what value to be given for these. I went with the below values.)
    Owner: Company Name
    Owner Tag: Custom Schema
    Using the below query i can see that the business event is getting called when the approval happens (One row added each time approval happened). But I cant see any rows in the table where it should insert a row. What could be going wrong? How can i verify that the procedure has been called?
    select * from WF_DEFERRED where corrid ='APPS:oracle.apps.gl.Journals.journal.approve'
    Procedure:
    CREATE OR REPLACE PACKAGE BODY APPS.XX_GL_APPROVE_BE_PKG
    AS
    PROCEDURE Get_Attributes
    IS
    BEGIN
    INSERT INTO xx.xx_test_table VALUES ('From BE');
    COMMIT;
    END Get_Attributes;
    END XX_GL_APPROVE_BE_PKG;

    Thanks Alejandro. Now this is working.
    Changes i made:
    1. Added the WFERROR workflow as a subscription to this event. So i could see that the function i am calling from the event did not have proper signature.
    2. Changed the function signature to have standard parameters like:
    CREATE OR REPLACE PACKAGE BODY XX_GL_APPROVE_BE_PKG
    AS
    function subscription(p_subscription_guid in raw,
    p_event in out nocopy wf_event_t) return varchar2 is
    l_result varchar2(20);
    begin
    insert into xxvtv.xxvtv_test_table values ('From BE');
    commit;
    exception
    when others then
    wf_core.context('XX_GL_APPROVE_BE_PKG','function subscription', p_event.getEventName(), p_event.getEventKey());
    wf_event.setErrorInfo(p_event, 'ERROR');
    return 'ERROR';
    end subscription;
    END XX_GL_APPROVE_BE_PKG;
    3. Changed the owner name and owner tag both to the custom schema name (XX)

Maybe you are looking for

  • HP 5000 Printer & Vista  (*!@&$%)!!)

    Has anybody has any luck running ID at all on Vista? And by chance anybody running an HP 5000 Laserjet printer w/Vista & ID... Thanks Lamar

  • WLS 10.3.4 with ADF - Performance issues

    Hi, I'm doing some performance tuning on our ADF app on WLS 10.3.4. I ran JRockit Mission Control for 1 minute and it's telling me that 113,503 exceptions were thrown! 70,000 ClassNotFoundException, 27,000 NoSuchMethodException etc. Stupid question m

  • Error occoured while runnin t-code VA01

    Hello, When i'm going to run the t-code VA01 this unknown program error is going to occoured. I send that error attchment please help me for solving this error.

  • Screen sharing without permission under mavericks?

    Googling didn't give me a decisive answer, and I expect the answer is "you can't", but thought I'd ask here to save others the trouble.  The question: How can I set up screen sharing on my home network so that I don't have to go downstairs or upstair

  • Storage on Idea Tab A1000F

    Hi ,Not much info on the storage issue with the A1000F i did the update to take it up to 1.5gb ,but wondered i there was any news on turning the storage into one whole hard drive instead of 2 partitions Cheers Tony