Exception management - inside the procedure

Hello

I'm trying to insert records into our target within a cursor table.

(For after the analysis of the values of the Source table and to make changes in the format of the value and insert into the target table)

I need to capture the exception within the cursor and save these exception in an error table.

I use the exception within the cursor for loop block.

example code:

C1 loop c_cursor1

Start

... Insert the statement after the analysis of the values...

exception

while others

then

DBMS_OUTPUT. Put_line (' error code: ' |) SQLCODE);

dbms_output.put_line (' error: ' |) SQLERRM);

end;

end loop;

Examples of exception scenarios:

1)

Error report:

ORA-01476: divisor is equal to zero

ORA-06512: at "APX_DEVELOPMENT. PKG_CUSTOMER_FEDERATION', line 165

ORA-06512: at line 3 level

01476 00000 - "the divisor is equal to zero.

Error code: - 1476

Error message: ORA-01476: divisor is equal to zero

2)

Error report:

ORA-12899: value too large for column 'APX_DEVELOPMENT '. "" "" RG_ORIGINATOR '. "" CREATED_BY' (real: 14, maximum: 10)

ORA-06512: at "APX_DEVELOPMENT. PKG_CUSTOMER_FEDERATION', line 133

ORA-06512: at line 3 level

12899 00000 - "value too large for column %s (actual: %s, maximum: %s)).

Error code: - 12899

Error message: ORA-12899: value too large for column 'APX_DEVELOPMENT '. "" "" RG_ORIGINATOR '. "" CREATED_BY' (real: 14, maximum: 10)

I use SQLCODE and SQLERRM to capture the codes and messages.

But how to capture the package or the procedure name, and line number.

for example. I need to capture something like below

ORA-06512: at "APX_DEVELOPMENT. PKG_CUSTOMER_FEDERATION', line 165

ORA-06512: at "APX_DEVELOPMENT. PKG_CUSTOMER_FEDERATION', line 133

How to get to this

Thanks in advance for your help.

Please let me know for further details.

Use dbms_utility.format_error_backtrace... Check below...

http://docs.Oracle.com/database/121/ARPLS/d_util.htm#i1003874

Thank you

Ann

Tags: Database

