SELECT MAX() vs Oracle_SID Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: SELECT MAX() vs Oracle_SID

  1. #1
    Join Date
    Jul 2001


    I have an Oracle backend for an ASP application. I want to know about using SELECT MAX vs using Oracle_SID. I'm particularly interested in issues of concurrent users inserting records. From an SQL statement standpoint, SELECT MAX is easy to use. If I were to use Oracle_SID, what would be the steps involved? Would I have to create a pre-insert trigger for the Oracle_SID? How does this effect the SQL INSERT statement? Does the trigger handle creating the PK Index entry or do I still have to account for it in the SQL statement? Thanks!

  2. #2
    Join Date
    Nov 2000
    Not really sure where ORACLE_SID comes in, but I am guessing you are referring to a sequence. Using SELECT MAX() poses one big problem with multi user apps; you can't GUARANTEE that two users won't get the same result for MAX(). This would lead to identical PK values.

    The best solution is to use a BEFORE INSERT trigger and let the trigger pick a value off the sequence and insert that value into the table.
    Jeff Hunter
    Get Firefox!
    "I pledge to stop eating sharks fin soup and will not do so under any circumstances."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width