ON UPDATE CASCADE and Autoincrement primary key with Oracle SQL Developer

hello everybody,
I want to know if Oracle SQL Developer manage autoincrement on primary key and "ON UPDATE CASCADE" when i migrate (with data) SQL Server database in Oracle database.
Can you help me ?
Thanks for your suggestions.

Obtain the value of the auto increment key with the getGeneratedKeys() method.
Statement stmt = null;
ResultSet rs = null;
stmt = conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY,
                                java.sql.ResultSet.CONCUR_UPDATABLE);
stmt.executeUpdate("DROP TABLE IF EXISTS autoIncTable");
    stmt.executeUpdate(
            "CREATE TABLE autoIncTable ("
            + "priKey INT NOT NULL AUTO_INCREMENT, "
            + "dataField VARCHAR(64), PRIMARY KEY (priKey))");
stmt.executeUpdate(
            "INSERT INTO autoIncTable  (dataField) "
            + "values ('data field value')",
            Statement.RETURN_GENERATED_KEYS);
int autoIncKeyFromApi = -1;
    rs = stmt.getGeneratedKeys();
    if (rs.next()) {
        autoIncKeyFromApi = rs.getInt(1);
    } else {
    rs.close();

Similar Messages

  • Developerday  VM Ora-12505 Getting Started with Oracle SQL Developer 3.0

    Just downloaded the VM , Started the tutorial Getting Started with Oracle SQL Developer 3.0
    As mentioned in tutorial , I was trying to make a new connection and I am getting following error
    Ora - 12505 : TNS Listener doesn't currently know of SID
    I gave SID as orcl, and seems to be working OK, can I use orcl for this tutorial
    Edited by: OrcArgusDev on Apr 13, 2012 9:01 AM
    Edited by: OrcArgusDev on Apr 13, 2012 9:11 AM

    Thanks, I'll survive. Just my luck, the first item I try to anon. debug didn't work! :)
    thanks, hopefully this problem will be few and far between

  • Problems using SQL*Loader with Oracle SQL Developer

    I have been using TOAD and able to import large (milllions of rows of data) in various file formats into a table in an Oracle database. My company recently decided not to renew any more TOAD licenses and go with Oracle SQL Developer. The Oracle database is on a corporate server and I access the database via Oracle client locally on my machine. Oracle SQL Developer and TOAD are local on my desktop and connected through TNSnames using the Windows XP platform. I have no issues with using SQL*Loader via the import wizard in TOAD to import the data in these large files into an Oracle table and producing a log file. Loading the same files via SQL*Loader in SQL Developer, freezes up my machine and I cannot get it to produce a log file. Please help!

    I am using SQL Developer version 3.0.04. Yes, I have tried it with a smaller file with no success. What is odd is that the log file is not even created. What is created is a .bat file a control file and a .sh file but no log file. The steps that I take:
    1.Right click on the table I want to import to or go to actions
    2. Import Data
    3. Find file to import
    4. Data Preview - All fields entered according to file
    5. Import Method - SQL Loader utility
    6. Column Definitions - Mapped
    7. Options - Directory of files set
    8. Finish
    With the above steps I was not able to import 255 rows of data. No log file was produced so I don't know why it is failing.
    thanks.
    Edited by: user3261987 on Apr 16, 2012 1:23 PM

  • Problems when starting with oracle SQL developer

    Hello,
    I am very much new with oracle SQL developer. I use oracle 10g and have a database named 'pallabDB' with username: xxxxxx and paswd:yyyyyy. I have installed oracle SQL developer.But i am unable to start up.What i should do? If any body replies it will be a great help.Thanks in advance.

    But i am unable to
    start up.How to understand this sentence without confusion?
    Can you explain exactly what is your problem at start up of SQL Developer?

  • Getting the UPDATEd value and its primary key

    I have two procedures, proc1 and proc2.
    In proc1 there is an update happening like
    CREATE OR REPLACE procedure proc1
    as
    TYPE NumList IS TABLE OF employees.employee_id%TYPE;
    enums NumList;
    TYPE NameList IS TABLE OF employees.last_name%TYPE;
    names NameList;
    BEGIN
    UPDATE emp set sal=900 WHERE department_id = 30
    RETURNING employee_id, last_name BULK COLLECT INTO enums, names;
    DBMS_OUTPUT.PUT_LINE('Updated ' || SQL%ROWCOUNT || ' rows:');
    FOR i IN enums.FIRST .. enums.LAST
    LOOP
    DBMS_OUTPUT.PUT_LINE('Employee #' || enums(i) || ': ' || names(i));
    END LOOP;
    END;
    /In proc2 which is getting executed just after proc2 i want to SELECT the sal column values and its primary keys(employee_id) which got updated in proc 1.
    How can i achieve this?

    add two out parameters from proc1 so that you can pass them into proc2 (obv. you'd need to add two in parameters to proc2 if they aren't there already)

  • Issue with Oracle SQL Developer

    I use a oracle database for my process (LMS relared stuff)
    When i write a query which is expected to pull thousands and thousands of records. Why do i need to keep scrolling down to fetch more records.
    Why will it not pull all the records?
    I need to keep scrolling down till i get all the records.
    Any solution?
    (I'm using it for the first time in my life. i'm just 3 day old to this software)
    My O/S: Win XP Professional with 1gb of RAM.
    Oracle SQL Developer Version: 1.2.1 Build Main-32.13
    Is any other information required???
    Message was edited by:
    user599780

    This will be in the next release. However, if you want to put this in now you can make an extension ( there's examples on my blog) and put this chuck of code in:
    Connections.getInstance().addConnectionListener(new ConnectionListener() {
                   public void connectionAdded(ConnectionEvent evt) {}
                   public void connectionClosed(ConnectionEvent evt) {}
                   public void connectionModified(ConnectionEvent evt) {}
                   public void connectionOpened(ConnectionEvent evt) {
    Connection conn = Connections.getInstance().getConnection(evt.getConnectionName());
    if (conn instanceof OracleConnection){                                   
    ((OracleConnection)conn).setDefaultRowPrefetch(DBConfig.getInstance().getInt(DBConfig.ARRAYFETCHSIZE));
                   public void connectionRemoved(ConnectionEvent evt) {}
                   public void connectionRenamed(ConnectionEvent evt) {}
    });

  • Create connection with Oracle SQL Developer

    Hello,
    my test to connect my Oracle database with SQL*PLUS works. Here I need only the username (I test with system), my password and the hostname (orcl).
    Now I want to create this connection with the SQL Developer.
    Here I need the Port. I don't know the port of my database. How can I find it out?

    Hi, the port must be the used by listener, review the $ORACLE_HOME/network/admin/listener.ora file or get the listener status(lsnrctl status) for get the correct port.
    You can try with the default port. (1521).
    Luck.
    Havea good day.
    Regards.

  • Debugging a PL/SQL with Oracle SQL Developer

    I am trying to debug pl in Oracle SQL Developer, have looked in
    http://www.oracle.com/technology/obe/11gr2_db_prod/appdev/sqldev/plsql_debug/plsql_debug_otn.htm#t5
    and there are not enabled the options "Data", "Smart Data", etc someone knows why?
    thank you.

    In the log windows, when debug, show tihis:
    Conectando a la base de datos OPAVID - Inventariado.
    Ejecutando PL/SQL: ALTER SESSION SET PLSQL_DEBUG=TRUE
    Ejecutando PL/SQL: CALL DBMS_DEBUG_JDWP.CONNECT_TCP( '10.240.193.202', '2310' )
    Later, 1 min.
    show this
    ORA-30683: failure establishing connection to debugger
    ORA-12535: TNS:operation timed out
    ORA-06512: at "SYS.DBMS_DEBUG_JDWP", line 68
    ORA-06512: at line 1
    El proceso ha terminado.
    Desconectando de la base de datos OPAVID - Inventariado.
    so, do you think, the problem is a firewal, i can´t verify this.

  • Problem with Oracle SQL Developer 3.0.04

    1. Performing a "SELECT *" on an Oracle table with a SDO_GEOMETRY column locks up the tool and I have to use Task Manager to can it.
    2. Clicking the Data tab on a table with an SDO_GEOM col either locks up the tool, or taked forever to return.
    3. Performing a "SELECT" of a SDO_GEOM col either locks up the tool or takes forever to return.
    None of these issues occur in Toad.

    If you have a problem with SQL Developer, you'd be best off posting in the SQL Developer!

  • Svn with oracle sql developer

    Hi all,
    oracle client is installed with sql developer on local window system.My db server is 'x.x.x.x.'.Connectivity is there from local system to db server from sqldeveloper.
    My svn repository is on linux server 'y.y.y.y.'. I am unable to access repository from sql developer.
    I want to create my database repository there. Plaese help.

    I am unable to access repository from sql developer.Can you elaborate? What happens when you try?

  • Connect to SQL Server with Oracle SQL Developer

    Hi,
    I am unable to connect to a named instance (Enigma\Enigma) on my local machine using sql developer. Every time I try to connect it says Cannot connect to Microsoft SQL Server on Enigma.
    Somebody please assist.

    Have you tried it on Forum : SQL Developer
    SQL Developer

  • Help how to connecting Oracle SQL Developer 3.0  with Oracle Database 11g

    Hello,
    I'm new in oracle developer yesterday i setup in my laptop database 11g the last version (11.2.0.1.0), well i follow steps still i got succeed to install, and i got my local host URL and i test my user name and password work very well, my problem now is i try to connect database 11g using Oracle SQL Developer 3.0 (3.0.04.34) but always filed and with my little experience i don't know where the wrong. as i said i test database after finish install is work fine the my URL is https://Ahmed-HP:1158/em and i test my username and password that i already set before is enter normal in my local database, please i need help to know how i connect database with Oracle SQL Developer 3.0 (3.0.04.34).
    Thanks,

    885173 wrote:
    EdStevens, thanks for your quick answer, sorry for my explain was doesn't clear, i open oracle sql developer and choose new connection i set connection name system_orcl username:system password:*i set my password that i create when i setup database*
    -Now the link that i got after finish install database is https://Ahmed-HP:1158/em so i have question about this point Hostname and port if the link to access database is this https://Ahmed-HP:1158/em so this mean i typing at Hostname:localhost and port:1158 ?
    because the message when i test connection always is filed and I'm sure i typing username and password and SID:orcl as i set when install database.port 1158 is what the dbcontrol (Oracle Enterprise Manager) is listening on. OEM is NOT the database. As far as the database is concerned, OEM is "just another client".
    Actually, the database doesn't listen for requests on any port. There is another process, the "listener" that listens for requests to connect to the database. Typically, it listens on port 1521. You should have a tnsnames.ora file set up to resolve a connection request to the correct host. You can read more on this at http://edstevensdba.wordpress.com/2011/02/09/sqlnet_overview/

  • Oracle sql developer and access db

    Hi All,
    I have connection to oracle and Access dbs’ on my oracle sql developer.
    When i try to create a database link from oracle db to access db i have to add Host Name.
    Connection details to access looks like this :
    @jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\ list.mdb;DriverID=22;READONLY=false}
    I tried different variants, but it doesn’t work.
    Is this possible to create database link to access db, and if yes, what i have to add for a host name and what is the syntaxes for cross table ?
    Thank you

    Good documentation here... http://www.orafaq.com/node/60
    TimS

  • Updating primary key with jdbc

    Trying to update a primary key with:
    public static void updateTAXID(String coid,String accountnumber,String oldTAXID,String fundname,String newTAXID){ Properties props = TradeHelper.loadProperties(); Connection conn = null; PreparedStatement st = null; String sql ="update FinancialAccount set taxid=? " + "where dealernumber=? and " + "taxid=? and " + "fundname=? and " + "accountnumber=?"; try{ Class.forName(props.getProperty("driver")); conn = DriverManager.getConnection(props.getProperty("brokerageurl"), props.getProperty("user"),props.getProperty("password")); st = conn.prepareStatement(sql); st.setString(1, newTAXID); st.setString(2, coid); st.setString(3, oldTAXID); st.setString(4, fundname); st.setString(5, accountnumber); st.executeUpdate(); System.out.println("Update: new tx:"+newTAXID+":"+"Ol tx: "+oldTAXID+" act:"+accountnumber); conn.close(); st.close(); }catch(Exception e){ e.printStackTrace(); } }
    I keep getting this error:
    com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate entry '02673025561-QA-SLFCA-' for key 'PRIMARY'         at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1011)         at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)         at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)         at com.mysql.jdbc.PreparedStatement.exe
    Am I not able to update a single field of a composit key with jdbc? Whay is my update failing telling that there is a duplicate when I am trying to update?

    iketurner wrote:
    I keep getting this error:
    com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate entry '02673025561-QA-SLFCA-' for key 'PRIMARY'
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1011)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)
    at com.mysql.jdbc.PreparedStatement.exeAm I not able to update a single field of a composit key with jdbc? Whay is my update failing telling that there is a duplicate when I am trying to update?If you take the error message at its word then the problem is not that you are not permitted to update a primary key but that the values you are trying to use is already in use.
    I'll leave it you DBA and/or Data Modeler/Architech to decide if it is a good idea to update the value or not.

  • Creating a primary key with the parallel option and the tablespace option

    I know I can create a unique index with these options and then make the primary key with the "using index" clause. anyway to do this and skip the create unique index and just create the primary key ?

    SQL> ALTER TABLE t
      2  ADD CONSTRAINT pk_t
      3  PRIMARY KEY (testcol)
      4  USING INDEX
      5  TABLESPACE example
      6  PARALLEL (DEGREE 2);
    PARALLEL (DEGREE 2)
    ERROR at line 6:
    ORA-03001: unimplemented featureYou can name the tablespace but you must do an alter index thereafter.

