Management of Multiple exception line in 4.5 and 10 g oracle

Hi all

We are the migration forms 4.5 (oracle database 8) oracle 10 g (10g database). I have a strange doubt, the application works differently in 4,5 and 10 g when several lines are back. For example in a program unit:

Start
Select T1.field1 in var1
table T1
where
< Condition >
exception when too_many_rows then
null;
end;

If the above query is fetch multiple records and then to 4.5 he fetch any value (probably the first record) in the variable var1 but in 10g it only know transfers control to a part of the exception. No value is read into the variable. There is no debug on 4.5 but I have the debugged on 10g, and it behaves as described.

It's a change of default behavior in oracle forms or I do something wrong?

Please put some light on if or let me know if someone else has also faced same question.

Thank you
Ash

4.5 the behaviour was incorrect, 10g R2 is good according to the regulations SQL, if you can not ensure that your SQL statement returns only one line and you must randomly select one of the many that are extracted, you can use ROWNUM = 1 in which your condition.

This returns the first line of the SQL result set.

But this isn't the way I personally would, I prefer to make sure my WHERE condition returns only a line.

begin
Select T1.field1 into var1
from Table T1
where ROWNUM = 1

exception when too_many_rows then
null;
end;

Tony

Tags: Oracle Development

Similar Questions

  • Smart View managed an unexpected exception in Microsoft Office

    I've installed Smart View on a Windows 7 with Office 2010 client.
    Any Office program I start/close I get the error "Smart View managed an unexpected exception...". ». We have just improved the environment of the EMP to 11.1.2.103.
    Anyone have any idea what can be wrong?

    I had this same error with multiple users and it is resolved as follows:

    There are two add-ins for SmartView in Excel
    (1) standard Pluggable software component XLA
    (2) com add-in

    GO to manage Add-ins in Excel options. This as well for the 'standard' and 'com' supplements.
    Check the SmartView snap and click Browse to add new.

    In our case, it was the complement com at the origin of the problem. Add that corrects the problem.

  • Management concept the exceptions that went wrong!

    Well, this is by far the most embarrassing hack code I've done so far... but it works. I'm trying to run a select where if there is no data or null returned, place it in the value "v_pidm"and then let the action happen.» Pretty simple, right? Fake! A select statement returns no data that uses a function 'en' is an exception... "no data found". Oracle, it sends to the exception block as it should. Well, I don't want to stop and start my script a million times here, I added a Begin/End sub, with an exception to handle the error to say and perform an insert. I know that you should not use a State of exception for inserts another capture errors... you know bad practices and all. Any ideas as how to better manage the select statement that must regularly return no data? I was thinking some along the line of nvl (v_pidm, 0) or something, but I get errors.
    set serveroutput ON SIZE 1000000
    set heading off                
    set feedback off                
    set trimspool off               
    set echo off                    
    set pagesize 0  
    set termout on
    
    
    Declare
    error     varchar(255); 
    v_pidm    number(8); 
    
     Begin
        Begin    
            select distinct saraatt_pidm  
    
            into
    
            v_pidm
    
            from saraatt, saradap
            where saraatt_appl_no = SARADAP_APPL_NO
            and saraatt_term_code = SARADAP_TERM_CODE_ENTRY
            and saraatt_pidm = 4;
            
          Exception
             when too_many_rows then
            error := SQLERRM;        
            DBMS_OUTPUT.PUT_LINE(' %% Oracle Error! %% The select statement returned more than two rows ');
               
            when no_data_found then
            error := SQLERRM;        
            DBMS_OUTPUT.PUT_LINE('Select Returned No Data . . . Therefore Insert new record for ' || v_pidm );
            
            v_pidm := -999;
    
            when others then
            error := SQLERRM;        
            DBMS_OUTPUT.PUT_LINE(' %% Oracle Error! %% An Error Occured ' || substr(error,5,20));    
        End;
        
        
        
     DBMS_OUTPUT.PUT_LINE('Pidm: ' || v_pidm);
    
     End;

    There is nothing inherently wrong with code like

    BEGIN
      SELECT column_name
        INTO l_variable_name
        FROM table_name
       WHERE some_where_clause;
    EXCEPTION
      WHEN no_data_found
      THEN
        l_variable_name := 0;
    END;
    

    It is perfectly reasonable to have exception handlers that make anything other than newspaper an exception if they can in fact wisely handle the exception (e.g., you know that the query may return 0 rows and you know how to handle this case correctly).

    You don't want an exception handler that simply calls to DBMS_OUTPUT. Put_line without re-raise the exception. It is a mistake to delay. And there is no real reason in this case to extract the SQLERRM in the variable error - it would be better to let the exception is propagated to the top so that you can see the full error stack.

    Justin

  • SmartView managed an unknown Exception

    Hello

    We are Smartview and HFM 11.1.2.1 running the office 2010 products. Occasionally an error will appear when I open Excel that says "Smart View managed an unknown exception thrown by Microsoft Office. If anyone has had this problem or knows what it is tied to. as much as I know that it still works very well. Here's what I copied over the OAS error log data.

    Thank you
    Jason


    [2012 01-24 T 08: 27:41] [SVC] [ERROR: 1] [SVC-1] [SVC] [ecid: 01128254-a59b-4bd1-b41e-8c13730f9145, 0] Smart View managed an unknown exception thrown by Microsoft Office.
    [2012 01-24 T 08: 27:41] [SVC] [[ERROR: 1] [SVC-1] [SVC] [ecid: 01128254-a59b-4bd1-b41e-8c13730f9145, 0] COleDispatchException: (error: 8007000e, code: 0)]

    Please check this-online http://blogs.oracle.com/HyperionPlanning/entry/smart_view_handled_an_unknown

    Thank you

    Todd Rebner

  • How to convert (multiple) output lines (multi-column)


    HII


    I have a weird request. But not sure how to get results out of it!


    My query returns two rows to a query I asked.



    Current result
    10
    20

    Expected result

    10 20

    My problem here is that I wanted two values above to be stored in two variables in a single select statement.



    If I use a cursor that my problem will be solved. But I'm not much interested in using a cursor for a simple select statement.



    is there a possibility that I can convert the output of two lines to two columns?



    I use Oracle Release 10.1.0.2.0



    Windows Xp operating system.



    People here will not appreciate the tags 'Urgent '. I know that :-(.



    But some how I'm forced to use this tag "urgent." Sorry for that.



    If no response, I will in another way can go to the slider :-(



    Any help will be appreciated.



    Thank you
    Pavan

    ??? WITH the clause is just a quick way to produce one on the fly table with your sample data. I think you should do a lot of reading material. In any case, use:

    select  dept,
            max(decode(rn,1,location,null)) location_1,
            max(decode(rn,2,location,null)) location_2
      from  (
             select  dept,
                     location,
                     row_number() over(partition by dept order by location) rn
               from  (
                      your-query
                     )
            )
      group by dept
    /
    

    SY.

  • How to modify and update a line later was inserted and updated in the doDML() method?

    Mr President

    Jdev worm is 12.2.1

    How to modify and update a line later was inserted and updated in the doDML() method?

    I added two rows in my table a method of action-listener in bean managed and secondly with operation doDML() as below.

    Method 1-first row in managed bean

        public void addNewPurchaseVoucher(ActionEvent actionEvent) {
            // Add event code here...
            BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();        
            DCIteratorBinding dciter = (DCIteratorBinding) bindings.get("VoucherView1Iterator");        
            RowSetIterator rsi = dciter.getRowSetIterator();        
            Row lastRow = rsi.last();        
            int lastRowIndex = rsi.getRangeIndexOf(lastRow);        
            Row newRow = rsi.createRow();        
            newRow.setNewRowState(Row.STATUS_NEW);        
            rsi.insertRowAtRangeIndex(lastRowIndex +1, newRow);         
            rsi.setCurrentRow(newRow);
            
            BindingContainer bindings1 = BindingContext.getCurrent().getCurrentBindingsEntry();        
            DCIteratorBinding dciter1 = (DCIteratorBinding) bindings1.get("VdetView1Iterator");        
            RowSetIterator rsi1 = dciter1.getRowSetIterator();        
            Row lastRow1 = rsi1.last();        
            int lastRowIndex1 = rsi1.getRangeIndexOf(lastRow1);        
            Row newRow1 = rsi1.createRow();        
            newRow1.setNewRowState(Row.STATUS_NEW);        
            rsi1.insertRowAtRangeIndex(lastRowIndex1 +1, newRow1);         
            rsi1.setCurrentRow(newRow1); 
            
            
        }
    


    Method of doDML() of line 2 seconds in the entityImpl class


        protected void doDML(int operation, TransactionEvent e) {        
            setAmount(getPurqty().multiply(getUnitpurprice()));
           
            if (operation == DML_INSERT)  
                       {          
                         insertSecondRowInDatabase(getVid(),getLineitem(),getDebitst(),
        (getPurqty().multiply(getUnitpurprice()).multiply(getStaxrate())).divide(100));  
                           }
                           
                           if(operation == DML_UPDATE)
                           {
                               
                           updateSecondRowInDatabase(getVid(),getLineitem(),getDebitst(),
        (getPurqty().multiply(getUnitpurprice()).multiply(getStaxrate())).divide(100));                        
                           }                                       
            super.doDML(operation, e);
        }
    
        private void insertSecondRowInDatabase(Object value1, Object value2, Object value3, Object value4)  
                  {  
                    PreparedStatement stat = null;  
                    try  
                    {  
                      String sql = "Insert into vdet (VID,LINEITEM,DEBITST,AMOUNT) values 
       ('" + value1 + "','" + value2 + "','" + value3 + "','" + value4 + "')";  
                      System.out.println("sql= " + sql);    
                      stat = getDBTransaction().createPreparedStatement(sql, 1);  
                      stat.executeUpdate();  
                    }  
                    catch (Exception e)  
                    {  
                      e.printStackTrace();  
                    }  
                    finally  
                    {  
                      try  
                      {  
                        stat.close();  
                      }  
                      catch (Exception e)  
                      {  
                        e.printStackTrace();  
                      }  
                    }  
                  }  
                  
                  private void updateSecondRowInDatabase(Object value1, Object value2, Object value3, Object value4)  
                  {  
                    PreparedStatement stat = null;  
                    try  
                    {  
                      String sql = "update vdet set vid='"+ value1+"',lineitem='"+ value2+"',DEBITST='" 
       + value3 + "', AMOUNT='" + value4 + "' where VID='" + VID + "'";  
                      System.out.println("sql= " + sql);      
                      stat = getDBTransaction().createPreparedStatement(sql, 1);  
                      stat.executeUpdate();  
                    }  
                    catch (Exception e)  
                    {  
                      e.printStackTrace();  
                    }  
                    finally  
                    {  
                      try  
                      {  
                        stat.close();  
                      }  
                      catch (Exception e)  
                      {  
                        e.printStackTrace();  
                      }  
                    }  
                  }
    

    Now the problem is that when later I change the quantity and price of the first line isn't updated but second row, because I used the command

     <af:button actionListener="#{bindings.Commit.execute}" text="Commit"
    

    This button update the first line added by bean managed, but the second row remains unchanged.

    Please help how to update the two lines with the same button or something else.

    Concerning

    DML_UPDATE will call only if there is some change data attributes.

    I guess that the update statement is false because vid looks like a primary key for the table, then, how update you the primary key of the update statement and how the update condition statement where the vid = '0'

    I assume the update statement should look like:

      private void updateSecondRowInDatabase(Object value1, Object value2, Object value3, Object value4)
      {
        PreparedStatement stat = null;
        try
        {
          String sql =
            "update vdet set lineitem='" + value2 + "',DEBITST='" + value3 + "', AMOUNT='" + value4 +
            "' where VID='" + value1 + "'";
          System.out.println("sql= " + sql);
          stat = getDBTransaction().createPreparedStatement(sql, 1);
          stat.executeUpdate();
        }
        catch (Exception e)
        {
          e.printStackTrace();
        }
        finally
        {
          try
          {
            stat.close();
          }
          catch (Exception e)
          {
            e.printStackTrace();
          }
        }
      }
    
  • dblink oracle to postgres with dg4odbc. ORA-28500: connection between ORACLE and a non-Oracle system returned this message: ORA-02063: preceding line

    Hi, I am creating the database link from a database of Oracle 11 g PostgreSQL with DG4ODBC and unixODBC

    My configured for /etc/odbc.ini

    [PostgreSQL]

    Description = Test to Postgres

    Driver = psqlodbc

    Trace = Yes

    Trace file = /tmp/sql.log

    Database = danieldb

    ServerName =

    UserName = SA

    Password = password

    Port = 5432

    Protocol = 6.4

    ReadOnly = No

    RowVersioning = No

    ShowSystemTables = No

    ShowOidColumn = No

    FakeOidIndex = No

    My configured for /etc/odbcinst.ini

    [ODBC]

    CommLog = 1

    Debug = 1

    FileUsage = 1

    Layout common = No

    Trace = 1

    [psqlodbc]

    Description = PostgreSQL ODBC driver

    Driver=/usr/lib64/psqlodbcw.so

    CommLog = 1

    Debug = 0

    FileUsage = 1

    My configured for /u01/app/oracle/product/11.2.0/xe/hs/admin/initPostgreSQL.ora

    HS_FDS_CONNECT_INFO = PostgreSQL

    HS_FDS_TRACE_LEVEL = 0

    HS_FDS_SHAREABLE_NAME = /usr/lib64/libodbcpsql.so

    Set ODBCINI=/etc/odbc.ini

    My configured for /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora

    Listener =

    (ADDRESS = (PROTOCOL = TCP) (HOST = oracle-poc)(PORT = 1521))

    SID_LIST_LISTENER =

    (SID_LIST =

    (SID_DESC =

    (SID_NAME = PostgreSQL)

    (ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe)

    (PROGRAM = dg4odbc)

    (ENVS="LD_LIBRARY_PATH=/usr/lib64:/u01/app/oracle/product/11.2.0/xe/lib')

    )

    )

    My configured for /u01/app/oracle/product/11.2.0/xe/network/admin/tnsname.ora

    PostgreSQL =

    (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP) (HOST = oracle-poc)(PORT = 1521))

    (CONNECT_DATA =

    (SID = PostgreSQL)

    )

    (HS = OK)

    )

    I'm trying to created public database link:

    CREATE DATABASE LINK PUBLIC 'orapos' CONNECT to 'HIS' IDENTIFIED BY 'password' USING 'PostgreSQL ';

    When I used tnsping

    [root@oracle-poc admin] # tnsping PostgreSQL

    AMT Ping utility for Linux: Version 11.2.0.2.0 - Production on May 16, 2013 20:34:19

    Copyright (c) 1997, 2011, Oracle.  All rights reserved.

    Use settings files:

    /U01/app/Oracle/product/11.2.0/XE/network/admin/SQLNET.ora

    TNSNAMES adapter used to resolve the alias

    Try to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = oracle-poc)(PORT = 1521)) (CONNECT_DATA = (SID = PostgreSQL)) (HS = OK))

    OK (0 msec)

    and finally, I try to use the database link:

    "SQL > select * from tabel2"@orapos ".

    2;

    Select * from 'tabel2"@orapos '.

    *

    ERROR on line 1:

    ORA-28500: connection between ORACLE and a non-Oracle system has sent this message:

    ORA-02063: preceding the line of ORAPOS

    What wrong with my setup?

    Thank you and best regards,

    Daniel

    Daniel,

    The problem is that you are using the ODBC Postgres driver for the HS_FDS_SHAREABLE_NAME parameter, but this must be an ODBC driver manager and not the driver ODBC Psotgres.
    Go to the.

    http://www.unixODBC.org/

    Click the 'Download' and follow the instructions to download the 2.3.1 pilot and make libraries and programs.

    Once this is done, then use the driver as parameter HS_FDS_SHAREABLE_NAME Manager, for example-

    HS_FDS_SHAREABLE_NAME =/home/odbc64/unixODBC/2.3.1/lib/libodbc.so

    Depending on where you install it.

    Kind regards

    Mike

  • Mozilla firefox add-ons Manager page is not in the correct format and error in installing addons?

    page of the Add-ons Manager makes its appearance in the basic format and when I search for add ons, it shows the result, but without images (to the basic format). Cannot install them too.

    If you can, take a snapshot and post it here for us to see.

    To better help you with your question, please provide us with a screenshot. If you need help to create a screenshot, please see How to make a screenshot of my problem?

    Once you have done so, attach the file to screen shot saved to your post on the forum by clicking on the button Browse... under the box to post your reply . This will help us to visualize the problem.

    Thank you!

  • All my data have doubled and the lines are slightly compensation and overlapping. Unusable.

    All my data have doubled and the lines are slightly compensation and overlapping. Unusable. How to restore the distorted view course content?

    Hello Arnold,.

    A screenshot of the upper-left corner of your document could help the issue. Include as much as in the example below.

    If this section of the table does not display data "doubled and shifted", provide a second screenshot of a section of the same size, showing a sample of the data in question.

    Kind regards

    Barry

  • Qosmio G30 - white lines on the screen and BSOD

    1. I have a Qosmio G30
    2 operating system Windows XP MCE
    and I have problem "white lines on the screen ' when windows start to load after that I got the"blue screen of death"and restart the computer.
    I try to get back, but unfortunately came with the laptop recovery CD doesn't seem to work...

    Whenever I finished to recover I have "windows loading files" and once this is done, it shows me the so-called "blue screen of death"...

    Hello

    I m afraid. I have bad news for you ;(
    I think you ve you have a problem with the hardware in my eyes, there might be something wrong with the GPU chip.
    The white lines on the screen could be related to a faulty graphics card and get the BSOD error due to a hardware malfunction or software serious questions

    I m sure that the recovery CD does not contain software problems and therefore only the fault of hardware could be the reason for the lines on the screen and the BSOD.

    In my opinion, you should contact the ASP in your country for assistance if all goes well you guarantee is valid.

    Good luck

  • I open a file with the Microsoft Office Picture Manager program. Now I can not escape and it's the tilt all my documents of the image.

    Original title: HELP! Problem 'open with '.

    I also have a problem of 'Open with', that has happened before. I open a file with the Microsoft Office Picture Manager program. Now I can not escape and it's the tilt all my documents of the image. Even the new emails are now coming this way. How can I get rid of this or the reverse?

    Hi Patti Gunderlock,

    ·         You receive an error message or error code?

    Follow the suggestions below for a possible solution:

    Method 1: Follow the steps in the following article, and check, if that helps.

     

    How to change or choose the program that starts when you double-click a file in Windows XP

    http://support.Microsoft.com/kb/307859

     

    Method 2: If the method above is not enough, then you can follow the steps described in the article and check.

     

    When you run an .exe on a Windows XP, Windows Vista or Windows 7 computer file, the file can start another program

    http://support.Microsoft.com/kb/950505

    Let us know if that helps.

  • In disk management, it shows only a single hard drive and it's C, but it lists the size than what my old drive was that I took out

    I got a new hard drive in my computer and the old a subscribed.  I then had to reinstall Windows XP Pro.  In disk management, it shows only a single hard drive and it's C, but it lists the size than what my old drive was that I took out.  The new shows of unallocated hard disk without a drive letter and has a black bar above it. How do I show my new hard drive that is 1 TB instead of one that was a 250 GB is not yet in my computer.

    Hi Reta,

    ·         The drive appears like 250 GB even if it's a terabyte?

    ·         Is the remaining 750Go showing as unallocated disk space?

    If this is the case, you can refer to this article on how to use disk management in Windows XP:

    How to use disk management to configure dynamic disks in Windows XP

    You can follow the directions to extend a Simple Volume so that your 250 GB turns into a single terabyte.

  • Printer Epson stylus CX 6600 print perfectly all colors except black who is hitting and missing

    Printer Epson stylus CX 6600 print perfectly all colors except black who is hitting and missing

    This looks like a printhead clogged for me.
    It's more of an Epson problem than a problem of Windows.
    Check the Web site of the Epsom for utilities seeking to lead the printheads.

    Here is a link to the CX6600 troubleshooting page:
    <>http://www.Epson.com/cgi-bin/store/support/erscripts/start_er.jsp?BV_UseBVCookie=Yes&OID=41664 >

    HTH,
    JW

  • My floppy drive is not reading the disks. Device Manager does not detect any problems, I uninstalled and reinstalled the drivers. What should I do now?

    My floppy drive is not reading the disks. Device Manager does not detect any problems, I uninstalled and reinstalled the drivers.
    Convenience store said to click on properties Insert the diskette and
    Double click on open, but when I do that it stop computer
    and opens the recovery and ask for a correct diskette,

    Hello Tallm,

    Thank you for your message.  Did you get your floppy drivers of your installation diskettes?  If so, go to the website of the manufacturer of your computer and download/install the latest drivers.  Please let us know if this or help to solve your problem.
    See you soon

    Engineer Jason Microsoft Support answers visit our Microsoft answers feedback Forum and let us know what you think.

  • Transfer of multiple bluetooth files between Vista PC and mobile phone

    Does anyone know how to send multiple files (specifically contacts) from a standard mobile phone (not iPhone, Blackberry or Windows Mobile device) to a PC via bluetooth?  The Vista BT file transfer Wizard allows me to do one at a time, but not multiple.  I tried OBEX medieval and that seems to work for image files, but not contacts.

    Hi TampaRob,

    You should start by contacting the manufacturer of phones or browse the manual to find the information you're looking for.
    Matt Hudson
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

Maybe you are looking for