Problem with store procedures and Hibernate

I got some problem when I am trying to override INSERT, and UPDATE operations in Hibernate. My delete functions works fine, and everything works when i´m not override with my stored procedure, and I have no idea why. When I am trying to make an INSERT, everything seems to be fine but no data is being insert and no excpetion throws.
When I am trying to make an UPDATE following excpetion throws:
Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: could not update: [labb6Hibernate.bil#18]
Here is my hbm.xml file:
<hibernate-mapping>
<class catalog="Cars" name="labb6Hibernate.bil" table="Bil">
<id name="idNum" type="java.lang.Integer">
<column name="idNum"/>
<generator class="identity"/>
</id>
<property name="marke" type="string">
<column length="10" name="Marke" not-null="true"/>
</property>
<property name="modell" type="string">
<column length="10" name="Modell" not-null="true"/>
</property>
<property name="arsmodell" type="string">
<column length="4" name="Arsmodell" not-null="true"/>
</property>
<sql-insert callable="true"> { call insertCars(?,?,?) } </sql-insert>
<sql-update callable="true"> { call updateCars(?,?,?) </sql-update>
<sql-delete callable="true"> { call deleteCars(?) } </sql-delete>
</class>
Here is my UPDATE code:
Session session = MyHibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
int s = Integer.parseInt(idTxt.getText());
bil Bil = (bil) session.get(bil.class, s);
Bil.setIdNum(s);
Bil.setMarke(markeTxt.getText());
Bil.setModell(modellTxt.getText());
Bil.setArsmodell(arsmodellTxt.getText());
session.update(Bil);
session.getTransaction().commit();
session.close();
Here is my INSERT code:
Session session = MyHibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
bil Bil = new bil();
Bil.setMarke(markeTxt.getText());
Bil.setModell(modellTxt.getText());
Bil.setArsmodell(arsmodellTxt.getText());
session.save(Bil);
session.getTransaction().commit();
session.close();
Does anyone have an idea what is wrong in my code?

I got some problem when I am trying to override INSERT, and UPDATE operations in Hibernate. My delete functions works fine, and everything works when i´m not override with my stored procedure, and I have no idea why. When I am trying to make an INSERT, everything seems to be fine but no data is being insert and no excpetion throws.
When I am trying to make an UPDATE following excpetion throws:
Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: could not update: [labb6Hibernate.bil#18]
Here is my hbm.xml file:
<hibernate-mapping>
<class catalog="Cars" name="labb6Hibernate.bil" table="Bil">
<id name="idNum" type="java.lang.Integer">
<column name="idNum"/>
<generator class="identity"/>
</id>
<property name="marke" type="string">
<column length="10" name="Marke" not-null="true"/>
</property>
<property name="modell" type="string">
<column length="10" name="Modell" not-null="true"/>
</property>
<property name="arsmodell" type="string">
<column length="4" name="Arsmodell" not-null="true"/>
</property>
<sql-insert callable="true"> { call insertCars(?,?,?) } </sql-insert>
<sql-update callable="true"> { call updateCars(?,?,?) </sql-update>
<sql-delete callable="true"> { call deleteCars(?) } </sql-delete>
</class>
Here is my UPDATE code:
Session session = MyHibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
int s = Integer.parseInt(idTxt.getText());
bil Bil = (bil) session.get(bil.class, s);
Bil.setIdNum(s);
Bil.setMarke(markeTxt.getText());
Bil.setModell(modellTxt.getText());
Bil.setArsmodell(arsmodellTxt.getText());
session.update(Bil);
session.getTransaction().commit();
session.close();
Here is my INSERT code:
Session session = MyHibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
bil Bil = new bil();
Bil.setMarke(markeTxt.getText());
Bil.setModell(modellTxt.getText());
Bil.setArsmodell(arsmodellTxt.getText());
session.save(Bil);
session.getTransaction().commit();
session.close();
Does anyone have an idea what is wrong in my code?

Similar Messages

  • Problem with store ResultSet and show result in table

    Hi, I'm kind of new in ADF, I need to store ResultSet and show result in table-component. I have two problems:
    1) I get my ResultSet by calling callStoredProcedure(...) and this returns actually ref_cursor as ResultSet.
    When I try to println() contains of this result set in this method - it works OK (commented part),
    but when I want to println() somewhere else (eg. in retrieveRefCursor() method) it doesn't work.
    The problem is that the scrollability of the ResultSet is lost - it becomes a TYPE_FORWARD_ONLY ResultSet.
    Is there any way to store data from ref_cursor for a long time?
    2) My second problem is "store any result set and show this data in table". I have tried use method storeNewResultSet() but
    without result (table contains only "No rows yet" and everything seems to be OK - no exception, no warning, no error...).
    I have tried to call this method with ResultSet from select on dbs (without resultSet as ref_cursor ) - no result with createRowFromResultSet(),
    storeNewResultSet(), setUserDataForCollection()...
    I've tried a lot of ways to do this, but it doesn't work. I really don't know how to make it so it can work.
    Thanks for your help.
    ADF BC, JDev 11.1.1.0
    This is my code from ViewObjectImpl
    package tp.model ;
    import com.sun.jmx.mbeanserver.MetaData ;
    import java.sql.CallableStatement ;
    import java.sql.Connection ;
    import java.sql.PreparedStatement ;
    import java.sql.ResultSet ;
    import java.sql.ResultSetMetaData ;
    import java.sql.SQLException ;
    import java.sql.Statement ;
    import java.sql.Types ;
    import oracle.jbo.JboException ;
    import oracle.jbo.server.SQLBuilder ;
    import oracle.jbo.server.ViewObjectImpl ;
    import oracle.jbo.server.ViewRowImpl ;
    import oracle.jbo.server.ViewRowSetImpl ;
    import oracle.jdbc.OracleCallableStatement ;
    import oracle.jdbc.OracleConnection ;
    import oracle.jdbc.OracleTypes ;
    public class Profiles1ViewImpl extends ViewObjectImpl {
        private static final String SQL_STM = "begin Pkg_profile.get_profile_list(?,?,?,?);end;" ;
        public Profiles1ViewImpl () {
        /* 0. */
        protected void create () {
            getViewDef ().setQuery ( null ) ;
            getViewDef ().setSelectClause ( null ) ;
            setQuery ( null ) ;
        public Connection getCurrentConnection () throws SQLException {
            // Note that we never execute this statement, so no commit really happens
            Connection conn = null ;
            PreparedStatement st = getDBTransaction ().createPreparedStatement ( "commit" , 1 ) ;
            conn = st.getConnection () ;
            st.close () ;
            return conn ;
        /* 1. */
        protected void executeQueryForCollection ( Object qc , Object[] params , int numUserParams ) {
            storeNewResultSet ( qc , retrieveRefCursor ( qc , params ) ) ;
            // callStoredProcedure ( qc , SQL_STM ) ;
            super.executeQueryForCollection ( qc , params , numUserParams ) ;
        /* 2. */
        private ResultSet retrieveRefCursor ( Object qc , Object[] params ) {
            ResultSet rs = null ;
            rs = callStoredProcedure ( qc , SQL_STM ) ;
            return rs ;
        /* 3. */
        public ResultSet callStoredProcedure ( Object qc , String stmt ) {
            CallableStatement st = null ;
            ResultSet refCurResultSet = null ;
            try {
                st = getDBTransaction ().createCallableStatement ( stmt , 0 ) ; // call 
                st.setObject ( 1 , 571 ) ; //set id of my record to 571
                st.registerOutParameter ( 2 , OracleTypes.CURSOR ) ; // my ref_cursor
                st.registerOutParameter ( 3 , Types.NUMERIC ) ;
                st.registerOutParameter ( 4 , Types.VARCHAR ) ;
                st.execute () ; //executeUpdate
                System.out.println ( "Numeric " + st.getObject ( 3 ) ) ;
                System.out.println ( "Varchar " + st.getObject ( 4 ) ) ;
                refCurResultSet = ( ResultSet ) st.getObject ( 2 ) ; //set Cursoru to ResultSet
                //   setUserDataForCollection(qc, refCurResultSet); //don't work
                //   createRowFromResultSet ( qc , refCurResultSet ) ; //don't work
                /* this works but only one-time call - so my resultSet(cursor) really have a data
                while ( refCurResultSet.next () ) {
                    String nameProfile = refCurResultSet.getString ( 2 ) ;
                    System.out.println ( "Name profile: " + nameProfile ) ;
                return refCurResultSet ;
            } catch ( SQLException e ) {
                System.out.println ( "sql ex " + e ) ;
                throw new JboException ( e ) ;
            } finally {
                if ( st != null ) {
                    try {
                        st.close () ; // 7. Close the statement
                    } catch ( SQLException e ) {
                        System.out.println ( "sql exx2 " + e ) ;
        /* 4. Store a new result set in the query-collection-private user-data context */
        private void storeNewResultSet ( Object qc , ResultSet rs ) {
            ResultSet existingRs = getResultSet ( qc ) ;
            // If this query collection is getting reused, close out any previous rowset
            if ( existingRs != null ) {
                try {
                   existingRs.close () ;
                } catch ( SQLException s ) {
                    System.out.println ( "sql err " + s ) ;
            setUserDataForCollection ( qc , rs ) ; //should store my result set
            hasNextForCollection ( qc ) ; // Prime the pump with the first row.
        /*  5. Retrieve the result set wrapper from the query-collection user-data      */
        private ResultSet getResultSet ( Object qc ) {
            return ( ResultSet ) getUserDataForCollection ( qc ) ;
        // createRowFromResultSet - overridden for custom java data source support - also doesn't work
       protected ViewRowImpl createRowFromResultSet ( Object qc , ResultSet resultSet ) {
            ViewRowImpl value = super.createRowFromResultSet ( qc , resultSet ) ;
            return value ;
    }

    Hi I have the same problem like you ...
    My SQL Definition:
    CREATE OR REPLACE TYPE RMSPRD.NB_TAB_STOREDATA is table of NB_STOREDATA_REC
    CREATE OR REPLACE TYPE RMSPRD.NB_STOREDATA_REC AS OBJECT (
       v_title            VARCHAR2(100),
       v_store            VARCHAR2(50),
       v_sales            NUMBER(20,4),
       v_cost             NUMBER(20,4),
       v_units            NUMBER(12,4),
       v_margin           NUMBER(6,2),
       v_ly_sales         NUMBER(20,4),
       v_ly_cost          NUMBER(20,4),
       v_ly_units         NUMBER(12,4),
       v_ly_margin        NUMBER(6,2),
       v_sales_variance   NUMBER(6,2)
    CREATE OR REPLACE PACKAGE RMSPRD.NB_SALES_DATA
    AS
    v_sales_format_tab   nb_tab_storedata;
    FUNCTION sales_data_by_format_gen (
          key_value         IN       VARCHAR2,
          l_to_date         IN       DATE DEFAULT SYSDATE-1,
          l_from_date       IN       DATE DEFAULT TRUNC (SYSDATE, 'YYYY')
          RETURN nb_tab_storedata;
    I have a PLSQL function .. that will return table ..
    when i use this in sql developer it is working fine....
    select * from table (NB_SALES_DATA.sales_data_by_format_gen('TSC',
                                        '05-Aug-2012',
                                        '01-Aug-2012') )
    it returning table format record.
    I am not able to call from VO object. ...
    Hope you can help me .. please tell me step by step process...
    protected Object callStoredFunction(int sqlReturnType, String stmt,
    Object[] bindVars) {
    System.out.println("--> 1");
    CallableStatement st = null;
    try {
    st = getDBTransaction().createCallableStatement("begin ? := " +"NB_SALES_DATA.sales_data_by_format_gen('TSC','05-Aug-2012','01-Aug-2012') ; end;", 0);
    System.out.println("--> 2");
    st.executeUpdate();
    System.out.println("--> 3");
    return st.getObject(1);
    catch (SQLException e) {
    e.printStackTrace();
    throw new JboException(e);

  • Problem with a procedure and an  agent

    Hi Guys,
    I created a local agent and use it to run a procedure that works Ok
    When I run the procedure using the agent it still working for a long time I tried to stopped but I can not. So I delete them.
    After that always I run the procedure despite of I use no agent it still runnig without end.
    I have created another procedure and include the same command but happens the same.
    Any body can help me?
    Edited by: ORV on Apr 8, 2011 5:21 PM

    Hi,
    The command that is include in the procedure is:
    xcopy C:\ODIHome11g\Oracle_ODI1\file\CHPS.csv Z:\
    As I mentioned runs right until I created a local agent and run it with this agent.
    Thanks

  • Problem with Stored Procedure and inout parameter and jdbc-odbc bridge

    create or replace procedure test_proc( para in out number) as
    begin
    if para = 1 then
    para := 11111;
    else
    para := 22222;
    end if;
    end;
    public static void main(String args[]) throws Exception{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String url = "jdbc:odbc:test3";
    String uid = "scott";
    String pwd = "tiger";
    Connection conn = DriverManager.getConnection(url,uid,pwd);
    CallableStatement cstmt = conn.prepareCall("{call test_proc(?)}");
    cstmt.registerOutParameter(1,Types.INTEGER);
    cstmt.setInt(1,1);
    cstmt.execute();
    System.out.println("para = " + cstmt.getInt(1));
    cstmt.close();
    conn.close();
    I get the following errors:
    Exception in thread "main" java.lang.NumberFormatException:
    at java.lang.Integer.parseInt(Integer.java:426)
    at java.lang.Integer.<init>(Integer.java:540)
    at sun.jdbc.odbc.JdbcOdbcCallableStatement.getInt(JdbcOdbcCallableStatement.java:385)
    at test_proc.main(test_proc.java:11)
    How can i get the correct result: 1111
    Note: The Oracle jdbc driver can gets the correct result.
    Pls help me! Thanks!

    Hello,
    I presume you have created the stored procedure with an INOUT parameter?

  • Problem with Pie chart, Store Procedure and Category Axis

    Hi All,
    I'm having a problem when i try to use a Pie Chart with a store procedure
    when Category Axis - Field value is "none", the chart appears, but the description say Undefined
    but when i put any field from store procedure, the chart doesn't show.
    when I try the same with a normal SQL statement, all data was displayed
    my store procedure only have 2 columns
    n - numeric
    state - text
    The Store Procedure and the SQL, returns the same data in the same order
    Thanks in advance
    Cristian

    Hi guys,
    I need guide on creating a system using store procedure, referring to this thread: JDBC System Connection VS BI JDBC System Connection
    Hope you can help me out.
    Thanks a lot,
    Sarah

  • HT4993 I recently downloaded the latest iOS 7.1. A few days later I had an unrelated problem with my phone and Apple Store provided me with a new iPhone 5.  However, when I tried to restore my backup from the Cloud, it said that iOS7 is required. what do

    I recently downloaded the latest iOS 7.1. A few days later I had an unrelated problem with my phone and Apple Store provided me with a new iPhone 5.  However, when I tried to restore my backup from the Cloud, it said that iOS7 is required. what do I do?

    Update your iphone to ios 7.

  • Since upgrade to ios6 l have been having problem with wifi connection and connecting to App Store and iTunes store

    Q since upgrade to iOS6 l have been having problem with wifi connection and getting into App Store and itunes

    Saw this on another post.
    Applecare Senior Advisor Txx Bxxx (I have his contact info in an email he just sent) just confirmed with me that the problem people are having with the App Store not loading is an apple issue with there servers, ITS NOT YOUR IPAD so don't go restoring it!   It's not happening to everyone however but they are looking into it, its really hit or miss.
    In the meantime ...........
    The Complete Guide to Using the iTunes Store
    http://www.ilounge.com/index.php/articles/comments/the-complete-guide-to-using-t he-itunes-store/
    Can't connect to the iTunes Store
    http://support.apple.com/kb/TS1368
    iTunes: Advanced iTunes Store troubleshooting
    http://support.apple.com/kb/TS3297
    Best Fixes for ‘Cannot Connect to iTunes Store’ Errors
    http://ipadinsight.com/ipad-tips-tricks/best-fixes-for-cannot-connect-to-itunes- store-errors/
    Try this first - Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.
    This works for some users. Not sure why.
    Go to Settings>General>Date and Time> Set Automatically>Off. Set the date ahead by about a year.Then see if you can connect to the store.
    ~~~~~~~~~~~~~~~~
    iOS 6 Wifi Problems/Fixes
    Fix For iOS 6 WiFi Problems?
    http://tabletcrunch.com/2012/09/27/fix-ios-6-wifi-problems/
    Did iOS 6 Screw Your Wi-Fi? Here’s How to Fix It
    http://gizmodo.com/5944761/does-ios-6-have-a-wi+fi-bug
    How To Fix Wi-Fi Connectivity Issue After Upgrading To iOS 6
    http://www.iphonehacks.com/2012/09/fix-wi-fi-connectivity-issue-after-upgrading- to-ios-6.html
    iOS 6 iPad 3 wi-fi "connection fix" for netgear router
    http://www.youtube.com/watch?v=XsWS4ha-dn0
    Apple's iOS 6 Wi-Fi problems
    http://www.zdnet.com/apples-ios-6-wi-fi-problems-linger-on-7000004799/
    ~~~~~~~~~~~~~~~~~~~~~~~
    Look at iOS Troubleshooting Wi-Fi networks and connections  http://support.apple.com/kb/TS1398
    iPad: Issues connecting to Wi-Fi networks  http://support.apple.com/kb/ts3304
    WiFi Connecting/Troubleshooting
    http://www.apple.com/support/ipad/wifi/
    How to Fix: My iPad Won't Connect to WiFi
    http://ipad.about.com/od/iPad_Troubleshooting/ss/How-To-Fix-My-Ipad-Wont-Connect -To-Wi-Fi.htm
    iOS: Connecting to the Internet
    http://support.apple.com/kb/HT1695
    iOS: Recommended settings for Wi-Fi routers and access points  http://support.apple.com/kb/HT4199
    Additional things to try.
    Try this first. Turn Off your iPad. Then turn Off (disconnect power cord for 30 seconds or longer) the wireless router & then back On. Now boot your iPad. Hopefully it will see the WiFi.
    Go to Settings>Wi-Fi and turn Off. Then while at Settings>Wi-Fi, turn back On and chose a Network.
    Change the channel on your wireless router (Auto or Channel 6 is best). Instructions at http://macintoshhowto.com/advanced/how-to-get-a-good-range-on-your-wireless-netw ork.html
    Another thing to try - Go into your router security settings and change from WEP to WPA with AES.
    How to Quickly Fix iPad 3 Wi-Fi Reception Problems
    http://osxdaily.com/2012/03/21/fix-new-ipad-3-wi-fi-reception-problems/
    If none of the above suggestions work, look at this link.
    iPad Wi-Fi Problems: Comprehensive List of Fixes
    http://appletoolbox.com/2010/04/ipad-wi-fi-problems-comprehensive-list-of-fixes/
    Fix iPad Wifi Connection and Signal Issues  http://www.youtube.com/watch?v=uwWtIG5jUxE
    Fix Slow WiFi Issue https://discussions.apple.com/thread/2398063?start=60&tstart=0
    Unable to Connect After iOS Update - saw this solution on another post.
    https://discussions.apple.com/thread/4010130
    Note - When troubleshooting wifi connection problems, don't hold your iPad by hand. There have been a few reports that holding the iPad by hand, seems to attenuate the wifi signal.
    ~~~~~~~~~~~~~~~
    If any of the above solutions work, please post back what solved your problem. It will help others with the same problem.
     Cheers, Tom

  • Problems with dropped calls and no reception on Samsung Continuum

    My mother and I both purchased a Samsung Continuum in late March 2011, and have experienced the same problems with the phone.  The device drops at least 2-3 calls per day, often on the same conversation; we have not found that location or time of day makes a difference.  The phone freezes up frequently, even if no apps are running in the background.  We lose our 3G network reception frequently, and cannot access our texts, emails, or the internet.  The screen saver kicks in even when we are actively dialing a number, or typing in a text message.  The overall performance of the phone is also poor, and it is quite slow much of the time.
    We have raised this issue several times with a representative at one of the Verizon stores, but he states that he can find no problem with the phone, and that these issues may not be covered under our insurance plan.  None of my friends with non-Samsung phones are having the same problems with phone reception and performance.  I am aggravated enough with these issues that I am considering reactivating my old Blackberry, which worked like a charm.
    I am not upset that my phone has not been updated to Android 2.2.  I just want the phone to perform as stated, and not fail at its primary function:  making and receiving phone calls.  I am not certain if these problems originate with the phone, Verizon, or Samsung, nor do I care.  I just want to resolve these issues as soon as possible, or I will have to look at other alternatives.
    Thank you.

    If this doesn't work...now what??? I have a useless $400 plus piece of unreliable junk. My Motorola Razor was ions more reliable than this phone...very, very sad but true.
    What carrier were you using with the Razor? AT&T? Same area?
    Dave M.
    MacOSG Founder/Ambassador  An Apple User Group  iTunes: MacOSG Podcast
    Creator of 'Mac611 - Mobile Mac Support' (designed exclusively for an iPhone/iPod touch)

  • Problems with Mail, Safari and iTunes after updating to 10.5.6

    Hi all,
    after installing 10.5.6 I have problems with Mail, Safari and iTunes.
    The time to open mails, websides and iTunes store is increasing dramatically since the update. If I open a webside parallel with Safari and Firefox, Safari needs minimum 15 times longer to open the complete side. Mails containing HTML-code also needs a long time to be opened. Tha same Problem with iTunes store. Connecting to the Store costs at least 30 - 40 seconds. And unfortunately for every iTunes store side I open. Its terrible
    Any idea or workaroung to solve that problem?
    Regards
    Michael

    First, run Disk Utility and repair permissions and then restart.
    I installed the 10.5.6 Combo update. Sometimes things get "lost in the translation" when you use Software Update depending on your installation. Perhaps you can download 10.5.6 Combo from the website and install it from your desktop.

  • My iphone 4 was crushed on the road.  Bought a 4 replacement tried to restore it in itunes to get my contact info and it said there was a problem with my phone and I should contact mean

    My iphone 4 was crushed on the road.  Bought a 4 replacement tried to restore it in itunes to get my contact info and it said there was a problem with my phone and I should contact apple store.  What does that mean please?

    Is the replacement exactly the same as the original ie same memory size & same version? If so it may require updating the OS software before trying to restore your stuff from the backup.

  • Problems with a Procedure

    People,
    I'm having a problem with a procedure in the moment I'm trying to execute it, could someone help.
    CREATE OR REPLACE PROCEDURE CARREGA IS
    begin
         declare
              strSQL VARCHAR2(250);
              NCham     number(9);
              cursor n_chamados is
              SELECT NumeroChamado, Planta, Instalacao, Defeito,
              DescricaoDefeito, Servico, DataChamado,Horas, Minutos
              FROM DEFEITOS_AUX;
    begin
         For reg_chamado in n_chamados
         Loop
              begin
                   NCham := reg_chamado.numerochamado;
                   strSQL := 'SELECT numerochamado FROM Defeitos';
                   strSQL := strSQL || ' WHERE numerochamado =';
                   strSQL := strSQL || NCham || ' GROUP BY numerochamado';
                   EXECUTE IMMEDIATE strSQL;
              exception
                   when no_data_found then
                   strSQL := 'INSERT INTO Defeitos (';
                   strSQL := strSQL || 'NumeroChamado, ';
    strSQL := strSQL || 'Planta, ';
                   strSQL := strSQL || 'Instalacao, ';
                   strSQL := strSQL || 'Defeito, ';
                   strSQL := strSQL || 'DescricaoDefeito, ';
                   strSQL := strSQL || 'Servico, ';
                   strSQL := strSQL || 'DataChamado, ';
                   strSQL := strSQL || 'Horas, ';
                   strSQL := strSQL || 'Minutos) ';
              strSQL := strSQL || 'VALUES ( ';
              strSQL := strSQL || reg_chamado.NumeroChamado || ', ';
              strSQL := strSQL || reg_chamado.Planta || ', ';
              strSQL := strSQL || reg_chamado.Instalacao || ', ';
              strSQL := strSQL || reg_chamado.Defeito || ', ';
              strSQL := strSQL || reg_chamado.DescricaoDefeito || ', ';
              strSQL := strSQL || reg_chamado.Servico || ', ';
              strSQL := strSQL || reg_chamado.DataChamado || ', ';
              strSQL := strSQL || reg_chamado.Horas || ', ';
              strSQL := strSQL || reg_chamado.Minutos || ')';
                   EXECUTE Immediate strSQL;
              end;
              strSQL := 'UPDATE Defeitos SET ';
              strSQL := strSQL || 'Planta = ' || reg_chamado.Planta;
              strSQL := strSQL || ', Instalacao = ' || reg_chamado.Instalacao;
              strSQL := strSQL || ', Defeito = ' || reg_chamado.Defeito;
              strSQL := strSQL || ', DescricaoDefeito = ' || reg_chamado.DescricaoDefeito;
              strSQL := strSQL || ', Servico = ' || reg_chamado.Servico;
              strSQL := strSQL || ', DataChamado = ' || reg_chamado.DataChamado;
              strSQL := strSQL || ', Horas = ' || reg_chamado.Horas;
              strSQL := strSQL || ', Minutos = ' || reg_chamado.Minutos;
              strSQL := strSQL || ' WHERE NumeroChamado = ' || NCham;
              EXECUTE Immediate strSQL;
         end loop;
    end;
    end;

    Hi Erika,
    there is no need for dynamic SQL.
    I suppose the NumeroChamado is your primary key and has an unique index on it.
    Just insert the rows and if there is already an existing row, catch the exception and update the row.
    CREATE OR REPLACE PROCEDURE CARREGA IS
      CURSOR n_chamados IS
        SELECT NumeroChamado,
               Planta,
               Instalacao,
               Defeito,
               DescricaoDefeito,
               Servico,
               DataChamado,
               Horas,
               Minutos
        FROM   DEFEITOS_AUX;
    BEGIN
      FOR reg_chamado IN n_chamados LOOP
      BEGIN
        INSERT INTO Defeitos (;
          NumeroChamado, ';
          Planta,
          Instalacao,
          Defeito,
          DescricaoDefeito,
          Servico,
          DataChamado,
          Horas,
          Minutos
        ) VALUES (
          reg_chamado.NumeroChamado,
          reg_chamado.Planta,
          reg_chamado.Instalacao,
          reg_chamado.Defeito,
          reg_chamado.DescricaoDefeito, 
          reg_chamado.Servico,
          reg_chamado.DataChamado,
          reg_chamado.Horas,
          reg_chamado.Minutos
      EXCEPTIONS
      WHEN DUP_VAL_ON_INDEX THEN
        UPDATE Defeitos SET
          Planta = reg_chamado.Planta,
          Instalacao = reg_chamado.Instalacao,
          Defeito = reg_chamado.Defeito,
          DescricaoDefeito = reg_chamado.DescricaoDefeito,
          Servico = reg_chamado.Servico,
          DataChamado = reg_chamado.DataChamado,
          Horas = reg_chamado.Horas,
          Minutos = reg_chamado.Minutos
        WHERE NumeroChamado = reg_chamado.NumeroChamado;
      END;
      END LOOP;
    END;

  • I have a problem with my motherboard and my battery of my 2010 macbook pro 13". It was just serviced with a new screen, keyboard, and logic board.

    I have a problem with my motherboard and my battery of my 2010 macbook pro 13". It was just serviced with a new screen, keyboard, and logic board. How much will a new battery and motherboard cost and would it be worth it or should I just get a new computer. It was about 300 dollars to get it serviced last week. if it adds up to much past 600 dollars I will just get a new one. THANKS FOR ANY HELP!
    P.S During classes today it began beeping in my bag. Like three kind of long steady beeps then a short pause, and when I opened it I couldn't see anything but it was on so I turned it off and back on.

    Depends on what options your Apple store offers - if they can do a depot repair (where they send it out), that's around $300 for all parts & labor.
    If the store doesn't have that option, a logicboard is around $600, battery $80-$100, from what I've seen.
    If they JUST replaced the logicboard, you absolutely should NOT have to pay for another replacement - the replacement is covered by a warranty. If they want you to pay for it, make sure you have a copy of the receipt for the work that was recently completed so you can show it to them. They have no reason to charge you for another logicboard.
    ~Lyssa

  • Problem with iTunes Match and the song "This will be (an everlasting love)" from Natalie Cole

    Hello,
    I'd like to report a problem with iTunes Match and Natalie Cole's song "This will be (an everlasting love)".
    When I stream it or download it on another device I don't get Natalie Cole's song but another one from Maxine Nightingale (Right back where we started from).
    Please tell me if you have the same problem or how I can report this problem to apple.
    Thank you.

    Hi,
    This is a user to user forum - not Apple. Contact them http://www.apple.com/support/itunes/contact/
    Alternatively if the song was purchased from iTunes, you may be able to report the problem by signing into you iTunes account on your computer. Report an problem with an item you bought from the iTunes Store, App Store, Mac App Store, or iBooks Store
    JIm

  • I had a problem with my iphone and had to restore and now i have lost all music from itunes any way to get it back ?

    i had a problem with my iphone and had to restore and now i have lost all music from itunes any way to get it back ?

    It should ne in itunes on your computer and included in your regular backup of your computer.
    If for some reason you have failed to backup your music, then - in the U.S only - you can get previous itunes purchases from the beta version of icloud.  Open itunes store, click Purchased, under Quick Links.

  • I have a problem with the battery and my iPhone 4S is restarting all the time. The phone was bought in June 2012 in LA. What can I do?

    I have a problem with the battery and my iPhone 4S is restarting all the time. The phone was bought in June 2012 in LA. What can I do?

    Since your iPhone is still under the one year warranty contact Apple Support or visit an Apple store to get a replacement.
    Apple Support - http://support.apple.com/kb/HE57

Maybe you are looking for

  • Problem printing the JTable

    Hi all, I have a problem with printing JTable. My application has a submit button,JTable and Print Button. As I click on the Submit button, the data is retrieved from the Database(MS Access) and displayed on the JTable. Now when I click on the Print

  • Getting the table names in an MS Access database

    Hi, I am new to JDBC and making a client/server application that updates a MS Access database through jdbc:odbc. I need to get a list of existing user tables in the db. I have found a great document on the net which has the code, however the code doe

  • Where is the autoblend feature

    tried to autoblend with the latest version (13) and it's not on the edit menu like the training channel shows on youtube.

  • Auto-fill lists

    I'm trying to achieve a similar functionality that can be found in the Home Inventory template in iWork '09. If you open that template, you'll see that changing the category moves the items around to be filed under the different category headings. I

  • Why is there a picture of an eye in the background?

    My cousin has a macbook from school and brought it to my house today. I noticed an image of an eye in the background. And when I say in the background it's like a watermark. It's there when the computer is first starting up and you can see it when he