Return statment for dynamic LOV - exception handling

Hello All,
Good Morning.
Oracle 11g, apex 3.2.1
I am having an dynamic LOV with a return statement.
code :-
==========================
declare
owner varchar2(12) :='';
stmt varchar2(4000) :='';
No_Records_Exception exception ;
phase varchar2(30);
year varchar2(30);
month_quarter varchar2(30);
begin
stmt :='select distinct famid d, famid r from '
||:P1_SCHEMA||'.'||'FMLY';
return stmt;
exception
when No_Records_Exception then
raise_application_error (-20998 , ' Schema does not exist ' );
when OTHERS then
raise_application_error (-20999,' Select the schema first ' );
end;
===================
My question is - why the exception is not handled when there are no table found.
Am getting the following errr ..
Error: ORA-06550: line 1, column 120: PL/SQL: ORA-00903: invalid table name ORA-06550: line 1, column 7: PL/SQL: SQL Statement ignored performing List of Values query: "select distinct famid d, famid r from .FMLY".
Pls let me know how to handle this error.. if the table is invalid.
scenario for poping this error:-
==================
I am having three "select list with redirect" items and one radio group ( having two Radion buttons - Relation , Famid )
The requirement is when the user selects Famid radio then the lov is suppose to populate the multiselect list with famid values from table P2D2008M05.FMLY and the schema P2D2008M05 is selected from three list items
P2D, 2008 , M05 one from each item .
If the schema is not selected and the user selects radio famid , then the error is coming , I need to put a validation or error handling mechanism when in which ,if the user selects famid radio and the schema is not selected , I need to raise an exception with proper error message to the user saying that the schema is not selected.
Pls helpin this regard.
Thanks/kumar.

Hi,
Your exception is for function that return select.
Error is raised when Apex procedures try use select your function returns.
You need test your select inside function or create validations
Your function could look something like this
DECLARE
  stmt    VARCHAR2(4000);
  l_count NUMBER;
BEGIN
  IF NVL(:P1_SCHEMA,'%'||'null%') = '%'||'null%' THEN
    raise_application_error (-20999,' Select the schema first ' );
  END IF;
  SELECT COUNT(1) INTO l_count FROM all_users WHERE username = :P1_SCHEMA ;
  IF l_count = 0 THEN
    raise_application_error (-20998 , ' Schema does not exist ' );
  END IF;
  stmt :='select distinct famid d, famid r from ' ||:P1_SCHEMA ||'.' ||'FMLY';
  RETURN stmt;
END;That is just example, I did not test it. And I think it is not good idea raise errors inside LOV function.
You should use Apex after submit validations
Br,Jari