Similar Questions

  • How to compile packge inside the procedure that uses this package

    ORACLE 10g, 11g

    CREATE OR REPLACE PACKAGE PKG_TEST_COMMIT
    PROCEDURE Insert_into_table_T1;
    PROCEDURE Update_table_T1;
    END PKG_TEST_COMMIT;

    CREATE OR REPLACE PROCEDURE PROC_TEST_COMMIT as
    Begin
    PKG_TEST_COMMIT. Insert_into_table_T1; -Insert data into table T1
    EXECUTE IMMEDIATE 'DROP table T1;
    IMMEDIATE EXECUTION
    "create table T1 as select"1 ","d"," s "from DUAL;" -now PKG_TEST_COMMIT package at the stage not compiled
    -compile the package
    DBMS_DDL.alter_compile ('PACKAGE', 'OWNER', "PKG_TEST_COMMIT");
    PKG_TEST_COMMIT. Update_into_table_T1;
    End PROC_TEST_COMMIT;

    When I try to run the PKG_TEST_COMMIT I get an error: cannot lock the package.
    I tried to create a separate procedure for compiling, but the result is the same.
    If I'm done PROC_TEST_COMMIT before compiling, then compile - OK.

    It's a way to compile the package inside the procedure?

    TRUNCATE and INSERT / * + APPEND * / should be more effective than deleting them and recreating a table wouldn't it because you don't have to worry about the invalidation and recompilation of all dependent objects.

    Justin

  • Timer of $ v (view does not exist) inside the procedure

    Hello

    I am very new to Oracle, please forgive me in advance for the novice questions. DB = Oracle 9i R2, develop using SQL Developer 1.51.5440. I'm an admin on a test server account. On the screen of the application, I can run this query:

    SELECT hsecs FROM V$ TIMER

    Inside a procedure, this line hsecs SELECT INTO pseudoRandomSeed OF V$ TIMER;

    failed to compile with error: "Error (19.43): PL/SQL: ORA-00942: table or view does not exist. What is the reason why I can run the query outside of the procedure, but not on the inside? And how to fix it?

    I tried to GRANT SELECT on the view SYS.v_$ timer to my user. But I don't know the SYS pwd and wonder if it would be the solution. Because my account is already the admin of the schema.

    Can you please suggest a solution or links to documentation topics where I can continue the investigation.

    Thaks in advance for any help.

    V_$ TIMER is owned by SYS. Ask your DBA or connect as SYSDBA and issue:

    GRANT SELECT ON V_$TIMER TO your-username;
    

    Then log in as your user name and the compilation.

    SY.

  • Logic inside the procedure should be run only in environments dev and qa

    Hi all

    I need to create the procedure and the logic with the procedure should be called in development and qa (testing) environment only and not in production.

    Version: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi

    The procedure should be in all environments, that it is the requirement.

    Please advice me which I can create the logic.

    Thank you
    Rambeau

    Dear

    Within your stored procedure, use as a kind of PL/SQL code to get the database of runing

    SELECT case
              when instr (global_name, '.') > 1
                 then substr (global_name, 1, instr (global_name, '.') - 1)
              else global_name
           end global_name
       INTO lv_database_name
       FROM global_name;
    

    and keep it

      if lv_database_name in ('your_sid_dev', 'your_sid_test)
      then
        your executable code goes here
     end if;
    

    Best regards

    Mohamed Houri

  • How to call the page url inside the procedure.

    Hello


    I'm not exhibition in plsql.
    I have some problem in utl_http link.

    I create a procedure. The procedure has been compiled successfully. But the page url does not open...

    I have attached the procedure,

    create or replace procedure p (number of mob)
    IS
    long l_page;
    l_url varchar2 (25000 char);

    Start
    null;
    l_page: = utl_http.request ("http://www.yahoo.com");
    end;


    Please tell me the solution for this problem...


    I await your response.

    Thank you
    Sasi.

    This is a duplicate thread:

    How to open the web page in pl/sql

    the OP doesn't seem to understand the difference between a web browser and a programming language... I can't say I've ever had to explain the difference before...

    Let's say that... the butterflies are not somehow similar to razors electric...

  • Driver management concluded the procedure to install the driver NULL for the Instance ID of device USB\VID_04E8 & PID_6601\5 & 9D6A4B1 & 0 & 7 with the following status: 0xe0000203.

    What dose it mean. and what do I do about it.

    Hello

     
     
    Put the computer to boot and see if the problem persists.
    To help resolve the error and other messages, you can start Windows 7 by using a minimal set of drivers and startup programs. This type of boot is known as a "clean boot". A clean boot helps eliminate software conflicts.
     

    Note: follow step 7 to reset the computer to start as usual after the boot process.
     
    Note: Also try unplugging your USB devices (including readers, printers, mouse... all added the USB device) one by one until the message no longer appears.

    Hope this information helps.
  • How do you manage exceptions / errors in stored procedures?

    How do you manage exceptions / errors in stored procedures?

    Exceptions/errors can be handled in different ways in the stored procedures.
    (1) could be using an EXCEPTION block in the procedure in which to use WHEN THEN.
    (2) may declare a variable in the DECLARE section as EXCEPTION type,
    raise it to the extent necessary using STIMULUS and manipulate in EXCEPTIONAL setting using the WHEN clause.
    (3) could use keywords SQLCODE & SQLERRM to display no errors and the error code...

  • Back ON param in the middle of the procedure

    Hello world

    Hope all is well on your side. I'm stuck on a problem of PL/SQL coding. I'm using Oracle 11.2.0.3.0. Please find below the script. I have a procedure that has a DML and send me an OUT parameter. DML is run, I need to run a procedure more inside the main procedure at the same rate, but I have no need to wait inside the procedure ends. I have to return the OUT parameter, as soon as my DML statement in the main procedure is finished.

    Main procedure:

    CREATE or REPLACE PROCEDURE INSERT_DATE (v_rows ON NUMBER)

    AS

    BEGIN

    INSERT INTO TEST_DATE (REF_DATE) VALUES (SYSDATE);

    v_rows: = SQL % ROWCOUNT;

    commit;

    execute UPDATE_SP;

    END;

    Procedure of the child:

    CREATE OR REPLACE PROCEDURE UPDATE_SP

    AS

    BEGIN

    UPDATE TABLE SET COL1 = 'TEST ';

    UPDATE TABLE2 SET COL1 = 'TEST ';

    COMMIT;

    END;

    The two proceedings are unrelated to each other by any functionality. Once the insertion will be in TEST_DATE, we UPDATE_SP kick-off procedure. But I am not concerned by UPDATE_SP is completed, or has failed. The only thing is I don't want to wait the INSERT_DATE procedure to wait that the procedure UPDATE_SP in the end to get to the OUTPUT parameter.

    Objective: I need to insert a record in TEST_DATE, back ON setting and kick off UPDATE_SP.

    Please let me know if you need more information.

    Thanks in advance. Answers and comments will be appreciated.

    Concerning

    Dev

    You could create a job (either using dbms_job and dbms_scheduler) who will UPDATE_SP in a separate session of INSERT_DATE.

    If you don't care if UPDATE_SP succeeds or fails, however, why you call it in the first place?

    Justin

  • the exception in the procedure call management

    Hello

    I have a package where currently make phone calls to private public process procedures.

    and the senario is: -.

    create package body p_tst
    is

    ex_failed exception;

    -It's private proc
    procedure p_private
    is
    Start
    .
    .
    raise ex_failed;
    exception
    When ex_failed
    then
    lift;
    .........
    end p_private;

    procedure p_public
    is
    Start
    ....
    -nomaking appeal to the private sector
    -procedure
    p_private;

    -Here, I need to catch
    -the exception thrown
    -past of callee
    -procedure
    When ex_failed
    ...
    end p_public;

    end;

    Basically, I want to catch any exception of procedure called passed to the procedure call and raise the same exception by calling procedure.

    is it possible to intercept the exception even in the calling procedure?

    Yes, p_private throws the exception, it will be taken by p_public and the program stops after dbms_output.

  • Can we call the procedure inside the function?

    Hello

    Can we call the procedure inside the function?

    Thank you
    Brij

    845712 wrote:

    Can we call the procedure inside the function?

    Strange question to ask.

    Yes. This is the standard behavior in most (if not all) procedural and object oriented languages.

    A procedure, function or a method is a unit of code.

    You can call one of the other units. Units can call themselves (recursion). Technically, this means simply by pushing the battery current (to save the stack of the current device memory), the call to the new unit and then popping up battery when control is returned to the unity of the appellant.

    There are very few exceptions to this. The only one that comes to mind programming languages I've used through the years, is natural 1 - could not call a new unit of code to replace the existing one in memory. If no call-and-return was possible.

    Exactly what did you ask this question? Some newcomers to confused Oracle SQL and PL/SQL - two different languages aside server. And then also mistaken for PL/SQL client command vocabulary of SQL * more.

    You will need to make sure that understand the basics of programming (applies to most current programming languages) and Oracle concepts.

  • How empy and replace the buttons inside the Manager of horizontal management.

    Hello! So basically, I have 2 buttons at the top of the screen and a set of buttons inside a HorizontalFieldManager (let's call is Set 1 and 2). Now, when I click on the first button it should appear a Set 1 and then appear Set 2 and remove the Set1 on screen. How can I do this? Thank you!

    -Ryan

    The details in the referenced thread, you should get going.

    Basically, you add and remove fields.

    I suggest that you have a Manager to Set 1 and a Manager for value 2.  Add the two managers to the screen, with nothing in it,

    Make sure that Manager 2 is empty (deleteAll) and add fields associated with the value 1 to the Manager for the value 1, when they should be displayed - i.e. trigger it by pressing button 1.

    Remove the fields in Manager 1 and add the fields associated with the value 2 to the Manager for Set 2, when they should be displayed - i.e. trigger this by pressing button 2.

    I hope this helps.

  • What is the procedure of upgrading since version 7.1 of CUCM (MCS Server) call manager to version 10.2 of CUCM (on the server of the UCS)

    Hello

    What is the procedure to upgrade the call manager since version 7.1 of CUCM (MCS Server) to version 10.2 of CUCM (on the server of the UCS), please let me know the steps to what would be the backup procedures and upgrades.

    Concerning

    Gerard

    I suggest reading this guide to make sure that you have prepared your environment to support the first 10.x. The link below also contains the path to upgrade to 10.0 (1).

    One of the ways to do this is:

    1 / apply cooling cop upgrade file on all servers in the cluster.

    2 / upgrade the cluster to 8.6 (2). Make a backup of the cluster.

    3 / build a cluster of servers 8.6 (2) on the virtual machines and assign them the same host name and the IP address of the cluster hardware. (You may need to keep these on a separate network until turn off hardware machines)

    4 / restoration of the backup of the pile of material on the VM cluster.

    5 / upgrade cluster VM to 10.0 (1).

    http://www.Cisco.com/c/en/us/TD/docs/voice_ip_comm/CUCM/upgrade/10_0_1/C...

  • Continue the block after the exception management

    The guys in the slot block.

    create or replace procedure proc_case
    (p_in IN number)
    is
    begin
    case p_in
    when 1 then
    dbms_output.put_line('its one'); 
    when 2 then
    dbms_output.put_line('its two'); 
    end case;
    dbms_output.put_line('after the exception handler'); 
    exception when case_not_found then
    dbms_output.put_line('its not found'); 
    end;
    

    When the procedure is executed as follows.

    begin
    proc_case(3);
    end;
    

    It shows the statement in the block of exception, but after that it does not run the statement following the exception handler and the outputs of the block, how can I execute the statement after the end case statement. I do not use the Else statement in case because I wanted to understand the logic of this block.

    CREATE OR REPLACE

    PROCEDURE proc_case

    (

    p_in in NUMBER)

    IS

    BEGIN

    BEGIN

    P_in CASE

    WHEN 1 THEN

    dbms_output.put_line ('the one');

    WHEN 2 THEN

    dbms_output.put_line ('two');

    END CASE;

    EXCEPTION

    WHEN case_not_found THEN

    dbms_output.put_line ("' its not found");

    END;

    dbms_output.put_line ("' after the exception handler");

    END;

  • Hi, I created the procedure and its code is / / DELETE FROM <? = odiRef.getObjectName ("L", "TRG_SALES", "ORACLE_ORCL_LOCAL_SALES", "", "D")? > / / and when I'm running, the error appeared //com.sunopsis.tools.core.exception.SnpsSimpleMessageExcepti

    Hi, I created the procedure and its code is / / DELETE FROM <? = odiRef.getObjectName ("L", "TRG_SALES", "ORACLE_ORCL_LOCAL_SALES", "", "D")? > / / and when I'm running, the error appeared.

    com.sunopsis.tools.core.exception.SnpsSimpleMessageException: ODI-17517: error in the interpretation of the task.

    Task: 1

    java.lang.Exception: the application script threw an exception: com.sunopsis.tools.core.exception.SnpsSimpleMessageException: Exception getObjectName ("L", "TRG_SALES", "ORACLE_ORCL_LOCAL_SALES", "DEVELOPMENT", "D"): SnpLSchema.getLSchemaByName (): SnpLschema is no information OSB: Delete_Tar_Sales on line: column 0: columnNo

    at com.sunopsis.dwg.codeinterpretor.SnpCodeInterpretor.transform(SnpCodeInterpretor.java:489)

    at com.sunopsis.dwg.dbobj.SnpSessStep.createTaskLogs(SnpSessStep.java:737)

    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:465)

    at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2128)

    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$ 2.doAction(StartSessRequestProcessor.java:366)

    at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)

    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)

    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$ 0 (StartSessRequestProcessor.java:292)

    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$ StartSessTask.doExecute (StartSessRequestProcessor.java:855)

    at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)

    to oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$ 2.run(DefaultAgentTaskExecutor.java:82)

    at java.lang.Thread.run(Thread.java:662)

    Caused by: java.lang.Exception: the application script threw an exception: com.sunopsis.tools.core.exception.SnpsSimpleMessageException: Exception getObjectName ("L", "TRG_SALES", "ORACLE_ORCL_LOCAL_SALES", "DEVELOPMENT", "D"): SnpLSchema.getLSchemaByName (): SnpLschema is no information OSB: Delete_Tar_Sales on line: column 0: columnNo

    at com.sunopsis.dwg.codeinterpretor.SnpCodeInterpretor.transform(SnpCodeInterpretor.java:476)

    ... 11 more

    Caused by: org.apache.bsf.BSFException: the application script threw an exception: com.sunopsis.tools.core.exception.SnpsSimpleMessageException: Exception getObjectName ("L", "TRG_SALES", "ORACLE_ORCL_LOCAL_SALES", "DEVELOPMENT", "D"): SnpLSchema.getLSchemaByName (): SnpLschema is no information OSB: Delete_Tar_Sales on line: column 0: columnNo

    at bsh.util.BeanShellBSFEngine.eval (unknown Source)

    at bsh.util.BeanShellBSFEngine.exec (unknown Source)

    at com.sunopsis.dwg.codeinterpretor.SnpCodeInterpretor.transform(SnpCodeInterpretor.java:471)

    ... 11 more

    Text: REMOVE OF <? = odiRef.getObjectName ("L", "TRG_SALES", "ORACLE_ORCL_LOCAL_SALES", "", "D")? >.

    at com.sunopsis.dwg.dbobj.SnpSessStep.createTaskLogs(SnpSessStep.java:764)

    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:465)

    at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2128)

    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$ 2.doAction(StartSessRequestProcessor.java:366)

    at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)

    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)

    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$ 0 (StartSessRequestProcessor.java:292)

    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$ StartSessTask.doExecute (StartSessRequestProcessor.java:855)

    at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)

    to oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$ 2.run(DefaultAgentTaskExecutor.java:82)

    at java.lang.Thread.run(Thread.java:662)

    If you do this in a procedure, use the following syntax:

    <%=odiRef.getObjectName("L", "TRG_SALES", "D")%>

    and set the relevant logical schema in the options on the target tab of the procedure. Also, make sure you only select the correct technology type in the options on the target tab.

  • How do I inject inside the ODI 11 G PL/SQL (not function procedure)

    Hello Expert,

    would be like double until OWB and ODI OWB 11 G I wich 'The user function' run PL/SQL and it remove some data in the table and the reel journal, is possible that I can do the same thing in ODI, in my case, I can't call function, or a procedure stored outside the ODI. See below the part of the PL/SQL based on user OWB.

    coil MyFile... Journal

    command prompt

    create table MyTable as

    Select a.*

    Of...

    commit;

    command prompt

    spool off;

    "exit";

    Thank you!

    You can run a PL within a procedure, you simply copy paste your PL and place in a procedure inside the ODI.

    I hope this can help you!

