Dbms_output question

I have a package with a bunch of procedures and I wanted to implement some error handling. This will be my first time putting error handling in a package. I am fairly new with Oracle anyway.
Right now a SQL Plus script runs the package. I have a dbms_output statement but it does not print. Of course I have terminal output off so I don't get the queries all spooled out to the screen.
The dbms_output statements do not print either to the screen or even to the spool file (which I don't really want anyway.) I wouldn't mind them spooling to their own file, but I don't kno how to get from here to there. I heard something about dbms_enable but I couldn't get anything from there, either. Where do I put these statements, in the procedures in a begin block or do I put them in the script before the package runs? And is there somethng I have to put in my script to allow it?
Any help would be appreciated. Right now, sometimes my package bombs, but being bad enough that I don't know why, I don't even know if it does bomb at all or not.

You can put dbms_output statements within the begin block or even in the exception section.
Are you runnign this on SQLPLUS? If so then execute the following command:
set serverout on
on the command prompt.
This shoud print your statements.
Try this simple test :
set serverout on
begin
dbms_output.put_line('test');
end;
Message was edited by:
user552775

Similar Messages

  • DBMS_OUTPUT.PUT_LINE question

    Hi there,
    I am having problems with following statement in SQL*PLUS, for some reason the text that I have declared is not appearing instad I am only getting the "Enter Value for" question.
    Here is the code I have created:
    SQL> DECLARE
    2 START_DATE date;
    3 Y varchar2(300);
    4 BEGIN
    5 SELECT 'Enter the start date of the Report MM/DD/YYY enclosed in Single quotes' INTO
    Y FROM DUAL;
    6 DBMS_OUTPUT.PUT_LINE(Y);
    7 START_DATE := &START_DATE;
    8 END;
    9 /
    Here is the result:
    Geben Sie einen Wert für start_date ein:
    What am I doing wrong?
    Regards
    RobH

    Maybe this:
    SQL> SET serverout on
    old: DECLARE
       start_date   DATE;
       y            VARCHAR2 (300);
    BEGIN
       SELECT 'Enter the start date of the Report MM/DD/YYY enclosed in Single quotes'
         INTO y
         FROM DUAL;
       DBMS_OUTPUT.put_line (y);
       start_date := TO_DATE (&start_date, 'MM/DD/YYYY');
       DBMS_OUTPUT.put_line ('You entered: ' || start_date);
    END;
    new: DECLARE
       start_date   DATE;
       y            VARCHAR2 (300);
    BEGIN
       SELECT 'Enter the start date of the Report MM/DD/YYY enclosed in Single quotes'
         INTO y
         FROM DUAL;
       DBMS_OUTPUT.put_line (y);
       start_date := TO_DATE ('02/01/2007', 'MM/DD/YYYY');
       DBMS_OUTPUT.put_line ('You entered: ' || start_date);
    END;
    SQL> DECLARE
       start_date   DATE;
       y            VARCHAR2 (300);
    BEGIN
       SELECT 'Enter the start date of the Report MM/DD/YYY enclosed in Single quotes'
         INTO y
         FROM DUAL;
       DBMS_OUTPUT.put_line (y);
       start_date := TO_DATE ('02/01/2007', 'MM/DD/YYYY');
       DBMS_OUTPUT.put_line ('You entered: ' || start_date);
    END;
    Enter the start date of the Report MM/DD/YYY enclosed in Single quotes
    You entered: 01-FEB-07
    PL/SQL procedure successfully completed.

  • Question on DBMS_OUTPUT

    DBMS_OUTPUT.GET_LINES accepts two parameters a varchar array and the number of lines to be read into the array.
    Is it possible to know how many lines there are in the buffer so that the whole result can be got with a single call to GET_LINES?
    Thanks,
    Sunil.
    null

    Hi,
    the number of lines is a in out parameter to get_lines. Provide a big number (999) and look at it after execution. If the returned value is smaller than your inputted value, you got everything, if not do it again.
    HTH
    Detlev

  • DBMS_Output (some novice questions)

    Hi,
    *{color:#ff0000}Q1.{color}* Is it OK to leave the DBMS_Output lines in production code?
    *{color:#ff0000}Q2.{color}* SQL Developer: executing the Procedure in the worksheet by F5 or F9, the DBMS Output tab is always empty.
    {color:#0000ff}DECLARE
    prmProductName VARCHAR2(50);
    BEGIN
    Get_ProductName (
    prmProductName => prmProductName
    DBMS_OUTPUT.PUT_LINE('prmProductName = ' || prmProductName);
    END;
    {color}The only way I've found so far is to right click the Procedure and Select Run. Then the output are displayed in the Running Log tab.
    It it by design? If so in which scenario there will be something displayed in the DBMS Output pane?
    *{color:#ff0000}Q3.{color}* Using TOAD, executing the same Procedure above in the Editor. I can only see DBMS outputs if executed by F5 but not F9. What is the reason?
    Thanks in advance for any help.

    As Justin said, there is a Enable DBMS_OUTPUT option in the DBMS Output tab in an SQL Worksheet.
    The tabs should be Results, Script Output, Explain, Autotrace, DBMS Output OWA Output
    This is from the SQL Developer Help Center:
    Related Topics
    Using the SQL Worksheet
    DBMS Output Pane
    The PL/SQL DBMS_OUTPUT package enables you to send messages from stored procedures, packages, and triggers. The PUT and PUT_LINE procedures in this package enable you to place information in a buffer that can be read by another trigger, procedure, or package. In a separate PL/SQL procedure or anonymous block, you can display the buffered information by calling the GET_LINE procedure. The DBMS Output pane is used to display the output of that buffer. This pane contains icons and other controls for the following operations:
    Enable/Disable DBMS Output: Toggles the SET SERVEROUTPUT setting between ON and OFF. Setting server output ON checks for any output that is placed in the DBMS_OUTPUT buffer, and any output is displayed in the pane.
    Clear: Erases the contents of the pane.
    Save: Saves the contents of the pane to a file that you specify.
    Print: Prints the contents of the pane.
    Buffer Size: For databases before Oracle Database 10.2, limits the amount of data that can be stored in the DBMS_OUTPUT buffer. The buffer size can be between 1 and 1000000 (1 million).
    Poll: The interval (in seconds) at which SQL Developer checks the DBMS_OUTPUT buffer to see if there is data to print. The poll rate can be between 1 and 15.

  • Question: How to call a BPEL process from a PL/SQL procedure

    Hi All,
    Greetings to all BPEL people. I have a question on how can we call a BPEL process from a PLSQL procedure. It might be a stupid question but i wanted to know whether this fetaure is available in BPEL as our scenario requires us to explore if this functionality is available in BPEL.
    Please let me know and also if possible please send me the links for the tutorials if it is available.
    Thanks In Advance,
    Dibya

    Yes u can do it. there are two ways.
    1) First one is using utl_http package of PL/SQL
    In this case u can create SOAP request message & send it as Http request to your deployed BPEL process.
    This package provides some methods like
    set_header,write_text,get_response,read_text etc..
    Following is part of code which may be helpful to you.
    create or replace package body test_book_order_sub_pkg
    is
    FUNCTION test_book_order_sub(p_subscription_guid IN RAW,
    p_event IN OUT WF_EVENT_T
                                            Return VARCHAR2 IS
    soap_request varchar2(30000);
    soap_respond varchar2(30000);
    http_req utl_http.req;
    http_resp utl_http.resp;
    launch_url varchar2(240) ;
         begin
         DBMS_OUTPUT.Put_Line('Subscription : Order has been booked');
         soap_request:='<?xml version="1.0" encoding="UTF-8"?>
         <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header/>
    <soap:Body xmlns:ns1="http://xmlns.oracle.com/BES_BookOrder">
    <ns1:BES_BookOrderProcessRequest>
    <ns1:input>725</ns1:input>
    </ns1:BES_BookOrderProcessRequest>
    </soap:Body>
    </soap:Envelope>';
    http_req:= utl_http.begin_request
    ('http://172.28.5.191:8888/orabpel/default/BES_BookOrder/1.0',
    'POST',
    'HTTP/1.1'
    utl_http.set_header(http_req, 'Content-Type', 'text/xml') ;
    utl_http.set_header(http_req, 'Content-Length', length(soap_request)) ;
    utl_http.set_header(http_req, 'SOAPAction', 'initiate');
         utl_http.write_text(http_req, soap_request) ;
    http_resp:= utl_http.get_response(http_req) ;
    utl_http.read_text(http_resp, soap_respond) ;
    utl_http.end_response(http_resp) ;
    DBMS_OUTPUT.Put_Line(soap_respond);
    return('SUCCESS');
    end test_book_order_sub;
    end test_book_order_sub_pkg;
    2) Second way is make your BPEL process listening to some database Queue(use AQ Adapter). & then put some message in tht queue from ur Pl/SQL code . This will also initiate BPEL instance. Check out AQAdapter tutorials.
    /mishit

  • A question about the impact of SQL*PLUS SERVEROUTPUT option on v$sql

    Hello everybody,
    SQL> SELECT * FROM v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0  Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL>
    OS : Fedora Core 17 (X86_64) Kernel 3.6.6-1.fc17.x86_64I would like to ask a question about the SQL*Plus SET SERVEROUTPUT ON/OFF option and its impact on queries on views such as v$sql and v$session. Here is the problem
    Actually I define three variables in SQL*Plus in order to store sid, serial# and prev_sql_id columns from v$session in order to be able to use them later, several times in different other queries, while I'm still working in the current session.
    So, here is how I proceed
    SET SERVEROUTPUT ON;  -- I often activate this option as the first line of almost all of my SQL-PL/SQL script files
    SET SQLBLANKLINES ON;
    VARIABLE mysid NUMBER
    VARIABLE myserial# NUMBER;
    VARIABLE saved_sql_id VARCHAR2(13);
    -- So first I store sid and serial# for the current session
    BEGIN
        SELECT sid, serial# INTO :mysid, :myserial#
        FROM v$session
        WHERE audsid = SYS_CONTEXT('UserEnv', 'SessionId');
    END;
    PL/SQL procedure successfully completed.
    -- Just check to see the result
    SQL> SELECT :mysid, :myserial# FROM DUAL;
        :MYSID :MYSERIAL#
           129   1067
    SQL> Now, let's say that I want to run the following query as the last SQL statement run within my current session
    SELECT * FROM employees WHERE salary >= 2800 AND ROWNUM <= 10;According to Oracle® Database Reference 11g Release 2 (11.2) description for v$session
    http://docs.oracle.com/cd/E11882_01/server.112/e25513/dynviews_3016.htm#REFRN30223]
    the column prev_sql_id includes the sql_id of the last sql statement executed for the given sid and serial# which in the case of my example, it will be the above mentioned SELECT query on the employees table. As a result, right after the SELECT statement on the employees table I run the following
    BEGIN
        SELECT prev_sql_id INTO :saved_sql_id
        FROM v$session
        WHERE sid = :mysid AND serial# = :myserial#;
    END;
    PL/SQL procedure successfully completed.
    SQL> SELECT :saved_sql_id FROM DUAL;
    :SAVED_SQL_ID
    9babjv8yq8ru3
    SQL> Having the value of sql_id, I'm supposed to find all information about cursor(s) for my SELECT statement and also its sql_text value in v$sql. Yet here is what I get when I query v$sql upon the stored sql_id
    SELECT child_number, sql_id, sql_text
    FROM v$sql
    WHERE sql_id = :saved_sql_id;
    CHILD_NUMBER   SQL_ID          SQL_TEXT
    0              9babjv8yq8ru3    BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;Therefore instead of
    SELECT * FROM employees WHERE salary >= 2800 AND ROWNUM <= 10;for the value of sql_text I get the following value
    BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES);Which is not of course what I was expecting to find in v$sql for the given sql_id.
    After a bit googling I found the following thread on the OTN forum where it had been suggested (well I think maybe not exactly for the same problem) to turn off SERVEROUTPUT.
    Problem with dbms_xplan.display_cursor
    This was precisely what I did
    SET SERVEROUTPUT OFFafter that I repeated the whole procedure and this time everything worked pretty well as expected. I checked SQL*Plus documentation for SERVEROUTPUT
    and also v$session page, yet I didn't find anything indicating that SERVEROUTPUT should be switched off whenever views such as v$sql, v$session
    are queired. I don't really understand the link in terms of impact that one can have on the other or better to say rather, why there is an impact
    Could anyone kindly make some clarification?
    thanks in advance,
    Regards,
    Dariyoosh

    >
    and also v$session page, yet I didn't find anything indicating that SERVEROUTPUT should be switched off whenever views such as v$sql, v$session
    are queired. I don't really understand the link in terms of impact that one can have on the other or better to say rather, why there is an impact
    Hi Dariyoosh,
    SET SERVEROUTPUT ON has the effect of executing dbms_output.get_lines after each and every statement. Not only related to system view.
    Here below what Tom Kyte is explaining in this page:
    Now, sqlplus sees this functionality and says "hey, would not it be nice for me to dump this buffer to screen for the user?". So, they added the SQLPlus command "set serveroutput on" which does two things
    1) it tells SQLPLUS you would like it <b>to execute dbms_output.get_lines after each and every statement</b>. You would like it to do this network rounding after each call. You would like this extra overhead to take place (think of an install script with hundreds/thousands of statements to be executed -- perhaps, just perhaps you don't want this extra call after every call)
    2) SQLPLUS automatically calls the dbms_output API "enable" to turn on the buffering that happens in the package.Regards.
    Al

  • Question on schedule jobs

    Hi,
    i created two varients of the job as shown belo.
    1)
    DECLARE
      X NUMBER;
    BEGIN
      SYS.DBMS_JOB.SUBMIT
        ( job       => X - job name as 'X'
         ,what      => 'DEL_EMPLOYEE_TABLE;' - ITS A STORED PROCEDURE
         ,next_date => to_date('19/05/2009 01:00:00','dd/mm/yyyy hh24:mi:ss')
         ,interval  => 'trunc(sysdate) + 1/24 + 1'
         ,no_parse  => TRUE
      SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(x));
    END;
    2)
    begin
    dbms_scheduler.create_job (
    job_name => 'DEL_EMPLOYEE_TABLE',
    job_type => 'STORED_PROCEDURE',
    job_action => 'DEL_EMPLOYEE_TABLE',
    number_of_arguments => 0,
    start_date => SYSTIMESTAMP,
    repeat_interval => 'FREQ=DAILY;BYHOUR=0;BYMINUTE=0;BYSECOND=0',
    end_date => NULL,
    enabled => TRUE,
    comments => 'Delete EMPOYEE old records');
    end;
    i have the following questions
    1) what is the difference between #1 and #2
    2) When i queried the DB with following query i could see only
    select owner, job_name, state from dba_scheduler_jobs
    i could see only
    'DEL_EMPLOYEE_TABLE' - job but do not see the #1 job as - X

    [email protected] wrote:
    1) what is the difference between #1 and #2They use two different schedulers, the old one (DBMS_JOB) and the new one (DBMS_SCHEDULER)
    2) When i queried the DB with following query i could see only
    select owner, job_name, state from dba_scheduler_jobs
    i could see only
    'DEL_EMPLOYEE_TABLE' - job but do not see the #1 job as - XYou can find it using:
    select * from user_jobsMax
    http://oracleitalia.wordpress.com
    Edited by: Massimo Ruocchio on Mar 9, 2010 9:37 PM
    typos

  • Please help me...Javascript question

    Hi everyone,
    what i am trying to do is..
    EX:
    TABLE: EMP
    empno empname sal entered_by
    1 john 1000 user1
    I have a form on the table EMP.The users want to enter the same record again(because mutiple users enter the same record) but want an alert message when they hit the create button like.. Eg:
    when user2 is trying to enter this data..
    empno: 2 (generated by sequence)
    empname: john
    sal: 1000
    he wants to see an alert message like: THE Record is Already exists in the database which was entered by USER1 (But he can enter the same record)
    what i did is.. I have a javascript which calls the application process (PL/SQL) where it check whether the data entered is already there in the database and returns back an alert message like this:
    JAVASCRIPT:
    ==========
    <script language=javascript>
    function  f_insert_record()
            var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=INSERT_RECORD',0);
            get.add('P2_EMPNAME',html_GetElement('P2_EMPNAME').value);
            get.add('P2_SAL',html_GetElement('P2_SAL').value);
            gReturn = get.get();
            var a = gReturn.split("|");
            if(gReturn)
                if (a.length > 0) {alert(a[0]);}
            else
                null;
    </script>APPLICATION_PROCESS
    ===================
    DECLARE
       l_error   VARCHAR2 (4000);
       V_NAME VARCHAR2(1000);
       V_MSPR_ID NUMBER(15);
       I NUMBER;
       V_MYNUM STRING_OBJ := STRING_OBJ();
    BEGIN
      FOR C1 IN (SELECT DISTINCT entered_by ENTERED_BY_USER_NM 
    from emp 
    WHERE  
      empname = :P2_EMPNAME
      AND sal  = :P2_SAL
      ) LOOP
        V_MYNUM.EXTEND;
        V_MYNUM(V_MYNUM.COUNT) := C1.ENTERED_BY_USER_NM;
      END LOOP;
      V_NAME := NULL;
      l_error := NULL;
      FOR I IN V_MYNUM.FIRST..V_MYNUM.LAST LOOP
        --dbms_output.put_line(V_MYNUM(I));
        V_NAME := V_NAME || '   ' || V_MYNUM(I);
      END LOOP;
      IF V_NAME IS NOT NULL THEN
        l_error := 'The record already exists in the database which was created by '||V_NAME;
      END IF; 
      HTP.PRN(l_error);
    END;everything works fine...when i have a ONBLUR event on the SALARY field.
    But i want the same thing to be achieved with the ONCLICK event on the CREATE button (Template based button).
    The code i have shown over here is just an example...But the requirement is the same..Multiple Users can enter the same record but they want to see an alert message like this record was entered by USER1,USER2.
    The only think i am not able to figure out is the ONCLICK event on that create button.
    I tried like this Target: URL
    javaScript:(f_insert_record();doSubmit('CREATE');)
    I am not getting the alert message.
    Please help me to solve this
    thanks
    phani

    damn it! Those little quotation marks.....
    I already did figure it out awhile after I posted my question
    Thanks anyway!

  • Few questions about apex + epg and cookie blocked by IE6

    Hi,
    I would like to ask a few questions about apex and epg.
    I have already installed and configured apex 3.2 on oracle 10g (on my localhost - computer name 'chen_rong', ip address -192.168.88.175 ), and enable anonymous access xdb http server.
    now,
    1. I can access 'http://chen_rong' , 'http://localhost' , 'http://192.168.88.175' without input username / password for realm 'XDB' in IE6;
    2. I can access 'http://localhost/apex/apex_admin' , 'http://192.168.88.175/apex/apex_admin' , and I can be redirected into apex administation page after input admin/<my apex admin password> for realm 'APEX' in IE6;
    3. I can access 'http://chen_rong/apex/apex_admin' in IE6, but after input admin/password , I can not be redirected into administation page, because the cookie was blocked by IE6.
    then, the first question is :
    Q1: What is the difference among 'http://chen_rong' , 'http://localhost' , 'http://192.168.88.175' ? I have already include site 'chen_rong' into my trusted stes! why the cookie was blocked by IE6. I have already tried firefox and google browser, both of them were ok for 'chen_rong', no cookie blocked from site 'chen_rong'!
    and,
    1. I have tried to use the script in attachment to test http authentication and also want to catch the cookie by utl_http .
    2. please review the script for me.
    3. I did:
    SQL> exec show_url('http://localhost/apex/apex_admin/','ADMIN','Passw0rd');
    HTTP response status code: 401
    HTTP response reason phrase: Unauthorized
    Please supplied the required Basic authentication username/password for realm XDB for the Web page.
    Web page http://localhost/apex/apex_admin/ is protected.
    MS-Author-Via: DAV
    DAV: 1,2,<http://www.oracle.com/xdb/webdav/props>
    Server: Oracle XML DB/Oracle Database
    WWW-Authenticate: Basic realm="XDB"
    Date: Tue, 04 Aug 2009 02:25:15 GMT
    Content-Type: text/html; charset=GBK
    Content-Length: 147
    ======================================
    PL/SQL procedure successfully completed
    4. I also did :
    SQL> exec show_url('http://localhost/apex/apex_admin/','ANONYMOUS','ANONYMOUS');
    HTTP response status code: 500
    HTTP response reason phrase: Internal Server Error
    Check if the Web site is up.
    PL/SQL procedure successfully completed
    SQL> exec show_url('http://localhost/apex/apex_admin/','SYSTEM','apexsite');
    HTTP response status code: 401
    HTTP response reason phrase: Unauthorized
    Please supplied the required Basic authentication username/password for realm APEX for the Web page.
    Web page http://localhost/apex/apex_admin/ is protected.
    Content-Type: text/html
    Content-Length: 147
    WWW-Authenticate: Basic realm="APEX"
    ======================================
    PL/SQL procedure successfully completed
    my second questions is :
    Q2: After I entered into realm 'XDB', I still need went into realm'APEX'. how could I change the script show_url to accomplish these two tasks and successfully get the cookie from site.
    the show_url script is as following:
    CREATE OR REPLACE PROCEDURE show_url
    (url IN VARCHAR2,
    username IN VARCHAR2 DEFAULT NULL,
    password IN VARCHAR2 DEFAULT NULL)
    AS
    req UTL_HTTP.REQ;
    resp UTL_HTTP.RESP;
    name VARCHAR2(256);
    value VARCHAR2(1024);
    data VARCHAR2(255);
    my_scheme VARCHAR2(256);
    my_realm VARCHAR2(256);
    my_proxy BOOLEAN;
    cookies UTL_HTTP.COOKIE_TABLE;
    secure VARCHAR2(1);
    BEGIN
    -- When going through a firewall, pass requests through this host.
    -- Specify sites inside the firewall that don't need the proxy host.
    -- UTL_HTTP.SET_PROXY('proxy.example.com', 'corp.example.com');
    -- Ask UTL_HTTP not to raise an exception for 4xx and 5xx status codes,
    -- rather than just returning the text of the error page.
    UTL_HTTP.SET_RESPONSE_ERROR_CHECK(FALSE);
    -- Begin retrieving this Web page.
    req := UTL_HTTP.BEGIN_REQUEST(url);
    -- Identify yourself.
    -- Some sites serve special pages for particular browsers.
    UTL_HTTP.SET_HEADER(req, 'User-Agent', 'Mozilla/4.0');
    -- Specify user ID and password for pages that require them.
    IF (username IS NOT NULL) THEN
    UTL_HTTP.SET_AUTHENTICATION(req, username, password, 'Basic', false);
    END IF;
    -- Start receiving the HTML text.
    resp := UTL_HTTP.GET_RESPONSE(req);
    -- Show status codes and reason phrase of response.
    DBMS_OUTPUT.PUT_LINE('HTTP response status code: ' || resp.status_code);
    DBMS_OUTPUT.PUT_LINE
    ('HTTP response reason phrase: ' || resp.reason_phrase);
    -- Look for client-side error and report it.
    IF (resp.status_code >= 400) AND (resp.status_code <= 499) THEN
    -- Detect whether page is password protected
    -- and you didn't supply the right authorization.
    IF (resp.status_code = UTL_HTTP.HTTP_UNAUTHORIZED) THEN
    UTL_HTTP.GET_AUTHENTICATION(resp, my_scheme, my_realm, my_proxy);
    IF (my_proxy) THEN
    DBMS_OUTPUT.PUT_LINE('Web proxy server is protected.');
    DBMS_OUTPUT.PUT('Please supply the required ' || my_scheme ||
    ' authentication username/password for realm ' || my_realm ||
    ' for the proxy server.');
    ELSE
    DBMS_OUTPUT.PUT_LINE('Please supplied the required ' || my_scheme ||
    ' authentication username/password for realm ' || my_realm ||
    ' for the Web page.');
    DBMS_OUTPUT.PUT_LINE('Web page ' || url || ' is protected.');
    END IF;
    ELSE
    DBMS_OUTPUT.PUT_LINE('Check the URL.');
    END IF;
    -- UTL_HTTP.END_RESPONSE(resp);
    -- RETURN;
    -- Look for server-side error and report it.
    ELSIF (resp.status_code >= 500) AND (resp.status_code <= 599) THEN
    DBMS_OUTPUT.PUT_LINE('Check if the Web site is up.');
    UTL_HTTP.END_RESPONSE(resp);
    RETURN;
    END IF;
    -- HTTP header lines contain information about cookies, character sets,
    -- and other data that client and server can use to customize each
    -- session.
    FOR i IN 1..UTL_HTTP.GET_HEADER_COUNT(resp) LOOP
    UTL_HTTP.GET_HEADER(resp, i, name, value);
    DBMS_OUTPUT.PUT_LINE(name || ': ' || value);
    END LOOP;
    -- Read lines until none are left and an exception is raised.
    --LOOP
    -- UTL_HTTP.READ_LINE(resp, value);
    -- DBMS_OUTPUT.PUT_LINE(value);
    --END LOOP;
    UTL_HTTP.GET_COOKIES(cookies);
    dbms_output.put_line('======================================');
    FOR i in 1..cookies.count LOOP
    IF (cookies(i).secure) THEN
    secure := 'Y';
    ELSE
    secure := 'N';
    END IF;
    -- INSERT INTO my_cookies
    -- VALUES (my_session_id, cookies(i).name, cookies(i).value,
    -- cookies(i).domain,
    -- cookies(i).expire, cookies(i).path, secure, cookies(i).version);
    dbms_output.put_line('site:'||url);
    dbms_output.put_line('cookies:');
    dbms_output.put_line('name:'||cookies(i).name);
    dbms_output.put_line('value:'||cookies(i).value);
    dbms_output.put_line('domain:'||cookies(i).domain);
    dbms_output.put_line('expire:'||cookies(i).expire);
    dbms_output.put_line('path:'||cookies(i).path);
    dbms_output.put_line('secure:'||secure);
    dbms_output.put_line('version:'||cookies(i).version);
    END LOOP;
    UTL_HTTP.END_RESPONSE(resp);
    EXCEPTION
    WHEN UTL_HTTP.END_OF_BODY THEN
    UTL_HTTP.END_RESPONSE(resp);
    END;
    /

    I use oracle database enterprise edtion 10.2.0.3. I have already figured out the epg on 10.2.0.3 to support apex 3.2.
    And as I described above, the apex site works fine for ip address , and localhost. but the cookie will be blocked by IE6, if I want to access the site by 'http://computername:port/apex/apex_admin'. This problem does not occured in firefox and google browser. Could someone give me answer?

  • Oracle 10.1.0.4.2 SQL Plus dbms_output.put_line not working

    I am using Oracle 10.1.0.4.2 SQL Plus, and dbms_output.put_line is not working. It returns the dbms_output ONLY from outside the procedure. I have dbms_output INSIDE my procedure, and none of it gets returned. Please help!
    Here is what I enter:
    set serveroutput on size 1000000;
    DECLARE
         x number:=0;
    begin
    DBMS_OUTPUT.ENABLE;
    c2reports.c2proc(x,'TEST');
    DBMS_OUTPUT.PUT_LINE('testX');
    END;
    testX
    There should be more besides the 'testX' that gets returned. The first line in my procedure has output code to print testY. Thanks in advance!

    This is the forum for the Oracle's SQL Developer (Not for general SQL/PLSQL questions). You should ask question like this in the PL/SQL forum

  • Need info on dbms_output

    The data print on REPORT.txt using the below block has an issue.
    Current O/P: QuestionNumber,Question,Answer,COUNT
    1,How would you rate the online web developemtn process for ease of use?,Very
    Easy,7758
    4,If a Customer Service Representative from the Nestle HR Service Center, how satisfied were you with the
    assistance?,Very Satisfied,1776
    Expected O/P:1,How would you rate the online web developemtn process for ease of use?,Very Easy,7758
    4,If a Customer Service Representative from the Nestle HR Service Center, how satisfied were you with the assistance?,Very Satisfied,1776
    The issue here is that it (QuestionNumber1&4) wont print on a single line, instead it prints on two lines....any ways through which i can have each row returned from the database to be printed on same line? Thank You
    set serveroutput on;
    SPOOL &&executionrootdir\errlog\&&proc_desc+_REPORT.log
    SPOOL REPORT.txt
    select distinct 'QuestionNumber,Question,Answer,COUNT' from dual;
    DECLARE
    CURSOR C1 is
    SELECT q.question_num as QuesNum, q.question_text as QuesText, a.answer_text as QuesAns, count (*) as Count
    FROM .......
    GROUP BY ........
    ORDER BY 1;
    BEGIN
    FOR rec IN C1 LOOP
    dbms_output.put_line (rec.QuesNum||','||rec.QuesText||','||rec.QuesAns||','||rec.Count);
    END LOOP;
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line ('There are no Survey Result''s');
    END;
    spool off
    Edited by: HarinathArasu on Dec 6, 2008 5:05 AM

    Hi,
    Can you explain better?
    If you want a multiple line in one dbms_output.put_line statement you must use chr(13). Example:
    Connected to Oracle9i Enterprise Edition Release 9.2.0.1.0
    Connected as hr_1
    SQL>
    SQL> SET SERVEROUTPUT ON
    SQL> BEGIN
      2     dbms_output.put_line('line 1' || 'line 2');
      3     dbms_output.put_line('line 1' || chr(13) || 'line 2');
      4  END;
      5  /
    line 1line 2
    line 1
    line 2
    PL/SQL procedure successfully completed
    SQL>Tip: To improve code readability you should post your code between {noformat}{noformat} tags (start and end tags are the same) :)
    Regards,
    Edited by: Walter Fernández on Dec 6, 2008 10:29 AM - Adding tip                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Using dbms_output in Trigger

    hi
    I asked my question previous;y but couldnt get an exact answer for my question
    I have three table grade
    grade(studentno,courseno,grade)
    courses(courseno,coursename)
    prerequisite(courseno,prereqcourseno)
    prereq(courseno) is foreign key on courses(courseno)
    I want to make I trigger that when one try to add a course in grade table
    the trigger will check the prerequisite of that course
    and if the course is not exist in grade table( which means student has not take the prereq before)
    the trigger will give an error and will report the prerequisites that the student need for that course;
    The problem is I cant show the prerequisite courses that the student need, when I insert a course without prerequisite.
    for example let say prereq of course C is A and B
    so when I try to insert A into grade, the trigger should say that u cant do it, because u nedd A and B
    thanks in advance

    I agree totally with Kamal Kishores opinion. even i discourage my friends , the usage of DBMS_OUTPUT package.
    It should be used more or less as a tool for debugging. As a beginner it may be advantageous and easy to learn abt the
    stored procedure programming. But keeping in view that PL/SQL is more used in the backend processing. Just keep in view that
    we are using a front end tool and we are writing our programs in back end (PL/SQL) then the use of DBMS_OUTPUT package and
    dependency on that is waste of efforts. infact the point of DBMS_OUTPUT using to output a big chunk of varchar2 string to the
    client SQL*PLUS window may / may not be advantageous.
    coz if we are using Windows client and using the DBMS_OUTPUT put display the message on the screen then we may not be seeing
    the messages immediately on the screen unless the execution of the program is completed. For that we are using our debugging in a separate way.
    Suppose if i want to know what is the program doing at the current instance of time , then it may not be possible using DBMS_OUTPUT package.
    my debugging style is in this way. I have created a procedure with AUTONOMOUS TRANSACTION with a single arguement of VARCHAR2;
    CREATE OR REPLACE PROCEDURE SEND_MES(MES VARCHAR2) IS
    PRAGMA AUTONOMOUS_TRANSACTION;
    BEGIN
    INSERT INTO DEBUG_TRAP VALUES(MES,TO_CHAR(SYSDATE,'HH24-MI-SS'));
    COMMIT;
    end;
    EVEN THOUGH IT MAY BE AN OVER HEAD but it is very very advantageous to findout how the program is behaving and
    where the current control is in the program. i monitor the values inputted in the table DEBUG_TRAP using another session. which makes me easily understandable where my program is
    and gives me idea how to improve / tune my program .
    prakash

  • Question regarding cursor variables, while using table functions

    Hi,
    I created a procedure and when i'm try'g to call it. now i'm getting this error.
    CREATE OR REPLACE TYPE TAB_EMP_REC IS OBJECT(
    EMP_ID NUMBER(9),
    EMP_NAME VARCHAR2(30));
    CREATE OR REPLACE TYPE T_EMP_TMP IS TABLE OF TAB_EMP_REC ;
    CREATE OR REPLACE PROCEDURE USP_CREATE_DATA(
    p_Input IN NUMBER,
    V_EMP_CUR OUT sys_refcursor) IS
    T_EMp T_EMP_TMP := T_EMP_TMP( );
    BEGIN
    t_emp.extend();
    t_emp(1) := TAB_EMP_REC(p_input, 'jack');
    OPEN V_EMP_CUR FOR SELECT * from TABLE(t_emp);
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('ERROR '||SQLERRM);
    END USP_CREATE_DATA;
    calling procedure::
    DECLARE
    type O_RESULT_CUR is ref cursor return TAB_EMP_REC;
    V_EMP_REC TAB_EMP_REC;
    BEGIN
    USP_CREATE_DATA(99, O_RESULT_CUR);
    LOOP
    FETCH O_RESULT_CUR INTO V_EMP_REC;
    EXIT WHEN O_RESULT_CUR%NOTFOUND;
    DBMS_OUTPUT.PUT_LINE(V_EMP_REC.EMP_ID);
    END LOOP;
    CLOSE O_RESULT_CUR;
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('ERROR '||SQLERRM);
    END;
    Now i'm getting an error PLS-00362: invalid cursor return type; 'TAB_EMP_REC' must be a record type.
    My question is i already declared it as a database object. What do i need to do ?
    thank you

    but t_emp(1) := TAB_EMP_REC(p_input, 'jai');
    is correct, since.. i'm passing a record into t_emp(1)(this is the first column in this table)No it is not, since TAB_EMP_REC is just an object, when used as a collection, it can be a VARRAY, a PL/SQL table(associative array), nested table etc. As mentioned in my earlier post, if you want to use a collection of the same structure (with subscript n, as you have done here), then you need to declare a collection of type TAB_EMP_REC.In this case you have already declared a table of type TAB_EMP_REC - +CREATE OR REPLACE TYPE T_EMP_TMP IS TABLE Also, t_emp is of type T_EMP_TMP - T_EMp T_EMP_TMP := T_EMP_TMP( );*
    As for the error you are getting, try changing to -
    t_emp := T_EMP_TMP(TAB_EMP_REC(p_input, 'jai'));*
    Note : Not Tested.

  • Cursor For loop question

    Hi,
    I have a cursor in my plsql and I am trying to get the record through a FOR loop. I know that for loop will take care of opening, fetching and closing the cursor implicitly.
    Ex.
    declare
    cursor c1 is
    select * from emp;
    begin
    for l_rec in c1 loop
    end loop;
    My question is i want to check whether the cursor in the for loop is returning any record or not using IF condition.
    where and how i will find that?
    Can anyone help how to do that.
    Rds,
    Nag

    without using boolean variables.Obvious question, WHY?
    If you are so particular..
    SQL> declare
      2   cursor c1 is
      3        select empno, ename, job
      4        from emp
      5        where empno = 7839123;
      6   ex exception;
      7   rec c1%rowtype;
      8  begin
      9   open c1;
    10   fetch c1 into rec;
    11   if c1%notfound then
    12    raise ex;
    13   end if;
    14   loop
    15    dbms_output.put_line(rec.empno||'-->'||rec.ename||'-->'||rec.job);
    16    fetch c1 into rec;
    17    exit when c1%notfound;
    18   end loop;
    19  exception
    20   when ex then
    21    dbms_output.put_line('cur not found');
    22  end;
    23  /
    cur not found
    PL/SQL procedure successfully completed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Output variable value (DBMS_OUTPUT.PUT_LINE)

    Hello,
    I just started using ORACLE and am learning about PL/SQL. My question is how do you output a variable? I am running the following in an SQL Worksheet, but I can't output the value:
    DECLARE
    v_Temp VARCHAR2(200);
    BEGIN
    v_Temp :='help me';
    DBMS_OUTPUT.PUT_LINE(v_Temp);
    DBMS_OUTPUT.PUT_LINE('Text In Single');
    END;
    Thanks, sck10

    SQL> DECLARE
      2  v_Temp VARCHAR2(200);
      3 
      4  BEGIN
      5  v_Temp :='help me';
      6  DBMS_OUTPUT.PUT_LINE(v_Temp);
      7  DBMS_OUTPUT.PUT_LINE('Text In Single');
      8  END;
      9  /
    PL/SQL procedure successfully completed.
    SQL> set serveroutput on
    SQL> /
    help me
    Text In Single
    PL/SQL procedure successfully completed.
    SQL> Nicolas.

Maybe you are looking for

  • Syntax for WriterLoginName in Data Warehouse DB

    Hello I'm having a few issues with our management servers writing to the Data Warehouse DB. I've checked the 'Management Group' table and can see the WriterLoginName is set to DOMAIN\sv-scom-dw - however, i'm just querying whether that field should r

  • Need help:photoshop CS3 crashes when placing an image on a blank doc...?

    Does this sound at all familiar to anyone or has anybody experienced this as well? I have a blank document open and have tried both placing and opening an image (not one image in particular but many) and I recieve a pop up box saying CS3 has encounte

  • Problem loading a custom class in workflow

    Hi. my configuration is DB 8.1.7 workflow 2.6.0 I want to execute an external java, and to do that i wrote a simple class (based on API specification) I receive that error when I run Loadjava on a that very simple class. JAVA CLASS OWF_MGR.pippo On l

  • Process in memory after System.exit(0)

    I still see the process in memory after I exit the app. Do you think it is a JWS side effect? Platform: W2K Cheers, Ivan

  • Photobooth - no image

    I've been using Photo Booth for a few years but since upgrading to Leopard earlier this year it has become temperamental. It often fires up without displaying any image, it's as if the camera isn't working but the green light is on. Then in a few day