Similar Messages

  • Return code for dynamic client by-pass

    hi,
    i wonder if 302 ( move temporaily) for return code in dynamic client by-pass. but it said 200 in the Cisco web page, why?
    thanks
    difei

    hi,
    my question is what's the return code from CE if the client ip addr. authentication failed? in cisco web page, it said 200. i guess it be 302, redirect to the original server.
    difei

  • Give me a idea for null pointer exception handling in java

    dear friends,
    Now i'm doing one program thats read a xml file element and store on txt file in java.now it's working but i have one problem.The problem is the parent node have number of child node.For a example, now i read the file.The first parent have a 5 child.that time work.the next parent have a 4 child this time one child is not on there.so now my program show one run time error.thats "NullPointerException" please give me a solution.its very urgently.
    advance Thanks !

    import java.io.*;
    import org.w3c.dom.Document;
    import org.w3c.dom.*;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.DocumentBuilder;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    public class rsk1{
    public static void main (String argv []){
    try {
                   int j=0,arry=0;
                   FileWriter Out = new FileWriter("file1.txt");
                   BufferedWriter f1 = new BufferedWriter (Out);
    DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
    Document doc = docBuilder.parse (new File("Transaction.xml"));
    // normalize text representation
    doc.getDocumentElement ().normalize ();
    System.out.println ("Root element of the doc is " +
    doc.getDocumentElement().getNodeName());
    NodeList listOfPersons = doc.getElementsByTagName("transactionid");
    int totalPersons = listOfPersons.getLength();
    System.out.println("Total no of people : " + totalPersons);
    arry = totalPersons * 5;
    String sr[] = new String[arry];
                   String s1=" ";
                   int k=0;
    for(int s=0; s<listOfPersons.getLength() ; s++,k++){
    Node firstPersonNode = listOfPersons.item(s);
    for(int r=0; r<4;r++)
    if(firstPersonNode.getNodeType() == Node.ELEMENT_NODE){
    Element firstPersonElement = (Element)firstPersonNode;
    NodeList firstNameList = firstPersonElement.getElementsByTagName("item");
    Element firstNameElement = (Element)firstNameList.item(r);
    NodeList textFNList= firstNameElement.getChildNodes(); //ERROR OCCUR IN THIS LINE
    sr[++j]=((Node)textFNList.item(0)).getNodeValue().trim();
    }//end of if clause
    }//end of for loop with s var
    System.out.println("Process completed");
    for(int i=1;i<=j;i++)
         f1.write(sr);
                                       f1.write(" ");
                                       if(i%3==0)
                                            f1.newLine();
    f1.close();
    }catch (SAXParseException err) {
    System.out.println ("** Parsing error" + ", line "
    + err.getLineNumber () + ", uri " + err.getSystemId ());
    System.out.println(" " + err.getMessage ());
    }catch (SAXException e) {
    Exception x = e.getException ();
    ((x == null) ? e : x).printStackTrace ();
    }catch (Throwable t) {
    t.printStackTrace ();
    }//end of main

  • Good exception handling policy for Java web application

    I'm looking for a good exception handling policy for Java web application. First I found this Java exception handling best practices - How To Do In Java which says that you should never catch the Trowable class nor use e.printStackTrace();
    Then I found this Oracle page The Message-Driven Bean Class - The Java EE 6 Tutorial, which does just that. So now I'm confused. Is there a good page online for an exception handling policy for Java EE Web applications? I have a hard time finding one. I've read that you should not catch the Exception class. I've been catching it previously to make sure that some unknown exception doesn't slip through early in the loop and stops all other customers from executing later on in the loop. We have a loop which runs once a minute implemented using the Quartz framework. Is it OK if you just change the implementation to catch the RuntimeException class instead of the Exception class? We're using Java 7 and the Jetty Servlet Container.

    I'm looking for a good exception handling policy for Java web application.
    If you have not done so I suggest you start by reviewing the several trails in The Java Tutorials.
    Those trails cover both HOW to use exceptions and WHEN to use them.
    This trail discusses  the 'controversy' you mention regarding 'Unchecked Exceptions'
    http://docs.oracle.com/javase/tutorial/essential/exceptions/runtime.html
    Unchecked Exceptions — The Controversy
    Because the Java programming language does not require methods to catch or to specify unchecked exceptions (RuntimeException, Error, and their subclasses), programmers may be tempted to write code that throws only unchecked exceptions or to make all their exception subclasses inherit from RuntimeException. Both of these shortcuts allow programmers to write code without bothering with compiler errors and without bothering to specify or to catch any exceptions. Although this may seem convenient to the programmer, it sidesteps the intent of the catch or specify requirement and can cause problems for others using your classes.
    Why did the designers decide to force a method to specify all uncaught checked exceptions that can be thrown within its scope? Any Exception that can be thrown by a method is part of the method's public programming interface. Those who call a method must know about the exceptions that a method can throw so that they can decide what to do about them. These exceptions are as much a part of that method's programming interface as its parameters and return value.
    The next question might be: "If it's so good to document a method's API, including the exceptions it can throw, why not specify runtime exceptions too?" Runtime exceptions represent problems that are the result of a programming problem, and as such, the API client code cannot reasonably be expected to recover from them or to handle them in any way. Such problems include arithmetic exceptions, such as dividing by zero; pointer exceptions, such as trying to access an object through a null reference; and indexing exceptions, such as attempting to access an array element through an index that is too large or too small.
    Generally don't catch an exception unless you plan to HANDLE the exception. Logging, by itself is NOT handliing.
    First I found this Java exception handling best practices - How To Do In Java which says that you should never catch the Trowable class nor use e.printStackTrace(); 
    That article, like many, has some good advice and some poor or even bad advice. You get what you pay for!
    I've read that you should not catch the Exception class.
    Ok - but all that does is indicate that a problem of some sort happened somewhere. Not very useful info. Java goes to a lot of trouble to provide specific exceptions for specific problems.
    I've been catching it previously to make sure that some unknown exception doesn't slip through early in the loop and stops all other customers from executing later on in the loop.
    If the exception is 'unknown' then maybe it NEEDS to 'stop all other customers from executing later on in the loop'.
    That is EXACTLY why you don't want to do that. You need to identify which exceptions should NOT stop processing and which ones should.
    Some 'unknown' exceptions can NOT be recovered and indicate a serious problem, perhaps with the JVM itself. You can NOT just blindly keep executing and ignore them without risking data corruption and/or the integrity of the entire system Java is running on.
    Is it OK if you just change the implementation to catch the RuntimeException class instead of the Exception class? We're using Java 7 and the Jetty Servlet Container.
    No - not if you want a well-behaved system.
    Don't catch exceptions unless you HANDLE/resolve them. There are times when it makes sense to log the exception (which does NOT handle it) and then raise it again so that it gets handled properly later. Yes - I know that is contrary to the advice given in that article but, IMHO, that article is wrong about that point.
    If you have ever had to maintain/fix/support someone else's Java code you should already understand how difficult it can be to find WHERE a problem occurs and WHAT the exact problem is when exceptions are not handled properly.

  • Dynamic LOV in universe based report

    Hi,
    My question is simple.
    In Crystal Reports ,is it possible to have a dynamic LOV for the prompts when the report is based on universe? When ever the user chooses the drop down in prompt page, he should see only his values in LOV. This works in WebI.
    I read from the forum that in crystal, this can only be possible with Business View. Is this true?
    If i use Business view and the user opens the report in Infoview, does he needs DSN to use the connection i have created in Business View to refresh the LOV dynamically?
    Please suggest a solution for dynamic LOV as this started as a simple issue and i'm breaking my head to solve this!!

    Once you create any dynamic parameter in crystal which is using direct database connection and if you publish that report to server then it automatically generates a list of values using business view in repository in which the business view uses the same connection what you have used for the report. Now when you try to run the report in info view first it prompts for LOV from repository. Before refreshing the LOV it prompts to connect to your database and if you don't want this prompt to popup everytime then open the connection in business view manager and in the properties select never prompt by giving the database credentials.
    You can also create LOV using universe as datasource. To get the updated list you need to change the registry key settings like this
    select the option Always refresh before use in the universe properties and change the registry like this
    HKEY_LOCAL_MACHINE\software\business objects\suite 11.5\crystal reports\database\AlwaysRefreshUniverseLOV
    Type: String
    Recognized Values: Yes, 1
    HTH
    Raghavendra.G

  • Dynamic lov, Select List in Report

    Hi all,
    I have searched the APEX forum for dynamic lov but somehow no topic could really solve my problem.
    I have a report and 2 columns in this report are displayed as a select list. I want one of the select list show some values depending on the other select list in this report. If the value of the first select list is equal to some data the second select list should show a lov and otherwise nothing.
    All examples i have found so far seem to explain a solution for a select list item on the page and not for a select list in a report like in my case.
    Are there any advices or some links you can give?
    Thanks in advance
    Markus

    See http://htmldb.oracle.com/pls/otn/f?p=18326:54:1415328128204513::::P54_ID:1282
    and http://forums.oracle.com/forums/thread.jspa?messageID=1222153&#1222153

  • Exception handling within a value-binding expression

    Hi all,
    Forgive me if this question seems odd, but I am a long-time Struts developer, new to JSF.
    In Struts, exception handling was easy because all requests were funnelled through some subclass of Action. Exception handling could effectively be consolidated into one spot by applying the template-method pattern.
    Of course, with JSF, this is not possible because method names in value-binding and action-binding expressions can be chosen arbitrarily. For this reason, I am exploring aspect-oriented (and other) techniques for consolidation JSF exception handling into one spot, but rather than focus too intently on that, it's clear that I first need the ability to forward to an error page when an exception is encountered in a value-binding or action-binding expression.
    For action-binding expressions, ExternalContext.dispatch("<view id>"); seems to work quite well, but I am unable to make the same work when in the context of a value-binding expression. This is probably attributed to the fact that at that point, I am in an entirely different phase of the JSF request processing lifecycle.
    What I'm looking to know is if anyone has a reliable means of forwarding to an error page within the context of a value-binding expression. Better yet, does anyone know a reliable way of forwarding to another view regardless of what phase you are in?
    If it makes a difference (and I think it does) the error page uses JSF as well, and uses the same layout (provided via custom tags courtesy of JSP 2.0 tag files), so some view components would have the same name as the page which encountered the error. This seems to get in the way of me simply defining the error page for a 500 in my web deployment descriptor.
    Thanks in advance to anyone with a working suggestion.
    -Kent

    Let me pose a purely hypothetical use case to demonstrate the problem:
    Imagine a page in an HR app, employeeDetails.jsp, that displays an always-up-to-date combo box which lists employee names and IDs. onChange triggers a form submit with the intention of simply posting back to this page, with various text boxes, etc. below updated to show all information for the selected employee.
    Obviously, with the requirement that the combo box always be up to date, it's clear that the getter invoked by the value-binding expression must access the database (not directly of course, but via a facade, application, then data-access layer). Any unexpected and unchecked exception in this chain would propagate back up to the getter method on the backing bean. I need to, at that point, log the exception (trivial) and forward to a user-friendly error page.
    I suppose I could put some contraint on myself that data access is only performed within ActionEvent handlers, but I'm not sure that's consistent with the JSF model in general, in fact it almost seems Struts-like in that I'd have to invoke some action before loading this form to build the up-to-date list for the combo box, shove it in request scope, where it's then available to the page indicated by the navigation rules. Submission of the form on the page in question would also need to result in rebuilding the up-to-date list. Now we're looking at firther propagation of code. I want to avoid this, so I am looking for a better way.

  • Why Exception Handling

    Hello All,
    I am new to PL/SQL and have this question.
    Why do we need exception handling? If some error occurs dont we want to stop execution of program so that we can see the error in the host environment or have it logged in an error table or written in a file before we correct the error and re-run the application. I am not able to clearly see why? Please help understand this.
    Thank you for time!

    user631936 wrote:
    Hello All,
    I am new to PL/SQL and have this question.
    Why do we need exception handling? If some error occurs dont we want to stop execution of program so that we can see the error in the host environment or have it logged in an error table or written in a file before we correct the error and re-run the application. I am not able to clearly see why? Please help understand this.
    Thank you for time!Exception handling lets the designed/developer choose how exceptions should be handled.
    Some exceptions may be expected under certain circumstances such as e.g. NO_DATA_FOUND, and you may want the application to continue processing regardless or continue processing in a different way if that condition is encountered. Other exceptions may require that some previous actions are reversed or rolled back on the database, so capturing them and dealing with that business process can be useful, before the exception is raised back to the calling code/application. Any exceptions that aren't expected and handled, should be RAISEd so that the calling code has the choice to deal with them or RAISE them further up until it get's to a stage where it is handled or the application itself reports the exception to the user.
    Capturing exceptions can of course be useful if you need to log any that occur as you can capture it, store information about it in a table/log file and then raise it to be handled or raised again as necessary.
    What is an absolute no-no in design and development terms is to include a WHEN OTHERS exception that does not raise the exception or notify the calling code/user in some way. This simply masks any exceptions that occur, especially the ones that are not expected, which are of course the ones that you really need to know about so you can fix the underlying issues.
    PL/SQL 101 : Exception Handling
    PL/SQL 101 : Exception Handling

  • Console Exception Handling.  Allow another attempt for user before exiting

    I am trying to implement a very simple program that prompts the user for info and reads in a few numbers. If the user accidentally enters a letter instead of a number I want the user to get another chance, not just execute the exception handler and exit the program (as it does now). I'd rather have the user get stuck in an endless loop waiting for valid input versus exiting on the first invalid entry.
    The code I am using is something like this:
    try{
       System.out.println("Enter a number?");
       int b=System.in.read();
       char c=(char) b;
       String s=String.valueOf(c);
       p.setDummyValue(Integer.parseInt(s) ); //**Possible Exception Here
    catch(NumberFormatException e) {
       System.out.println("Invalid Input");
       // *** I'd love to somehow return to the "Enter a number" line from here
    catch(IOException e) {
       //IO error code here
    }Q: How can I implement the ability to allow a user to correct invalid input?
    Thanks

    Something like this should work:boolean numberValid = false;
    while (!numberValid) {
         try {
              System.out.println("Enter a number?");
              int b=System.in.read();
              System.in.skip(System.in.available()); // skip carriage return
              char c=(char) b;
              String s=String.valueOf(c);
              p.setDummyValue(Integer.parseInt(s));
              numberValid = true;
         } catch(NumberFormatException e) {
              System.out.println("Invalid Input");
         } catch(IOException e) {
              //IO error code here
    }

  • Return multiple values from dynamic lov in apex 3.2.1

    Hi
    I need to create a dynamic lov that displays multiple values from a table and RETURNS multiple values into display only fields in a form page to be saved to the database
    For example
    dynamic list of value name SERVER
    select name || ',' || life_cycle d, name r
    from sserver
    order by 1
    This SERVER LOV is attached to the P4_SSERVER_NAME field in the form.
    However this only returns sserver. name into the P4_SSERVER_NAME field in the form. I would need to capture the life_cycle field as well and populate the P4_LIFE_CYCLE field in the form as well. How does one do this?
    I have searched this forum however could not find a thread that fit my situation. i saw that in 4.2 there is dynamic action however unable to upgrade at this moment.
    any suggestions are greatly appreciated.
    thank you

    Hi CRL,
    One method is to set the value of your P4_LIFE_CYCLE item via APEX_UTIL.set_session_state
    To do this you need to create a Page Process
    Type PL/SQL anonymous block
    Process Point On Load - Before Header
    The source for the Process might look like this: DECLARE
       l_life_cycle   VARCHAR2 (50);
    BEGIN
       SELECT life_cycle
         INTO l_life_cycle
         FROM sserver
        WHERE :p4_sserver_name = sserver.name;
       APEX_UTIL.set_session_state ('P4_LIFE_CYCLE', l_life_cycle);
    END;Jeff

  • Exception handling for mis-addressed messages

    We are using ebXML messaging in WLI. In many of our workflows we start new conversations with trading partners based on the contents of address fields in the messages. Now and again during development a message comes in which is addressed to a TP who doesn't exist. The message fails to be sent and rolls back repeatedly. Is there a simple way to remove these messages from the WLI hub? Can exception handling be used to move messages which are failing to enter the workflows to a special queue automatically?
    thanks
    Ben

    Hi Holger,
    I will not translate the coding into VB. So if you want to do this it is OK with me.
    An idea would be after some testing by the community to provide the functionality as a DLL. This way it could also easily be added to a VB project.
    However I assume that some developers prefer to integrate the coding themselves so that they might add additional customer specific functionlity.
    For example not to raise an exception if a specific error is in the return parameter because they want to ignore it.
    Best regards,
    Andre

  • Exception handling for Scanner console input

    I'm trying to add exception handling to a Scanner console to deal with exceptions caused by non-numeric input. My idea was to do use a try/catch in a for loop and break if no exception occurs.
    Whats happening is the "iNumber = console.nextInt(); " does nothing on subsequent retries, when an exception occurs. That is, I enter "123w", an InputMismatchException occurs, goes into the first catch block, hits "continue" and goes back into the for loop, hits the "iNumber = console.nextInt(); ", then immediately blows through it without executing. Thus, I hit my max loop count and exit with iNumber = 0.
    I'm thinking I may need to instantiate "static Scanner console = new Scanner(System.in);" again in the event of an exception?
    Thanks for any feedback. I'm brand new at Java and learning as fast as I can :)
    Here is the code:
    class ConsoleInput
         public ConsoleInput() // constructor
         static Scanner console = new Scanner(System.in);
         public int GetInput()
              int iNumber = 0;
              for(int i=0; i<3; i++)
              try
                   System.out.print("Please enter a number: ");
                   iNumber = console.nextInt(); // get console input
                   break;
              catch(java.util.InputMismatchException ex)
                   continue;
              catch(Exception ex)
                   continue;
         return iNumber;
    }

    public class Scratch {
      public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        boolean gotAValidInt = false;
        int theInt;
        System.out.println("Enter an int");
        do {
          try {
            theInt = sc.nextInt();
            gotAValidInt = true;
          catch (InputMismatchException exc) {
            System.out.println("Not an int. Try again.");
            sc.next(); // consume the non-int that nextInt couldn't consume
        } while (!gotAValidInt);
    }There are different ways you could structure your loop, but the key is that when nextInt throws an exception, you have to call next() in the catch block to consume the token that nextInt couldn't.
    Edited by: jverd on May 2, 2008 1:52 PM

  • Exception Handling for Array Binding

    Hi
    1)
    I am using a Stored Procedure.
    I am using array binding and if i am sending an array of count 10 to be inserted in a table and only 9 got inserted,i deliberatly inserted one errorneous record in array, the count returned by ExecuteNonQuery() is 10.Why ?
    How can i come to know exact number of rows inserted in table, how can i use Output variables, because the array bind count is 10 so if i add an output parameter it gives error ArrayBind count is wrong....
    2)
    Is it possible to roll back all the inserts if error occurs in any of the insert by Oracle engine.What it does is it inserts all correct records and leaves the errorneous record and doesn't even throw any exception or any message.
    Answer - This can be achieved by using OracleTransaction and don't use Exception handling in procedure otherwise there wont be any exception thrown by procedure which is necessary to detect if an error occured during insert.If you use exception handling OracleEngine will insert correct rows and leave errorneous record and return count of inserted + non inserted records which is wrong.
    Please help.
    Message was edited by:
    user556446
    Message was edited by:
    user556446

    You'll need to encapsulate your validation within it's own block as described below:
    -- this will die on the first exception
    declare
      TYPE T_BADDATA_TEST IS TABLE OF VARCHAR2(1000) INDEX BY binary_integer ;
      tbt T_BADDATA_TEST ;
      aBadTypeFound exception ;
    begin
       tbt(0) := 'a';
       tbt(1) := 'b';
       tbt(2) := 'c';
        for idx in tbt.first..tbt.last loop
          if tbt(idx) =  'b' then
              raise aBadTypeFound ;     
          else
              dbms_output.put_line(tbt(idx));     
          end if  ;
        end loop ;
    end ;--encapsulate the exception area in a begin/end block to handle the exception but continue on
    declare
      TYPE T_BADDATA_TEST IS TABLE OF VARCHAR2(1000) INDEX BY binary_integer ;
      tbt T_BADDATA_TEST ;
      aBadTypeFound exception ;
    begin
       tbt(0) := 'a';
       tbt(1) := 'b';
       tbt(2) := 'c';
        for idx in tbt.first..tbt.last loop
          BEGIN
          if tbt(idx) =  'b' then
              raise aBadTypeFound ;     
          else
              dbms_output.put_line(tbt(idx));     
          end if  ;
          EXCEPTION
            WHEN aBadTypeFound THEN
                dbms_output.put_line(tbt(idx) || ' is bad data');       
            WHEN OTHERS THEN
                dbms_output.put_line('exception');       
          END ;
        end loop ;
    end ;
    output:
    a
    b is bad data
    c
    ***/

  • Exception handling for ProjectService methods in a new 2006 DI API

    Normally for other objects the Add() method returns error code and calling the GetLastError you get the description.
    AddProject(Project) method of ProjectService returns ProjectParams object.
    So the question is where to get the error code or what is the correct exception handling for that new methods in 2006 SDK.
    Thanks for any help.
    Tomas

    Hi all,
    I have a sceranio :
    I created the text field, text box, com bobox .etc, on new form or exist form.
    When I want to bind data into UDO, i use "DataBind.setBound"
    ex:"oEdit.DataBind.SetBound(True, "@SM_OMOR", "U_Room")"
    Can i bind the data to exist table on B1?
    ex: oEdit.DataBind.setBound(True, "OHEM", "firstName")
    Plz guid !
    Rgds !

  • Exception Handling for inserts

    Hi,
    My requirement is to populate a table with values got by selecting columns from various table on join conditions. It works fine if all the rows inserted are unique. However if the row to be inserted is duplicate, it violates the uniqueness constraint.
    I want an exception wherein if select query returns 100 rows, of which 80 are already there in the table to be populated, it should just insert the 20 records.
    Below is the SP i wrote for the same. However, as soon as it meets exception condition, it just prints the condition and exits, without processing the rest of the records. Please look at the SP below and suggest a solution.
    create or replace
    PROCEDURE PP_CMC_TEST AS
    cursor c1 is
    (select cdu.subscription_id,max(cdu.account_id),max(s.subscription_versn_start_date),
    max(s.service_plan_id),max(sbp.billing_period_id),sysdate-1
    ,cdu.device_name, cdu.resource_id,sum(cdu.usage),max(cdu.unit_of_measurement)
    from
    subscriptions s, subscription_billing_period sbp, consolidated_daily_usage cdu
    where s.version_end_date is null and
    sysdate-1 between sbp.start_date and sbp.end_date and
    cdu.usage_date between sbp.start_date and sbp.end_date
    and s.subscription_id = cdu.subscription_id
    and sbp.subscription_id = cdu.subscription_id
    and sbp.subscription_id = s.subscription_id
    and s.subscription_versn_start_date=sbp.subscription_versn_start_date
    group by cdu.subscription_id,cdu.device_name, cdu.resource_id);
    a number;
    b number;
    c date;
    d number;
    e number;
    f date;
    g varchar2 (255);
    h number;
    i number;
    j varchar2(60);
    BEGIN
      OPEN c1;
        LOOP
            FETCH c1 INTO a,b,c,d,e,f,g,h,i,j;
             EXIT WHEN c1%NOTFOUND;
    insert into cmc_test
    (subscription_id,account_id,subscription_versn_start_date,service_plan_id,billing_period_id,curr_date,
    device_name,resource_id,usage,unit_of_measurement) values
    (a,b,c,d,e,f,g,h,i,j);
        END LOOP; 
                                 EXCEPTION
        WHEN DUP_VAL_ON_INDEX
          THEN
          DBMS_OUTPUT.PUT_LINE('DUPLICATE RECORD FOUND');
          commit;
        CLOSE c1; 
    END PP_CMC_TEST;Edited by: BluShadow on 07-Feb-2012 09:03
    added {noformat}{noformat} tags (for what it was worth).  Please read {message:id=9360002} and learn to do this yourself in future.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Using SQL you would create an error table and modify the INSERT to log the errors. See the 'Inserting Into a Table with Error Logging' section of http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_9014.htm. Note this approach will not work if you are using direct path loads since the log table won't be used.
    If you are going to use PL/SQL for this then what you want is to use BULK COLLECT and then a FORALL with a SAVE EXCEPTIONS clause.
    >
    A. BULK COLLECT INTO plsqlTable LIMIT 5000 - These are your new records you want to INSERT
    B. FORALL ... SAVE EXCEPTIONS - This is the INSERT query to insert the new records
    C. Use a bulk exception handler. Any record in the FORALL that causes an exception will have it's index put into the bulk exception array. In the bulk exception handler you can loop through the array and access the records that caused the error using the index into the plsqlTable and do any error logging you need to do.
    >
    The bulk exception array will have the plsql table index of the row that caused the error. You can index into the plsql table (see Step A above) to access the record and then log it, INSERT it into a duplicates table or whatever you want.
    The important thing is that the records that do not have errors will still get processed. Similar result to what will happen if you use SQL and an error table.

Maybe you are looking for

  • JDeveloper 10.1.3.3.0.3 Blue Screen of Death on Windows 7 64-bit

    Hi, I am using JDeveloper 10.1.3.3.0.3 on a Windows 7 (64-bit) machine. Whenever I try and use the PgUp or PgDn keys or even use the main vertical scrollbar it produces a Blue Screen of Death. Saying the Video Scheduler has encountered an unexpected

  • Any BAPI/Function Module for adding new record with dates in PA0027

    Hi all, I am tryig to find is there any BAPI/Function module for updating new record with Start Date and End date for specified Personal Number in PA0027 Table. In PA0027 table i will be passing start date and end date for selected personal number, i

  • Problem empty trash

    Hi everyone , I have a problem to empty the trash. when I clic on "empty trash" it look like it empty the trash but the trash is still full. I checked the permission of the disk and I get the following log: ACL found but not expected on "System/Libra

  • I need a JDBC SQL Grammar

    Hi All, I'm working on a project in which I have to translate between SQL/400 (for the IBM AS/400) and JDBC SQL statements. Rather than working in the dark, I'd like to get a grammar for both languages. I'm wondering if anyone out there knows where I

  • Blackberry Server Messages Every half hour

    I have a 8330 curve for sprint I have a work e-mail that when I use outlook, it requires a special server location on the outgoing mail.  I set-up the mail on the phone through the mail wizard all I needed was the e-mail address and password.  It wor