Maybe you are looking for

  • Business PC HP Elite 8100 SFF: Problem upgrade memory with operating system to 64 b.

    I have a small form Factor Business PC HP Compaq 8100 Elite, with 2 GB RAM and Intel Core i5-650 3.2GHz (n ° 2 x 1 GB 240pin DDR3 SDRAM Unbuffered DIMM DDR3-1333 - hynix HMT112U6TFR8C-H9 https://www.skhynix.com/products/computing/view.jsp?info.ramKin

  • m9500f CPU

    Hey guys... I was just wondering I have currently a Phenom X 4 9750 here... is possible to get a faster microprocessor for this computer? Thank you

  • How can I open Outlook backup?

    My wonderful Windows XP (2002) became corrupt and all trying to fix with line technicians complete it froze in the adjustment buckle.  I bought a new PC with Windows 7. (Old PC was in 2002.  I always). I was able to recover most of the material I had

  • DVD player disappears

    Is there a 'fix' for DVD drive disappearing, using Windows 7 Pro on a Dell Latitude D810 laptop?  The physical drive shows in Ant 'Computer' then made a Houdini!

  • I changed my computer and I get an error code 131:4 I need to know what to do to access my CS4.

    I just transferred my Adobe CS4 to a macbook pro to an imac and I can't run any programs.  I get an error code 131:4 does anyone know what it is?