How to get the inserted row primary key with out  using select statement

how to return the primary key of inserted row ,with out using select statement
Edited by: 849614 on Apr 4, 2011 6:13 AM

yes thanks to all ,who helped me .its working fine
getGeneratedKeys
String hh = "INSERT INTO DIPOFFERTE (DIPOFFERTEID,AUDITUSERIDMODIFIED)VALUES(DIPOFFERTE_SEQ.nextval,?)";
          String generatedColumns[] = {"DIPOFFERTEID"};
          PreparedStatement preparedStatement = null;
          try {
               //String gen[] = {"DIPOFFERTEID"};
               PreparedStatement pstmt = conn.prepareStatement(hh, generatedColumns);
               pstmt.setLong(1, 1);
               pstmt.executeUpdate();
               ResultSet rs = pstmt.getGeneratedKeys();
               rs.next();
//               The generated order id
               long orderId = rs.getLong(1);

Similar Messages

  • How to display the alv report blocks wise with out using the blocked alv

    Hi
    How to display the alv report with out using the blocked alv function module.
    Thanks
    Chinnu

    see this Standard Program
    RPR_ABAP_SOURCE_SCAN

  • How to get the stock of STO Report with suppling Plant/receiving Plant/open

    How to get the stock of STO Report with suppling Plant/receiving Plant/open/close qty.

    MB5T gives you Details of STO which have stok in transit.
    ME2W gives you supplying plant wise STO details.  Also in ME2W , in the ALV report output, if you select  the "delivery Schedule line" icon , you will get details such as , STO qty, Issued qty , undelivered qty etc.

  • How to get the iPhone 5c to pair with my mac book pro and my ue speaker

    How to get the iphone 5c to pair with my mac book pro and my ue speaker

    TerryReynar wrote:
    How to get the iphone 5c to pair with my mac book pro
    You don't. It only sync using iTunes.
    It doesn't "pair".
    and my ue speaker
    What is "ue speaker"?
    Ultimate Ears wirless bluetooth speaker?
    Set speaker to Pairing mode.
    On the iPhone, Settings > BlueTooth.
    Select the speaker.

  • How to get the 4 digit number associated with a SAP icon ( ICON_MAIL )

    Hi Friends,
                   Could anyone please tell me how to get the 4 digit number associated with a SAP icon ( ICON_MAIL ).
                   eg: - For ICON_GREEN_LIGHT the four digit id code is '@08@' (which you can get from ICON table )and the associated 4 digit number is'1003'.
                  Similarly I want to get the 4 digit number for ICON_MAIL(e-mail icon)
    <b><REMOVED BY MODERATOR></b>
    Ashiq
    Message was edited by:
            Alvaro Tejada Galindo

    You can use this report...It's not mine...
    REPORT zdummy_atg_2.
    TABLES: ICON.
    INCLUDE <ICON>.
    FIELD-SYMBOLS: <F>.
    SELECT * FROM ICON.
       ASSIGN (ICON-NAME) TO <F>.
       WRITE:   /(5) <F>, 20 '@',21 ICON-ID+1(2),23 '@',ICON-OLENG,
                ICON-BUTTON,ICON-STATUS,ICON-MESSAGE,ICON-FUNCTION,
                ICON-NAME.
    ENDSELECT.
    Greetings,
    Blag.

  • How to achieve Check point functionality in SSIS with out using check point.

    I got question from
    interview!!! How
    to achieve Check
    point functionality in SSIS with out using check point. If package
    fails it has to be re-run from the point that it failed instead
    of rerunning the entire package.without
    using check point.
    Please
    any one can explain step by step...

    Sorry you have failed your interview question. Good thing you remembered it, thought about it, and ask a question about it. The solution is actually very straightforward.
    Create a table to store the state of your progress. Before each step read the table to find out where left off, then skip each completed step. After each step write to the table which step you have completed. A step can be anything, a task, a component,
    a row, an import file, an export file. You don't have to use a table, it could also be a file, just something you can read and write, and does not disappear when your package stops.
    If you find this difficult to comprehend, think of a checklist of things you do everyday and work from there.

  • How To Split File In to Multiple Files With out using B.P.M

    Hi Guys,
    How To Split File In to Multiple Files With out using B.P.M.
    Thanks in advance
    Regards's
    KIran.B

    Hello
    below r the links were u will find message spilitting by graphicaaly i.e without using BPM.
    /people/claus.wallacher/blog/2006/06/29/message-splitting-using-the-graphical-mapping-tool
    Sender File Adapter with file conversion  Multimapping --file content conversion with split messg mapping
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2748---- [original link is broken] [original link is broken] [original link is broken]
    multimappig
    /people/narendra.jain/blog/2005/12/30/various-multi-mappings-and-optimizing-their-implementation-in-integration-processes-bpm-in-xi
    hope this resolve your problem
    thank's
    Chetan

  • How could I undisable my I phone 4s with out using iTunes

    How could I undisable my I phone 4s with out using iTunes

    Kittyyy wrote:
    How could I undisable my I phone 4s with out using iTunes
    You don't.  ITunes is needed.
    Forgot passcode for your iPhone, iPad, or iPod touch, or your device is disabled - Apple Support

  • How to get the last row

    I have 10 rows in my table and I have to retrive last row using rownum.
    For this I use
    SELECT * from <table_name>
    where rownum<=10
    minus
    SELECT * from <table_name>
    where rownum<=9
    The result is no rows selected
    In the same case if I use
    SELECT rownum from <table_name>
    Where rownum <= 10
    minus
    SELECT rownum from <table_name>
    where rownum <=9
    The result is 10
    Why this happend.
    If the result is 10, then why the row whose rowid is 10 is not retrived

    All
    Please bear in mind that ROWNUM is an attribute of the query NOT the table. The last row returned by an unORDERed SELECT statement may be the most recently inserted row but is not guaranteed to be so.
    The only way of assuring yourself of returning the most recent row is either to timestamp all your tables with a date_created column or to use a primary key with an ascending value.
    rgds, APC

  • How to get the private and public key?

    there is my code,i want to get the public key and the private key �Cbut i could not find the the approprite method to solve the problem.
    import java.security.Key;
    import javax.crypto.Cipher;
    import java.security.KeyPairGenerator;
    import java.security.KeyPair;
    import java.security.Security;
    public class PublicExample {
    public static void main(String[] args) throws Exception {
    if (args.length != 1) {
    System.err.println("Usage:java PublicExample <text>");
    System.exit(1);
    byte[] plainText = args[0].getBytes("UTF8");
    System.out.println("\nStart generating RSA key");
    KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
    keyGen.initialize(512);
    KeyPair key = keyGen.generateKeyPair();
    System.out.println("Finish generating RSA key");
    Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
    Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding", "BC");
    //System.out.println("\n" + cipher.getProvider().getInfo());
    System.out.println("\nStart encryption");
    cipher.init(Cipher.ENCRYPT_MODE, key.getPublic());
    byte[] cipherText = cipher.doFinal(plainText);
    System.out.println("Finish encryption:");
    System.out.println(new String(cipherText, "UTF8"));
    System.out.println("\nStart decryption");
    cipher.init(Cipher.DECRYPT_MODE, key.getPrivate());
    /*i want to get the private and public key in this method ,but i found the result was not
    the one i expected to get,how to solve the problem?
    thanks in advance!
    System.out.println("private key:" + key.getPrivate().toString());
    System.out.println("public key:" + key.getPublic().toString());
    byte[] newPlainText = cipher.doFinal(cipherText);
    System.out.println("Finish decryption:");
    System.out.println(new String(newPlainText, "UTF8"));
    thanks in advance!

    System.out.println("private key:" +
    " + key.getPrivate().toString());
    System.out.println("public key:" +
    + key.getPublic().toString());
    key.getPrivate() returns an instance of PrivateKey and key.getPublic() returns an instance of PublicKey. Since PublicKey and PrivateKey are interfaces then they will return one of the concrete implementations. Check out the Javadoc for PublicKey and PrivateKey.
    When you know which concreate implemenation you have then you can use the methods on that object (by appropriate casting) to find the information you want.

  • How to get the system specific hardware key.

    Hi all,
        I want to get the System specific hardware key(May be Hard disk related key which is unique for every System.) .Now i need to get it using a java program. if possible send me the related links and sample source code. pls help me out to resolve this issue.
    Regards,
    Kiran.

    hi,
       I can able to get the Mac address of computer using the java program. But when i am running a software called "PCQualifier.exe" i am getting the parameters like "uniqueID" and "unique code". so where and how he is getting those things please help me to get those things using a java programme. Any how i am sending the results that i have got after ruuning PCQualifier.Pls kindly help me out to resolve this issue.
    Computer Name  JAVADEV0005  
    Operating System  Windows XP 5.1 build 2600 (Service Pack 2)  
    Ethernet Details                   Name [00000008] Broadcom NetXtreme Fast Ethernet                   Adapter Type Ethernet 802.3                  
    MAC Address 00:11:25:F2:98:EF   
    Hard Disk Capacity    Total      39.06GB  
                          Used       84 %  
                          Free       6.16GB  
    RAM Capacity    Total      502 Mbyte  
                    Used       69 %  
                    Free       154 Mbyte  
    CDROM Status  CD-ROM Drive Present  
    USB Information   
    Total system supported Ports 0  
    Total Physical Ports 0  
    Total Devices Connected 0  
    Total Free Ports 0  
    Unique ID  5790315021  
    Unique Code  FNVVEFEFHIKO
    Thanks & Regards
    Kiran.

  • How to get the private and public keys to use recaptcha?

    I have registered with google to get a recaptcha for my website. All I got was the site key and secret key! Though I need to get the public and private key for muse!

    Hello,
    Please use site Key as "Public Key"and Secret key as "Private Key".
    Regards
    Vivek

  • URGENT: How to see the inserted row results in the ResultSet after an insertRow()?

    I want to see the inserted row in my result set immediately after I do an insertRow(). I don't want to do another select as my table has 100,000 records. I am using TYPE_SCROLL_SENSITIVE and CONCUR_UPDATABLE resultset with 8.1.7 thin driver.
    May be the driver does not support this because dbmd.ownInsertsAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)) always returns false. I just want to know is there a workaround or any solution for this problem. I would really appreciate if somebody could help me. Thanks in advance.

    Okay, first execute the query reqd. Then make whatever filters, navigational changes etc that are reqd. Once you are satisfied with the view of the data that you see on the screen, then from the Bex toolbar, click the Save button (Second from left) and choose the option Save as View Global. Give it a decsription and technical name.
    Hope this helps...

  • How to get the Page Number in CS3 with VB?

    Hi, Everybody
    I use the Visual Basic to read the words and their page number where the Words are at. I want to do it according to Story. Some TextFrame of the Story waw placed in other pages: How can I get the Page number according to the Word that is selected?
    For myStoryCounter = 1 to Document.Stories.Count
    Set myStory = Document.Stories.Item(myStoryCounter)
    For myWordCounter = 1 to myStory.Words.Count
    Set myWord = myStory.Words.Item(myWordCounter)
    myWordContents = myWord.Contents
    Rem ** How to Get the Page Number according to the Word ***
    Next
    Next

    > But I don't understand why Item(1) are set.
    because Word can have more than one parent TextFrame - when split across TextFrames
    only Character have one ParentTextFrame accessed also by ParentTextFrames.Item(1)
    > why Story.TextFrames.Count alway is 0, Is it bug?
    no - it's not bug
    in older IDs - Story.TextFrames collection refer to all TextFrames as containers for Story text
    but in CS3 - collection Story.TextFrames contain all TextFrames inserted as InLine/Anchored objects - same like Story.Rectangles or Story.Ovals
    in CS3 - when you want to refer to TextFrames as containers for Story text - you need to use Story.TextContainers - because now you can link TextFrame and Text-On-Path as Story - Text-On-Path isn't TextFrame
    robin
    www.adobescripts.com

  • How to get the number of years, months with two sysdate()

    Hi All,
    Sorry for posted another question regarding the conversion.
    I have the hiring day and current day in date format like : '2005-10-01' and '2006-09-14'
    How to get the differences between current date is ('2006-09-01') and
    hiring date is ('2004-10-01' )
    in the format number of years and number of month without using the Mod
    function . For this example the result is : 2 years 1 month
    Thanks
    JP

    How to get the differences between current date is ('2006-09-01') and
    hiring date is ('2004-10-01' )
    in the format number of years and number of month without using the Mod
    function . For this example the result is : 2 years 1 monthshould not it be 1 year 11 months???
    SQL> select (date '2006-09-01' - date '2004-10-01') year to month diff from dual;
    DIFF
    +01-11

Maybe you are looking for