Debugging in procedure !!!

i getting error with following procedure, Any idea why ??
CREATE OR REPLACE PROCEDURE p_display_message (p_message VARCHAR2, p_Log_type Char Default 'I')
IS
PRAGMA AUTONOMOUS_TRANSACTION;
V_Va_Message varchar2(4000);
BEGIN
if trim(P_log_type) = 'E' then
V_Va_Message := p_message || ': The following error occured at'|| DBMS_UTILITY.format_error_backtrace || ' - ' || DBMS_UTILITY.format_error_stack
--|| ': ' || Sqlcode || ' : ' || sqlerrm
else
V_Va_Message := p_message;
end if;
*13* INSERT INTO t_log (seq_num, log_date, MESSAGE, Log_type)
*14* VALUES (s_log.NEXTVAL, SYSDATE, V_Va_Message, p_log_type );
DBMS_OUTPUT.put_line( TO_CHAR (SYSDATE, 'yyyymmdd:hh24miss') || V_Va_Message || '....' );
commit;
END p_display_message;
error
Compilation errors for PROCEDURE SCOTT.P_DISPLAY_MESSAGE
Error: PL/SQL: ORA-02289: sequence does not exist
Line: 14
Text: VALUES (s_log.NEXTVAL, SYSDATE, V_Va_Message, p_log_type );
Error: PL/SQL: SQL Statement ignored
Line: 13
Text: INSERT INTO t_log (seq_num, log_date, MESSAGE, Log_type)
Following are the datatypes used for variables in t_log table
seq_num number,
log_date date,
MESSAGE varchar2,
Log_type vachar2
Thank you so much. I really appreciate it !!

I f you are using a sequence to generate some no... for a particular table then first you have to create the sequence and after creating you can use it by seuence_name.nextval.
create sequence seq_num increment by 1;
A R P I T S I N H A

