Inserting sequence value from JDBC and getting the same value back

Hi: Gurus I have a table whose primary key is a sequence. I wonder how to make sure I get the same sequence value back for current transaction so I update the other table whose foreign key is the sequence value from first table.
E.g lets say I do this
String query_insert = INSERT INTO table1 (column1, ....) VALUES (HIGHLIGHT_ID_SEQ.nextval, ...);
pstmt = con.prepareStatement(query_insert);
pstmt.executeUpdate();
How I make sure no other transaction update the sequence value so I can read the last inserted sequence value and update the second table with this value
String query_select = "SELECT HIGHLIGHT_ID_SEQ.currval FROM DUAL";
pstmt = con.prepareStatement(query_select);
Regards,
Rashid.

<rant>No version again. I wonder why people requiring help want to stay anonymous and never want to type their version, only 4 digits. In this case, jdbc, not only the version of the driver is important, but also it's type. Waving a magic wand again? </rant>
Look up the returning into clause of the insert statement in the sql reference manual for your version.
Sybrand Bakker
Senior Oracle DBA

Similar Messages

  • When I try to open a download PDF I get message to install Adobe Reader. I do it and get the same message already installed. I close Safari and reopen but get same message to install Adobe

    When I try to open a download PDF I get message to install Adobe Reader. I do it and get the same message already installed. I close Safari and reopen but get same message to install Adobe

    You don't provide any details, but from the sound of it you are trying to open an online PDF in a browser that does not use the Adobe Reader plugin: http://helpx.adobe.com/acrobat/kb/pdf-browser-plugin-configuration.html

  • When I invoke Itunes I get an "error 7 (Windows 193)" message. I have reinstalled twice and get the same message. I have Windows 7 64 bit machine. Can someone help?

    When I invoke Itunes I get an "error 7 (Windows 193)" message. I have reinstalled twice and get the same message. I have Windows 7 64 bit machine. Can someone help?

    Uninstall your existing copy of iTunes. Delete any copies of the iTunesSetup.exe (or iTunes64Setup.exe) installer files from your downloads areas for your web browsers and download a fresh copy of the iTunes installer from the Apple website:
    http://www.apple.com/itunes/download/
    (The current build of the 11.1.4.62 installer was changed a few days ago, which fixed the bulk of the reports of MSVCR80.dll/R6034/APSDaemon.exe/Error-7/AMDS-could-not-start trouble ... but the build number on the installer was not changed. So we're trying to make sure you do the reinstall using a "new good" 11.1.4.62 installer instead of an "old bad".)
    Does the install with the new copy of the installer go through properly? If so, does that clear up the error message?
    If you still have the same error messages cropping up, then try the procedures from the following user tip:
    Troubleshooting issues with iTunes for Windows updates

  • I can't burn CD or DVD.  I get a "medium write error."  I bought an external CD drive, and get the same message.

    I can't burn CDs or DVDs.  I get a "medium write error."  Bought a new external CD drive, and get the same message.

    What are you trying to achieve?  Are you trying to burn to disk via the iPhoto Share ➙ Burn menu? That produces a mini library on the disk that can be used only by a Mac running iPhoto.
    If you want to burn just some image files to a data CD/DVD disk then follow Larry's recommended workflow.
    What disk type and manufacturer are your using? What system and iPhoto version are you running?  Have you run the OS X Mountain Lion: Use Apple Hardware Test? When did the burning proiblem begin?  If you can't burn a disk from the Finder then it's a hardware or system problem and not an iPhoto one.
    OT

  • I have Photoshop CS5 Extended and it says updates available but when i download the updates it says updates failed please try again later, i have tried a few times and get the same message any help would be great i am running 64bit on windows 8

    I have Photoshop CS5 Extended and it says updates available but when i download the updates it says updates failed please try again later, i have tried a few times and get the same message any help would be great i am running 64bit on windows 8.

    I am running Windows 7 64 bit ultimate and have the same problem.  My hard drive crashed, installed a new one and then reinstalled CS5 extended.  Installation went fine, but can no longer open my camera RAW files from Photoshop (camera is a Canon EOS T2i.  The message also tells me I am not eligible for the update.  I am... and I cannot open my files and I could before.  I can find nowhere to contact Adobe to tell me how to proceed.  My daughter is all a registered user of the same product and she had no problems upgrading... we purchased ours each at the same time. I do know the difference is that I had to reinstall and she did not.  If that means anything.

  • I just wrote over firefox 3.6 with 5.0 for my mac OSX and discovered my mac won't support it. Is there a way I can recover all my lost files and get the old version back?

    i just wrote over firefox 3.6 with 5.0 for my mac OSX and discovered my mac won't support it. Is there a way I can recover all my lost files and get the old version back?

    You can download and install Firefox 3.6 from http://www.mozilla.com/firefox/all-older.html

  • I tried to install yosemite yesterday and my computer goes through the whole installation process and then to a blank white screen.  I've rebooted, I've reinstalled several times and get the same result.  Two days wasted!

    I tried to install yosemite yesterday and my computer goes through the whole installation process and then to a blank white screen.  I've rebooted, I've reinstalled several times and get the same result.  Two days wasted and I can't use my computer!!

    I don't know if you've already resolved your problem, but I had the same thing, it took me 6 hours to fix it. I had the exact same as you, installed the update and then it went to a white screen. After trying start up holding down cmmd r or holding down the alt key to try to install it again, nothing worked, same result every time. Then an angel came to me here somewhere but I can't find it now to thank him. Start in safe mode, press shift once you hear the start up chime and hold it down until you hear it again. Installation completion box came up and it was working. turn off computer and start up again normally and all is well. Except my final cut pro x doesn't work with it, have to update that now too. same as when I updated to mavericks.
    Hope this helps.

  • My iphone 6 connects to the car via bluetooth, the music works good, but the phone calles does not work.  It looks like it is working but doesn't.  I have tried in my Hyundai and a Dodge rent car and get the same results.  I updated the last 8.0.2.

    My iphone 6 connects to the car via bluetooth, the music works good, but the phone calls does not work.  It looks like it is working but doesn't.  I have tried in my Hyundai Sonata and a Dodge Dart rent car and get the same results.  I updated the last 8.0.2.  It worked the first day i had the phone, and then i updated to Ios 8.0.2 and it quit working.
    Now when i get in the car, it acts like it is connected and makes the same call it was on after syncing to bluetooth, but it really isn't on a call.  This is happening on both cars.
    Does anyone know if this is the phone and i need to take it to Apple or if there is an issue that Apple is working on getting a fix for?
    My son in law has the exact same phone as me, we both got the on 10/6, he had a Dodge Dart and his is working via bluetooth.
    Someone HELP please, as i consider this a safety issue by not having my calls go to bluetooth.

    We had the same problem, but figure out the solution.
    You MUST have at least 1 song added to your ITUNE!  After you add a free song, then everything else should work as normal!
    Hope this helps!

  • How to create xml file from Oracle and sending the same xml file to an url

    How to create xml file from Oracle and sending the same xml file to an url

    SQL/XML (XMLElement, XMLForest, XMLAgg, etc) and UTL_HTTP.
    Whether that works for you with the version of Oracle you have, your requirements, and needs is another story. A little detail goes a long way.

  • Hi - for any photo, info in mountain lion shows a different file size than Photoshop does. I've tested with CS3 and CS6 and get the same problem. Doesn't happen with CS3 and OSX10.4 or any previous versions of Photoshop and OSX. Anyone know why?

    Hi - for any photo, info in mountain lion shows a different file size than Photoshop does. I've tested with both CS3 and CS6 on 10.8.2 and get the same problem. This doesn't happen with CS3 and OSX10.4 or any previous versions of Photoshop and OSX. Anyone know why?

    this one is actually a really rare symptom of a flaky connection to the ipod on a Windows PC. there's more going on in terms of hardware on nanos and 5th gens than in the earlier models ... so if the connection is flaky to precisely the right/wrong degree, itunes will see the ipod, but misidentify it as an earlier version of ipod.
    tracking down the cause of the flakiness can be tricky ... as you already know ...
    just checking. have you tried connecting with a different (known-good) USB cable? does that seem to have any impact on the rate of occurence of the problem?

  • I just restored my ipad and now when I connect it, I get a message that says itunes dected an ipad but doesn't recongnise it.  it then tells me to unplug the ipad and plug it in again.l  I do that and get the same message.

    I just restored my ipad and now when I connect it, I get a message that says itunes dected an ipad but doesn't recongnise it.  it then tells me to unplug the ipad and plug it in again.l  I do that and get the same message.

    have you tried a different usb port? for the **** of it try restarting the computer as well

  • Is there a way to burn old cd's with new cd's and get the same volume/quality on playback?

    is there a way to burn old cd's with new cd's and get the same volume/quality on playback?

    RIP the CD as AIFF or WAV.
    Create a playlist then burn an audio CD.

  • HT201210 I am trying to update my iphone 5 to the newest version (7.4) but it says I do not have enough space on my computer to update, though I have 8GB. Shouldbnt this be more than enough space? I have tried every trouble shooting option and get the sam

    I am trying to update my iphone 5 to the newest version (7.4) but it says I do not have enough space on my computer to update, though I have 8GB. Shouldbnt this be more than enough space? I have tried every trouble shooting option and get the same pop up-

    Have you tried doing an over the air update on the iPhone instead?

  • HT2493 I just updated itune and getting an error mscvr80,dll missing.  I uninstall and reinstall and getting the same message.  help

    I just updated itune and getting an error mscvr80,dll missing.  I uninstall and reinstall and getting the same message.  help

    DLL files typically do not affect Mac OS X systems.  Are you sure you are running Mac OS X?  If you are running some version of iTunes Windows, the forum for that is here:
    https://discussions.apple.com/community/itunes/itunes_for_windows

  • Tomcat and Jrun and get the same error.

    Hello freinds,
    iam facing problem with this.
    It cant able to find Enumeration although it finds Vector which is in the same package as Enumeration. but i tried its running this on both tomcat and Jrun and get the same error.
    <HTML>
    <HEAD><TITLE> Example use of Vectors </TITLE></HEAD>
    <BODY>
    <%! String name = new String("Jonh Doe");
    Integer ssn = new Integer(111223333);
    Double salary = new Double(65432.10);
    Vector employee = new Vector();
    String[] infoTitles = {"Name", "SSN", "Salary"};
    %>
    <% employee.addElement(name);
    employee.addElement(ssn);
    employee.addElement(salary);
    int i = 0;
    Enumeration employeeInfo = employee.elements();
    //while(employeeInfo.hasMoreElements()){ %>
    <P> Employee <%//= infoTitles[i++] %>: <%//= (Object)employeeInfo.nextElement() %>
    <% // } %>
    </BODY>
    </HTML>
    org.apache.jasper.JasperException: Unable to compile class for JSPC:\Tomcat\Binary\work\localhost_8080%2Fexamples\_0002fjsp_0002fmyJSPs_0002fhour_00037_0002fusingEnumerations_0002ejspusingEnumerations_jsp_18.java:75: Class
    jsp.myJSPs.hour_00037.Enumeration not found.
    Enumeration employeeInfo = employee.elements();
    can any body help me
    todd

    Hi toddyj,
    problem in the code is you havent imported the package
    here iam giving below you my tested code..
    <HTML>
    <HEAD><TITLE> Example use of Vectors </TITLE></HEAD>
    <BODY>
    <%@ page language="java" import="packagename.*" %>
    <%! String name = new String("Jonh Doe");
    Integer ssn = new Integer(111223333);
    Double salary = new Double(65432.10);
    Vector employee = new Vector();
    String[] infoTitles = {"Name", "SSN", "Salary"};
    %>
    <% employee.addElement(name);
    employee.addElement(ssn);
    employee.addElement(salary);
    int i = 0;
    Enumeration employeeInfo = employee.elements();
    //while(employeeInfo.hasMoreElements()){ %>
    <P> Employee <%//= infoTitles[i++] %>: <%//= (Object)employeeInfo.nextElement() %>
    <% // } %>
    </BODY>
    </HTML>
    I hope by this import reason your not able to find Enumeration
    Regards,
    TirumalaRao
    Developer Technical support,
    Sun MicroSystem, India.

Maybe you are looking for