Maybe you are looking for

  • At a total loss on a file sharing issue

    I have been using file sharing for years and have never had a problem. Tonight that streak has come to an end and I feel stupid! I have built myself a PC for work. However, I want to be able to share files with my Mac on it. Here is my setup... On my

  • Is there a way to record sounds from keyboard as they are?

    So I have a musical keyboard that I've attached to my macbook to record in Garageband. I have a ton of sounds on my keyboard from percussion, brass, piano, etc. When I record, for example, a trumpet sound from my keyboard into Garageband, Garageband

  • Loose hinge on 30" ACD

    Hi, I just opened up my brand new 30" ACD. I noticed that the foam packing was broken on one side, indicating that it had been handled a bit roughly in shipping. However, the display seems to be OK. The only problem is the hinge on the stand. My olde

  • Oracle Migration Windows to REDHAT 4 Linux

    Dear All, I did not solve my problem. i need to trasfer my instace windows to redhat. How can i do? i did following steps: 1-Install oracle 10g R2 same version on my production database which is on widnows 2-I taken cold back my production database f

  • Toast 11 and ASUS Blue-Ray burner not working together!

    Hey All, I recently got an ASUS SBC-06D2X-U Blue-Ray burner and found out that little "Mac compatabile" label isn't correct. Had to get Toast 11. Now I have that and the disk spits out still when I try to burn. I don't know what to do at this point.