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

Similar Messages

  • How to compile Oracle procedure throught ODI procedure

    Hi
    Can any one help me how to compile oracle procedure through ODI11g
    I am awar of that, how to call oracle procedure in ODI and execute it.
    Please help me
    Regards,
    Phanikanth

    You want to know how to compile, or how to call, or both ?
    I don't know for compilation, but call a procedure is simple.
    You juste have to create an ODI Procedure and write the SQL statement like you do in a query editor.

  • 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 call Oracle Procedure into ODI

    Hi,
    I'm using ODI 10g.
    Before executing the interface in a package i wanted to place my Procedure.
    I created following procedure in d/b (target)
    CREATE OR REPLACE PROCEDURE TEST_MY_NEW_PROCE
    AS
    BEGIN
    DELETE FROM EMPLOYEE_TABLE
    WHERE EMPLOPYEE_ID LIKE 'P%';
    COMMIT;
    END;
    The Procedure is working fine in target database.
    Now, before executing my interface i would like to run this procedure in my package. So, can some one please help me how to call this oracle procedure (Created in Target schema) into ODI and run this.
    thank you.

    Hi GRK,
    You can create an ODI procedure, add a single step, choose Oracle as Technology and your target schema.
    Then just call it through a pl/sql block :
    BEGIN
    TEST_MY_NEW_PROCE;
    END;Then drag this ODI procedure in your package.
    Regards,
    JeromeFr

  • 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

  • How to call oracle procedure in JPA?

    Hi,
    I am new to JPA.
    Can one help with a piece of code on how to call a procedure in JPA?
    Thanks

    Use the search, I answered this last week.

  • 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)

  • How To Pass Oracle Procedure Value using Tidal Oracle Database Job Definition to Tidal Variable

    how do i pass the parameter value from an oracle database tidal job to a tidal variable? for example i have this oracle db job that is defined to execute an oracle database procedure and i need to pass the parameter value to the tidal variable.
    SQL tab:
    begin
      procedure_get_user_info(<OracleUserVariable.1>);
    end;
    thanks,
    warren

    tesmcmd is a binary that sits in your TIDAL master installation bin directory. It takes options, one of which is varset which let's you set variable values.
    So you can run a system level script ( a unix example is given below) which can set values for group variables.
    Looking at your example you need to find a way to define OracleUserVariable.1
    Where does the value for this variable come from?
    Sample variable set script:
    GROUP_FILE_VAR=`echo $2 | sed -e 's/\.xml\.pgp/\.xml/'`
    tesmcmd varset -i $1 -n GROUP_FILE_XML -v $GROUP_FILE_VAR
    XSD_FILE_VAR=`echo $2 | sed -e 's/\.xml\.pgp/\.xsd/'`
    tesmcmd varset -i $1 -n GROUP_FILE_XSD -v $XSD_FILE_VAR
    And we call the job using
    setvar.sh <JobID..p> <Group.REQUEST_FILE>
    which are overrides from a file event.

  • How to execute oracle procedure from Unix

    Hi All,
    Could you please help me in Unix commands.
    we have different databases i want to run one procedure from unix for one database.
    How can i run pls give me the flow.
    Thanks,

    Oracle wrote:
    Hi All,
    Could you please help me in Unix commands.
    we have different databases i want to run one procedure from unix for one database.
    How can i run pls give me the flow.
    Thanks,you give the command to launch sqlplus, and pass it the appropriate sql or sqlplus commands.
    Like this:
    oracle> sqlplus /nolog <<EOF
    conn / as sysdba
    exec mystoredprocedure
    exit
    EOFor this
    oracle> sqlplus /nolog @somefile.sqlwhere 'somefile.sql' has the sqlplus commands needed.

  • How to debug a procedure in an attached library?

    Hi everybody,
    I am working with Developer Suite 10g on a 9iR2 database.I am 'playing' with F90UTIL pl/sql library which comes with the Forms Demos (downloaded from otn).
    I created a form to which I attached the F90UTIL library. On a WHEN-BUTTON-PRESSED trigger I call the function f90write.write_html (package f90write belongs to F90UTIL library). At run-time something is not working properly, the execution hangs in the write_html function....
    I want to execute write_html function step by step in order to see what happens by placing a breakpoint in it. How can I debug this function?. In Object Navigator, under node Attached Libraries I select the function write_html of the F90UTIL library, mouse right click ,choose PL/SQL Editor but nothing happens.
    So, how can I debug this functions?Why can't I see it's PL/SQL code in object navigator (under Attached Libraries Node) in order to put a breakpoint?
    Any help will be appreciated.
    thank you
    daniela

    Hi Gerd,
    That's exctly how I did it. I have a breakpoint in the WHEN-BUTTON-PRESSED trigger whose code looks like this:
    declare
    v_dummy number;
    some_other_declarations;
    begin
    some_code_1;
    v_dummy := f90write.write_html(some_parameters);
    some_code_2;
    end;
    I go through the code with F7. But when I get to the line v_dummy := f90write.write_html(some_parameters); everything hungs, it won't go further, it won't step into the write_html function. That's why I thought to put a breakpoint inside write_html function in order to see what happens ...

  • How to use Oracle Procedures with Servlet page

    Hi all
    I'm working on Servlet pages and I need to insert and select some records from Oracle database but it has to be done by calling some already written Procedures. I've never really used them before so I'm little lost. I know where the queries are used it'll be Procedures but what is the syntax for it.Can anyone put me in right direction please.
    Thanks

    Just google it. You will find lots of examples. Here are some :
    [http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html|http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html]
    [http://onjava.com/pub/a/onjava/2003/08/13/stored_procedures.html|http://onjava.com/pub/a/onjava/2003/08/13/stored_procedures.html]

  • How to call oracle procedure from vb

    i created a procedure in oracle8.1.7 to return on value,look the following script:
    Procedure P_COUNT (r out number)
    IS
    BEGIN
    select count(*) into r from demo;
    END;
    but i can get the value from VB,i display some errors:
    ORA-06502 PL/SQL: numeric or value errorstring
    ORA-06512 at stringline string
    what can i do now?
    null

    Hei Zhang,
    Thank You. You can return Cursor in many ways. You can write either a function to return cursor (return type is %ROWTYPE) or a package. Writing a Package seems laborious but I like it as it has lot of flexibility.
    I will give you the example for the second type:
    -- 1) Create a Package first:
    CREATE OR REPLACE PACKAGE pk_MyPackage AS Type RT1 IS RECORD (
    sp_ename emp.ename%TYPE,
    sp_job emp.job%TYPE,
    sp_mgr emp.mgr%TYPE
    TYPE RCT1 IS REF CURSOR RETURN RT1;
    END;
    sho err
    -- 2) Create a Procedure:
    CREATE OR REPLACE PROCEDURE sp_MyProcedure (
    in_empno emp.empno%TYPE,
    RC1 IN OUT pk_MyPackage.RCT1
    ) AS
    BEGIN
    OPEN RC1 FOR
    SELECT ename,
    job,
    mgr
    FROM emp
    WHERE empno = in_empno;
    RETURN;
    END;
    sho err
    --Testing
    SQL> var cr refcursor
    SQL> exec sp_MyProcedure (7934, :cr)
    PL/SQL procedure successfully completed.
    SQL> print cr
    ENAME JOB MGR
    MILLER CLERK 7782
    Hope this is clear and helps you to complete your task.
    Cheers!
    r@m@

  • How to debug Oracle VPD Security Query?

    Hi,
    I have implemented vpd.
    But I want to see what query Oracle is generating in back end while I am applying a simple select statement on the table.
    I have searched in V$SQL, V$SQLAREA, it is not there.
    So where I have to see?
    Thanks,
    Sunil Jena
    Edited by: 990324 on Feb 27, 2013 6:06 AM

    It sounds like you want to look at v$vpd_policy. The PREDICATE column will show you each predicate that has been applied by VPD to a particular SQL_ID and the POLICY column will tell you which policy applied that predicate.
    Justin

  • How to debug oracle forms 4.5 application

    Ww have an application which is behaving badly. We have no documentation on it ,nor any source code. It seems to be written in Oracle forms 4.5 ( of which I know little) . There is an applications directory with about 100 files ,all with ending .fmx . these look like forms config files. I really want to find out what queries this app is sending and what it is receiving. Is there any way to decompile this application to get the source ?
    Thanks

    The FMX files are the compiled forms code, the executables. Without their FMB files you have no chance of getting at the Forms source.
    You could try to find out what queries they are issuing by finding the sessions (V$SESSION.PROGRAM should allow you to identify the sessions that connect through Forms) and thus the queries (through Userid to V$SQLAREA).
    However, without the source code there's not much you can actually do about it.
    Cheers, APC

  • How to create a procedure in oracle to write the data into file

    Hi All,
    I am just wondered on how to create a procedure which will do following tasks:
    1. Concat the field names
    2. Union all the particular fields
    3. Convert the date field into IST
    4. Prepare the statement
    5. write the data into a file
    Basically what I am trying to achieve is to convert one mysql proc to oracle. MySQL Proc is as follows:
    DELIMITER $$
    USE `jioworld`$$
    DROP PROCEDURE IF EXISTS `usersReport`$$
    CREATE DEFINER=`root`@`%` PROCEDURE `usersReport`(IN pathFile VARCHAR(255),IN startDate TIMESTAMP,IN endDate TIMESTAMP )
    BEGIN
    SET @a= CONCAT("(SELECT 'User ID','Account ID','Gender','Birthdate','Account Registered On') UNION ALL (SELECT IFNULL(a.riluid,''),IFNULL(a.rilaccountid,''),IFNULL(a.gender,''),IFNULL(a.birthdate,''),IFNULL(CONVERT_TZ(a.creationDate,'+0:00','+5:30'),'') INTO OUTFILE '",pathFile,"' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\n' FROM account_ a where a.creationDate>='",startDate,"' and a.creationdate <='",endDate,"')");
    PREPARE stmt FROM @a;
    EXECUTE stmt;
    DEALLOCATE PREPARE stmt ;
    END$$
    DELIMITER ;
    Regards,
    Vishal G

    1. Concat the field names
    Double Pipe (||) is the concatenation operator in Oracle. There is also a function CONCAT for this purpose
    2. Union all the particular fields
    Not sure what do you mean by UNION ALL particular fields? UNION ALL is a set operation applied on two different result sets that have the same projection.
    3. Convert the date field into IST
    SQL> select systimestamp "Default Time"
      2       , systimestamp at time zone 'Asia/Calcutta' "IST Time"
      3    from dual;
    Default Time                                       IST Time
    05-05-15 03:14:52.346099 AM -04:00                 05-05-15 12:44:52.346099 PM ASIA/CALCUTTA
    4. Prepare the statement
    What do you mean by prepare the statement?
    5. write the data into a file
    You can use the API UTL_FILE to write to a file.

Maybe you are looking for

  • One hdmi input on my TV

    my tv only has 1 hdmi input which i use between the cable box and the tv.  i now have apple TV and don't want to have to disconnect the cable box and attach the apple tv each time i want to use it.  can i use a hdmi spliter?

  • Using variables in Calc scripts and Business Rules

    I am sure there have been previous discussions about this, but can somebody let me know the benefits of using variables in Calc scripts and BRs? Thanks, A

  • Bank overdraft accounting process in ECC6

    Hi, how configurate the bank overdraft process below? Is it possible to post mannually overdraft account procedure? the posting procedure is the following, i.e. vendor process : - purchasing : charge credit150u20AC/debit vendor 150u20AC - payment : d

  • ORA-14508 errors within ValidStruct job

    Hello! After the ValidStruct job in our SAP EHP4 system we get the following errors: ORA-14508: specified VALIDATE INTO table not found                                       BR0893E Validating structure failed for table/cluster SYS.STREAMS$_APPLY_SPI

  • Create barcode labels in the background, immediately creating the MIGO

    Dear all I'm interested to create barcode labels in the background, immediately after creating the MIGO. 1. Is there any standard program that I can integrate my code that sends data to SMARTFORM? 2. Is there a BAPI that gets, in the background, the