Similar Messages

  • How can we debug a procedure?

    we need to debug a procedure but we lost the way after oracle moved the procedure builder to enterprise manager. we can execute it via em but we need a tool for writing,debugging and executing new ones.

    An SQLPlus window and either dbms_output or an anonymous log writing procedure is all you need to develop and debug home grown code.
    Most routines can be written as anonymous pl/sql code and tested then collected together into stored procedures or packages.
    You do not need a GUI tool, but if you must use one there is a product called PL/SQL Developer that some of our developers use. The developers seem to like it a lot.
    HTH -- Mark D Powell --

  • Debugging stored procedure in SQL Server 2012

    Hi,
    Please I need your help.
    I used to debug stored procedures in SQL server 2008, 2008 R2. I'm debugging the stored procedure using SQL Server management studio. I just create a break point then I click on the debug button
    and start debugging without any problems.
    I'm talking about my local machine which I have administrator privileges on the machine. My account in the administrators group and I'm assigned in the sysadmin role in SQL server but I couldn't
    debug the stored procedure. When I create a break point and try to debug the stored procedure I'm getting a popup screen saying "To continue debugging, the firewall needs to be configured. Configuring the firewall requires privileges."
    I tried to figure out the issue but unfortunately until now I'm not able to resolve it.
    Thanks. 

    The problem resolved with help of Microsoft support but it was really strange situation.
    First, the following is my environment.
    OS is Windows 8 Pro
    SQL Server 2012
    I did try everything firewall, Anti-Virus and other thing as well. I usually type (local) on the server name TextBox. I did close my Anti-Virus program, turn off windows firewall and run SQL server as administrator but I’m still
    unable to debug.
    I just do one thing and one thing only, changed the (local) on the server name TextBox to the actual server name and everything work fine. I did try that with everything close/open my Anti-Virus program, turn
    off/one windows firewall and still work fine, and I was able to debug any T-SQL in SQL server 2012 but run it as administrator.
    Anyway, I’m happy to back on the road again.
    Thank you every single one of you who try his best to help.
    Cheers.

  • Granting system privileges DEBUG ANY PROCEDURE and CONNECT SESSION in 10gXE

    I am using Oracle DB 10g Express Edition and trying out SQL Developer. Whenever I want to debug a procedure I got the error:
    This session requires DEBUG CONNECT SESSION and DEBUG ANY PROCEDURE user privileges.
    But I don't see these privileges to grant in the XE GUI for users.
    Does anybody know if this is supported in XE.
    Thanks.

    Hi
    Use SQL*Plus (or the apex interface), logon as dba and type this sql statements:
    grant DEBUG CONNECT SESSION to <username>;
    grant CONNECT SESSION to <username>;

  • How to debug a procedure in SQL Developer

    i am a plsql writer .... i use SQL Developer to connect to oracle on windows platform ... iam using oracle
    version 10g some time i need to debug a procedure or i want to run a procedure in debug mode
    please tell me how to do this SQL Developer

    There's great help inside sqldev, just follow the Help Contents - Concepts and usage - Running and debugging...
    Have fun,
    K.

  • How to debug Stored Procedures on Runtime?

    Is there any way or any tool available using which I could debug stored procedures on runtime ? Please also pass the links if you know any.

    Check out the PL/SQL Developer tool:
    http://www.allroundautomations.nl/plsqldev.html
    You can download a fully functional version for a 30 day trial. Much less expensive than TOAD, and better yet, it actually works (the TOAD PL/SQL debugger in version 8 is so buggy as to render it useless)

  • DEBUG ANY PROCEDURE

    Oracle 9.2.0.6, soon to be 11.1.0.7...
    Please double-check my understanding of the documentation.
    We have at least one developer who likes to use the PL/SQL Debugger functionality, which requires DEBUG ANY PROCEDURE (http://docs.oracle.com/cd/B10501_01/appdev.920/a96590/adg10pck.htm#37819).
    Our system DBAs are wisely hesitant in granting an "ANY" privilege. My understanding is that even though this privilege has "ANY" in the name, it is not highly privileged like ALTER ANY TABLE, EXECUTE ANY PROCEDURE, etc.
    Should I (or the system DBAs) have any reservation with this privilege in development and test environments?
    The SQL reference notes that it is equivalent to granting DEBUG on every applicable object. (http://docs.oracle.com/cd/B10501_01/server.920/a96540/statements_912a.htm#2075179).
    If I read this right, and if a DBA will not grant DEBUG ANY PROCEDURE, I should be able to grant DEBUG on each PL/SQL object to the developer to get the same result?
    Thanks

    in my opinion the Debug is quite safe privilege. It will not alter the procedure.
    however still I chose not to grant it in Prod environment since it may cause locking issue (library cache pin).

  • Debugging the procedure

    Hi, How can we debug the procedure in a package without sufficient privilages, is it possible ?
    if possible / if not possible which is the best way/tool for debugging the stored procedures
    thanks a lot

    Perhaps the answer is to research Oracle security vulnerabilities and attempt a privilege escalation hack. Oh... Pete Finnigan can help to find some security holes...
    Nicolas.

  • How to debugging a procedure

    Hi,
    I have some 1000 lines of code in a procedure
    now i want to debug this procedure to find out where the error getting
    could any one help me how to debug the huge lines of procedure

    Hi,
    I usually opt for PL/SQL developer tool for debugging millions of line of code. Try to grant the privilege to user 'debug connect session'.
    Try to execute the procedure in step by step execution. Pass the run time variable input value to procedure and go on with debug procedure then you can watch how code is carrying out the changes.
    HTH
    - Pavan Kumar N

  • Debugging Stored Procedures

    Hi friends,
                  I am using [SBO_SP_PostTransactionNotice] for update. is there any possibility to debug this procedure?. If it is possible pls guide me.
    Regards,
    Silambu

    Hi,
               But Update also happening.
    thanks,
    silambu

  • How to get the debug sqlserver procedure calling from powerbuilder

    How to get sqlserver debug while calling   the procedure from PowerBuilder. Please can you help
    Many Thanks
    Pol

    You are better off doing this through the native SQL server tools.  You can debug your PB code to find the variables being sent to the stored proc (if any) from PB and then use them in SQL Server Management Studio or similar.

  • Debug Package/Procedure in Oracle

    Hi,
    Please let me know the procedure to debug a package/procedure in oracle ( Apart from dbms_output commands). We are using Toad.
    Other option would be to
    1. Set tracing on for a particular session and analyze logs generated through tkprof
    2. Turn on Logon trigger for a user to capture all the SQLs fired.
    The issue with above options is that all system fired SQL's are also captured. It would be a tough task to wade through all the SQL's fired.
    PLease suggest the best option to debug a complex procedure/package.
    Thanks in advance.

    Create one table and caputure all results in that... Thanks!

  • Remote debugging plsql procedures in jdeveloper using J2EE container

    I have a J2EE application which is connected to an oracle database .For debugging purposes ,can i remotely debug my plsql stored procedures when an action comes from the J2EE server . That is, can i control a call from the server by using breakpoints in my plsql stored procedures so that i can see the run time parameters to the plsql procedures and so

    Yes you can. See : http://blogs.oracle.com/shay/2005/12/20#a58

  • Debug Stored procedure or database trigger by 10g Forms

    Hi,
    I want to debug my table level trigger (On update for each row), I am updating this table by forms. When I debug this form I am unable to watch the database debug.
    Please help me regarding database trigger/function/procedures by debugging forms.

    not possible via forms
    you can debug it on SQL Developer by using manual INSERT Updates commands

  • Not able to debug package procedure using PL/SQL Developer 7.0.3

    Hi Guys,
    I am debugging one of procedure of my package which is calling many procedure for different package
    I am using PL/SQL Developer 7.0.3., Iam not able to debugger , whenever I run debugger it makes all the dependent package as invalid
    Please advice me what to do,
    Thanks
    Nav

    PL/SQL Developer has it's own forum @http://forums.allroundautomations.com/ubb/ubbthreads.php?ubb=postlist&Board=3&page=1&PHPSESSID=13b3aab3b0281796203ac9eca9db0f82
    You have an old version, by the way, why not upgrade?

  • How to debug Oracle Procedure

    Hi friends,
    I migrated oracle procedure from Oracle 8.0.4 DB froM NT to Oracle 9.2.0 DB on IBM AIX.
    When I test/run the procedure on the 9.2.0 Db, it is running forever and would not end complete.
    How do you debug an Oracle Procedure to check if it is looping on same block foever, and what "current" values does it hold, and the what tables it is reading at, or does procedure ever loops as if it does not safisfy any of the conditions?
    Thanks a lot

    thanks Just,
    This is the procedure that is looping :
    Create or replace procedure glccshdb (v_period_name IN VARCHAR2) AS
    -- DECLARE
    ----------------------- FLAG VARIABLES ---------------------------
      f_eof_sundry_cr_flag     VARCHAR2(1) := 'N';
      f_eof_sundry_dr_flag     VARCHAR2(1) := 'N';
      f_same_check_flag     VARCHAR2(1)     := 'N';
      f_1st_loop_flag     VARCHAR2(1) := 'Y';
    ----------------------- INPUT VARIABLES ---------------------------
      v_startdate     DATE;
      v_enddate     DATE;
    --  v_period_name     VARCHAR2(15);
    ---------------- MAIN CURSOR ------------------
    CURSOR cur_main IS
    SELECT
         SUBSTR(     p.accounting_date,1,9) CHECKDATE,
         SUBSTR(     c.vendor_name,1,39) PAYEE,
         SUBSTR(     i.description,1,39) PARTICULARS,
         SUBSTR(     i.doc_sequence_value,1,15) DV_NUMBER,
         SUBSTR(     c.check_number,1,15) CHECK_NUMBER,
         SUBSTR(     d.amount,1,15) DISTRIBAMT,
         SUBSTR(     d.dist_code_combination_id,1,15) CODE,
         SUBSTR(     cc.segment5,1,16) ACCOUNT,
         SUBSTR(     c.amount, 1, 15) CHECKAMT,
         SUBSTR(     c.bank_account_id, 1, 15) BANKACCTID,
         SUBSTR(     c.check_id, 1, 15) CHECKID
    FROM
         ap_invoices               i,
            ap_checks               c,
            ap_invoice_payments           p,
         ap_invoice_distributions      d,
         gl_code_combinations           cc,
         gl_sets_of_books           s
    WHERE
            p.invoice_id = i.invoice_id
    AND     p.check_id = c.check_id
    AND     i.payment_status_flag = 'Y'
    AND NOT p.amount < 0
    AND     i.invoice_id = d.invoice_id
    AND     d.dist_code_combination_id = cc.code_combination_id
    AND     cc.chart_of_accounts_id = s.chart_of_accounts_id
    AND     s.set_of_books_id = '1'
    AND   p.accounting_date BETWEEN v_startdate AND v_enddate
    ORDER BY p.accounting_date,c.check_number,c.vendor_id, c.amount;
    ---------------- SUNDRY DEBIT CURSOR ------------------
    CURSOR cur_sundry_dr IS
    SELECT
         SUBSTR(     cc.segment5,1,16) ACCOUNT,
         SUBSTR(     d.amount,1,15) AMOUNT
    FROM
         ap_invoices               i,
            ap_checks               c,
            ap_invoice_payments           p,
         ap_invoice_distributions      d,
         gl_code_combinations           cc,
         gl_sets_of_books           s
    WHERE
            p.invoice_id = i.invoice_id
    AND   p.check_id = c.check_id
    AND   i.payment_status_flag = 'Y'
    AND NOT p.amount < 0
    AND     i.invoice_id = d.invoice_id
    AND     d.dist_code_combination_id = cc.code_combination_id
    AND     cc.chart_of_accounts_id = s.chart_of_accounts_id
    AND     s.set_of_books_id = '1'
    AND     p.accounting_date = v_cur_date_ref
    AND NOT
         (     cc.segment5 = '008-070-351-0000'
         AND      d.amount < 0 )
         OR
         (     cc.segment5 = '008-070-352-0000'
         AND      d.amount < 0 )
         OR
         (     cc.segment5 = '008-070-353-0000'
         AND      d.amount < 0 )
         OR
         (     cc.segment5 = '008-070-354-0000'
         AND      d.amount < 0 )
         OR
         (     cc.segment5 = '008-084-100-0000'
         AND      d.amount < 0 )
    ---------------------------- DEBIT SPECIFIED ACCOUNTS QUALIFIER
         OR
         (     cc.segment5 = '008-071-903-0000'
         AND NOT     d.amount < 0 )
         OR
         (     cc.segment5 = '008-071-862-0000'
         AND NOT     d.amount < 0 )
         OR
         (     cc.segment5 = '008-084-906-0000'
         AND NOT     d.amount < 0 )
         OR
         (     cc.segment5 = '008-086-202-0000'
         AND NOT     d.amount < 0 )
         OR
         (     cc.segment5 = '003-001-110-0000'
         AND NOT     d.amount < 0 )
         OR
         (     cc.segment5 = '003-001-120-0000'
         AND NOT     d.amount < 0 )
         OR
         (     cc.segment5 = '008-092-420-0000'
         AND NOT     d.amount < 0 )
         OR
         (     cc.segment5 = '003-002-200-0000'
         AND NOT     d.amount < 0 )
         OR
         (     cc.segment5 = '003-019-000-0000'
         AND NOT     d.amount < 0 )
         OR
         (     cc.segment5 = '001-057-903-0000'
         AND NOT     d.amount < 0 )
         OR
         (     cc.segment5 = '008-070-501-0000'
         AND NOT     d.amount < 0 )
         OR
         (     cc.segment5 = '008-086-201-0000'
         AND NOT     d.amount < 0 ))
    ----------------------------------SUNDRY CREDIT QUALIFIER
    AND NOT     d.amount < 0
    ORDER BY      cc.segment5 ;
    PROCEDURE insert_sundry IS
    BEGIN
         INSERT INTO glcdbsnd
         COL     (
              col_account,
              col_amount,
              col_date
         VALUES(
              s_account,
              s_amount,
              h_checkdate
    END;
    ---------------- FORMAT SUNDRY PROCEDURE ------------------
    PROCEDURE format_sundry IS
    BEGIN
         s_account     :=     h_account;
         s_amount     :=     h_amount;
    END;
    --------------------- PROCEDURE DIVISION -----------------
    BEGIN
    DELETE glcdbrpt;
    DELETE glcdbsnd;
    --DELETE cdbsunmo;
    -------------------------------------- INPUT PARAMETERS
    SELECT      start_date, end_date
    INTO     v_startdate, v_enddate
    FROM     gl_periods
    WHERE     UPPER(period_name) = UPPER(v_period_name);
    --WHERE     period_name = 'Sep-00';
    ----------------------------------------------------------TITLE
    format_colheading0;
    insert_line;
    COMMIT;
    initialize_vars;
    insert_line;
    insert_line;
    COMMIT;
    initialize_vars;
    format_title1;
    insert_line;
    COMMIT;
    format_title2;
    insert_line;
    COMMIT;
    initialize_vars;
    insert_line;
    insert_line;
    COMMIT;
    ------------------------------------------------ MONTHLY SUNDRY SUMMARY
    initialize_vars;
    s_account := '                ';
    s_amount  := 0;
    h_account_sdr := '                ';
    h_amount_sdr  := 0;
    OPEN cur_sundry_cr_mo;
    OPEN cur_sundry_dr_mo;
    FETCH cur_sundry_cr_mo INTO h_account_scr, h_amount_scr;
    FETCH cur_sundry_dr_mo INTO h_account_sdr, h_amount_sdr;
    v_cur_acct_scr_ref := h_account_scr;
    v_cur_acct_sdr_ref := h_account_sdr;
    WHILE cur_sundry_cr_mo%FOUND
    OR      cur_sundry_dr_Mo%FOUND
    LOOP
    -------------------------------------------- TOTAL SUNDRY CREDIT PER ACCOUNT
         WHILE cur_sundry_cr_mo%FOUND
         AND h_account_scr = v_cur_acct_scr_ref
         LOOP
              v_sundry_credit_account := h_account_scr;
              v_sundry_cr_acct_total := v_sundry_cr_acct_total + h_amount_scr;
              v_sundry_credit_amount  := LPAD( v_sundry_cr_acct_total, 15, ' ');
              v_sundry_cr := v_sundry_credit_account || ' ' || v_sundry_credit_amount;
              h_account_scr := '                ';
              h_amount_scr  := '               ';
              FETCH cur_sundry_cr_mo INTO h_account_scr, h_amount_scr;
         END LOOP;
         v_cur_acct_scr_ref := h_account_scr;
    -------------------------------------------- SUNDRY DEBIT PER INSTANCE
         WHILE cur_sundry_dr_mo%FOUND
         AND h_account_sdr = v_cur_acct_sdr_ref
         LOOP
    -------------------------------------------- TOTAL SUNDRY DEBIT PER ACCOUNT
              v_sundry_debit_account := h_account_sdr;
              v_sundry_dr_acct_total := v_sundry_dr_acct_total + h_amount_sdr;
              v_sundry_debit_amount  := LPAD( v_sundry_dr_acct_total, 15, ' ');
              v_sundry_dr := v_sundry_debit_account || ' ' || v_sundry_debit_amount;
              FETCH cur_sundry_dr_mo INTO h_account_sdr, h_amount_sdr;
         END LOOP;
         v_cur_acct_sdr_ref := h_account_sdr;
    -------------------------------------------- WRITE LINE
         insert_line;
         initialize_vars;
         v_sundry_cr_acct_total := 0;
         v_sundry_dr_acct_total := 0;
    END LOOP;
    CLOSE cur_sundry_cr_mo;
    CLOSE cur_sundry_dr_mo;
    format_sundry_colhead3;
    insert_line;
    END glccshdb;Can you give me sample on how to put debugging lines using dbms_output here?
    I do not use TOAD or SqlDev to this the procudure....I only use SQL*Plus.
    Thanks a lot

Maybe you are looking for

  • How can I have the same Itunes on 2 computers?

    I used to do everything from work so I use my itunes there.  But when I want to do some changes/backups during the week-end, I can't since it's not the same itunes on my laptop. I use the same Apple ID though.   How can I make it the same ?? The one

  • After a recover database, how can I find the time of the last transaction?

    After doing a restore and recovery. Is there something in the data dictionary that I can query to find the time of the last applied transaction that took place during the recover process? restore database ; recover database ; For example, if I restor

  • Sharing libraries: two computers: wireless setting

    I'm having trouble sharing music between the libraries on my Mini and laptop. I am connected to the interest via a router, then both machines are connected wirelessly to the router. I can see and play the music on the laptop from the mini, but when I

  • Can not close application on Win2k

    Hi All: I did the following step to run the application: 1) start login window by using java -jar Login.jar 2) start main program by using java -jar Main.jar. The Main window has been popped up. Kicked off another window (Subwindow) by click on the i

  • Centring of captivate swf working (.....and then not working!)

    Hi this is a mystery to me but maybe someone will have an answer I have 5 slides been woking on them all weekend. I created a html container that centers the published swf  from captivate 5 perfectly Testing locally all works fine, uploading the same