How to get maxvalue of sequence in table

hi,
i have made a sequence to be used for an ID column of a table as a primary key. now this sequence is incremented by one,, suppose the maxvalue in this column is 5,,and i want to store next row with ID = 6,,and the statement rollbacks or failed due to any other reason,,the value of 6 has gone,,and nextval would be 7,,how can i get my ID column as an autoincrement such as Autonumber in MS SQL Server ,,is there any other technique available in Oracle??
onetechnique is this tht we get maxvalue of the column thru query and then ourself increment in it,,but this is not a sophisticated way,,
any suggestion would be highly appreciated.
Regards
Muhammad Umar Liaquat.

By definition, you cannot guarantee that values in a sequence generated column are gap-free. There are a number of different things that can cause gaps, including rollbacks.
Is there a legitimate business reason that you want a gap-free sequence of values? 99% of the time, this sort of request has no real justification. If there is a justification, the underlying problem can be solved by adding rownum or dense_rank() to a view on the data for the business users to query.
If you do need gap-free sequences, you have to serlialize transactions-- only one transaction at a time can get an ID. This is obviously a scalability killer.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC

Similar Messages

  • How to get the data from Pooled Table T157E.

    Hi Experts,
    How to get the data from Pooled Table T157E.
    Any help.
    Thanks in Advance,
    Ur's Harsha.

    create some internal table similar to T157E and pass all data as per SPRAS.
    After that use internal table in your program as per the requirement.
    Regds,
    Anil

  • How to get the size of the table

    Hi All,
    How to get the size of the table in Oracle 10g?
    Is there any script which needs to be run?
    Regards,
    Apoorv

    Hi All,
    Sorry but somehow the table user_segments is not populated in my case. But we have another table SYS.ALL_TABLES whose structure is given below. Would I be able to calculate the table size based on the columns given below:
    ColumnName     Data Type
    OWNER     VARCHAR2 (30 Byte)
    TABLE_NAME     VARCHAR2 (30 Byte)
    TABLESPACE_NAME     VARCHAR2 (30 Byte)
    CLUSTER_NAME     VARCHAR2 (30 Byte)
    IOT_NAME     VARCHAR2 (30 Byte)
    STATUS     VARCHAR2 (8 Byte)
    PCT_FREE     NUMBER
    PCT_USED     NUMBER
    INI_TRANS     NUMBER
    MAX_TRANS     NUMBER
    INITIAL_EXTENT     NUMBER
    NEXT_EXTENT     NUMBER
    MIN_EXTENTS     NUMBER
    MAX_EXTENTS     NUMBER
    PCT_INCREASE     NUMBER
    FREELISTS     NUMBER
    FREELIST_GROUPS     NUMBER
    LOGGING     VARCHAR2 (3 Byte)
    BACKED_UP     VARCHAR2 (1 Byte)
    NUM_ROWS     NUMBER
    BLOCKS     NUMBER
    EMPTY_BLOCKS     NUMBER
    AVG_SPACE     NUMBER
    CHAIN_CNT     NUMBER
    AVG_ROW_LEN     NUMBER
    AVG_SPACE_FREELIST_BLOCKS     NUMBER
    NUM_FREELIST_BLOCKS     NUMBER
    DEGREE     VARCHAR2 (10 Byte)
    INSTANCES     VARCHAR2 (10 Byte)
    CACHE     VARCHAR2 (5 Byte)
    TABLE_LOCK     VARCHAR2 (8 Byte)
    SAMPLE_SIZE     NUMBER
    LAST_ANALYZED     DATE
    PARTITIONED     VARCHAR2 (3 Byte)
    IOT_TYPE     VARCHAR2 (12 Byte)
    TEMPORARY     VARCHAR2 (1 Byte)
    SECONDARY     VARCHAR2 (1 Byte)
    NESTED     VARCHAR2 (3 Byte)
    BUFFER_POOL     VARCHAR2 (7 Byte)
    ROW_MOVEMENT     VARCHAR2 (8 Byte)
    GLOBAL_STATS     VARCHAR2 (3 Byte)
    USER_STATS     VARCHAR2 (3 Byte)
    DURATION     VARCHAR2 (15 Byte)
    SKIP_CORRUPT     VARCHAR2 (8 Byte)
    MONITORING     VARCHAR2 (3 Byte)
    CLUSTER_OWNER     VARCHAR2 (30 Byte)
    DEPENDENCIES     VARCHAR2 (8 Byte)
    COMPRESSION     VARCHAR2 (8 Byte)
    DROPPED     VARCHAR2 (3 Byte)

  • How to get the value from Advanced table

    Hi,
    In the Advanced table have 2 LOV fields, I need LOV field value dynamically in the controller to validate the save button, if iam not selected any value in lov save button will not allow to save the data. In the table i am using 'Add another row'. How to get the lov field value in the process form request??? and how to do this requirement
    Thanks
    Naresh

    1. You can specify required property on LOV field to "yes". For events where you wish to disable the client side validations, set the property disable client side validation to "true".
    2. If above behavior is not what you are looking for, then you need to handle in AM and not CO.
    a. Call an AM method from CO.
    b. In that AM method, get handle of VO.
    c. Iterate the VO Rows and check for your validation rules.
    -Prince
    http://www.princekapoor82.blogspot.com

  • How to get the links from Master table

    Hi,
    I need to show url on the jsp page which should be taken from Backend "Master Table".
    say an example like some value CRM_IMAGE =  ZWEB CRMIMAGE.I need to show CRM_IMAGE as  Hyperlink on the product detail.jsp.
    Can anyone help me for this.
    Regards,
    Deepika
    Edited by: Ecom Dev on Dec 21, 2009 11:05 AM

    Hi Ecom,
    To retrieve value on product detail page you have to develop your custom code in which you have to create BO, BOM, BEI and BEO to access Your master table data from ISA page.
    You also need to create Custom RFC in which you pass porduct ID and retrieve related value from Master Table.
    You can find example in ISA tutorial how to get value from Back-end via JCO.
    eCommerce Developer
    Edited by: Ecommerce Developer on Dec 21, 2009 11:44 AM

  • In badi ME_PROCESS_PO_CUST how to get preivious row value from table ctrl?

    hi Friends,
    I am Using ME_PROCESS_PO_CUST badi for validation in Purchase oreder (ME21N),
    For that I implementaed PROCESS_ITEM method which fires during each row now i want to add another validation in same implimentation for that i need privious row's value so how to get that value ?
    following is my current validation code. 
    method IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM.
      DATA:ls_poitem TYPE mepoitem.
      DATA:ls_poheader TYPE MEPOHEADER.
      DATA:lm_poheader TYPE ref to IF_PURCHASE_ORDER_MM.
      DATA:w_mara TYPE mara.
      DATA:IT_ZMMTBL039 TYPE STANDARD TABLE OF ZMMTBL039 ,
           WA_ZMMTBL039 TYPE ZMMTBL039 .
      DATA:ls_poitem1 TYPE mepoitem.
      DATA:V_KUNNR1 TYPE KNA1-KUNNR.
      DATA:V_KUNNR2 TYPE KNA1-KUNNR.
      ls_poitem = im_item->get_data( ).
      lm_poheader = im_item->GET_HEADER( ).
      ls_poheader = lm_poheader->GET_DATA( ).
      CLEAR: WA_ZMMTBL039,w_mara.
      REFRESH:IT_ZMMTBL039[] .
      SELECT *
        INTO  TABLE  IT_ZMMTBL039
        FROM ZMMTBL039
       WHERE bsart EQ ls_poheader-bsart.
      IF sy-subrc EQ 0.
        CLEAR: WA_ZMMTBL039,w_mara.
        SELECT SINGLE *
          INTO w_mara
          FROM mara
         WHERE matnr EQ ls_poitem-MATNR.
        IF SY-SUBRC EQ 0.
          READ TABLE IT_ZMMTBL039 INTO WA_ZMMTBL039 WITH KEY  bsart = ls_poheader-bsart
                                                              mtart = w_mara-mtart
                                                              spart = w_mara-spart.

    Hello
    If you had searched the SDN forums you would have found plenty of answers to your question.
    Following is some sample coding:
    method IF_EX_ME_PROCESS_PO_CUST~POST.
    DATA:
        ls_header TYPE mepoheader,
      lt_items   TYPE purchase_order_items,
      ls_item   TYPE purchase_order_item,
      ls_item TYPE mepoitem.
      ls_header = im_header->get_data( ).
      lt_items = im_header->get_items( ).
      LOOP AT items INTO ls_item.
        ls_item = line_item-item->getdata( ).
        " process item data...
      ENDLOOP.
    ENDMETHOD.
    Regards,
      Uwe
    PS: Do not use such kind of pseudonyms instead of your real name. Because my impression is that a nobody (in term of ABAP development competence) tries to claim to be a somebody who fills his knowledge gaps via SDN. Using pseudonyms significantly decreases your changes to get any answers at the SDN forums.

  • How to get current row data in table control

    Hi , expert ,
       I am professional in oracle ,  but  now I am a new guy in SAP ABAP .
    I  have a question in UI
    How to get current row data and click pushbutton  in table control  to open next screen ?
    I want to get the current data and open next screen to carry out detail detail .
    Thansk for all your suggestion .

    GET CURSOR LINE SY-CUROW .
      READ TABLE internal_table index SY-CUROW.

  • How to get the script of a table or view in SQL Developer?

    Dear friends/expert,
    Could you tell me how to get the script for a view or a table easily in SQL Developer like pressing F4 in TOAD?
    I found that I can press SHIFT+F4 for a view in SQL Developer and get the script of the view in Details Tab. But how to move the script to SQL worksheet to edit? It is very easy to do in TOAD.
    And I didn't find a way to get the script for a table till now. Is there any way to do that?
    Thanks in advance.
    Best regards,
    Ning

    1. Although the team might put a lot of effort in keeping track on the forum, a lot of posts still go by without answer.
    2. If you have an enhancement request, log it at the announced SQL Developer Exchange, so others can vote to add weight on the issue. Be clear and detailed in the explanation.
    3. Given the structure of the application, I guess it won't be easy (maybe impossible) to add the functionality you are asking. Do you have a suggestion on how to access the info?
    4. If your request gets accepted, still another year or two may go by until the functionality gets added. For sure you'll be better off writing a user defined extension or report (querying DBMS_METADATA.GET_DDL).
    Hope that helps,
    K.
    Edited by: -K- on 12/01/2009 09:37

  • How to get changed records in a table

    I have a table t1 as
    create table t1( num number, name varchar2(35),code char(2));
    my data looks like
    num name code
    1 xy c1
    2 zx c2
    3 qq c5
    after 2 hr i have changed my value to:
    1 zx c3
    2 za c2
    3 qq c5
    i need to get a select statement which gives the changed rows:
    my output looks like:
    1 zx c3
    2 za c2
    how to get these changed rows
    Thanks in advance

    "It's not working" - fabulous feedback.
    Really any reply to that should be just left at "because you're doing it wrong" however....
    The flashback query syntax doesn't work like that.
    Has to be more like this:
    select t1.column,t2.column
    from t1 ,t2
    where t1.column=t2.column
    MINUS
    select t1.column,t2.column
    from t1 AS OF TIMESTAMP TO_TIMESTAMP('27.04.2011 10:00:00', 'DD-MM-YYYY HH24:MI:SS')
    ,    t2 AS OF TIMESTAMP TO_TIMESTAMP('27.04.2011 10:00:00', 'DD-MM-YYYY HH24:MI:SS')
    where t1.column=t2.column;The documentation is great for seeing how things should work, syntax etc.... you should try it.

  • How to get value in function insert table test ?

    Hi
    I use function insert table test in order to get value in table for use in code page but i don't know how to get value in table.If somebody have any idea.Please give me some advice.
    Thank you,
    Waruja

    You will need to grab the contents with VBA
    Table test is user interface only.
    This thread may help
    http://qazone.empirix.com/thread.jspa?threadID=748&tstart=0

  • How to get row index of data table in the while ValueChangeListener fired?

    Hi,
    i have a data table in my page, which contains various components like inputText, selectOneChoice in each row.
    i am invoking a method ValueChangeListener attribute of the selectOneChoice component. I have given the autoSubmit=true for this component.
    <tr:selectOneChoice id="ratingModelType"
    value="#{childRatio.ratingModelType}" binding="#{pageManager.form.bindRatioType}"
    valueChangeListener="#{pageManager.form.onRatingModelTypeChange}" autoSubmit="true"
    contentStyle="width:150px" required="#{!childRatio.disableChildRatioRatingModelType}"
    requiredMessageDetail="#{appBundle['error.ratingModelTypeShouldNotBeEmpty']}">
    <f:selectItems value="#{pageManager.catalog['Rating Model Type']}" />
    <tr:selectOneChoice>In that method i want to fetch the map(with all updated values) relevant to the currently modified row of the table.
    Since i am not using the selectionListener or any radio buttons in the page i am not able to get the row index of the table.
    somebody please tell me how to get the row index of the table, while ValueChangeListener fired?
    Thanks in advance.
    Subbu

    Hi niki,
    Thank you so much. With your suggestion i got the result exactly what i want.
    thanks again.
    --subbu                                                                                                                                                                                                                               

  • WD ABAP: How to get the contents of selected table lines?

    Hi,
    I'm trying to figure out how to get the contents of table lines back from the UI. I display a table with several lines of data. The user selects some rows. I want to move the contents of the selected rows to another table. I have a context attribute, say DATA, with attributes FIELD1... FIELDn, using a DDIC structure. These are bound to the table UI element and the corresponding table columns. To get the selected rows, I use wd_context->get_selected_elements(). This works, but what I get from this method is references to if_wd_context_element. How do I know which row (row number = ?) this corresponds to? And how do I get the actual data? I want a structure with FIELD1 = value1 FIELD2 = value2 etc. My context attributes FIELD refer to table columns, but I'm looking for the table line...
    Can somebody help me?
    Thanks,
    Ira

    Hi Ira,
    wd_context->get_selected_elements() returns WDR_CONTEXT_ELEMENT_SET which is a table type of IF_WD_CONTEXT_ELEMENT. You can loop through the WDR_CONTEXT_ELEMENT_SET, get into variable say node_elelement which is of type ref to If_Wd_Context_Element. Then you could use the method GET_STATIC_ATTRIBUTES of If_Wd_Context_Element which returns a structure with values of all the attributes in the selected row.
    If you need the row number, while populating the node you could have an additional attribute called rowno and populate it correctly. When you select the data using method GET_STATIC_ATTRIBUTES, you would get the appropriate row number.
    Regards,
    Srini.

  • How to get source from ListSelectionListener on Table?????????

    hi there
    i have about three JTables in my application, i have added ListSelectionListener to these tables to see if any selection was made on them.
    Table1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    ListSelectionModel rowSM = Table1.getSelectionModel();
    //add listener to the table selection
    rowSM.addListSelectionListener(this);
    in the ValueChanged() method, i need to get the selection made on these tables.
    public void valueChanged(ListSelectionEvent e)
    how do i find out on which table the selection was made?
    thank you.

    ListSelectionEvent.getSource(): returns an object. Check its type with instanceof :
    if(e.getSource() instanceof JTable)
    JTable sourceTable=(JTable)e.getSource();
    ... off you go...
    }

  • How to get information of 'include file', 'table', 'function' from the prog

    Hi all.
    I wanna know which 'include file', 'table', 'function' is used in the program.
    Firstly, I prepared user interface for entering the name of program.
    Secondarly,
    I made the way to confirm whether the program is exising or not by using TADIR.
    And I must use CROSS for getting information of function.
    But at the same time, I will use 'RS_GET_ALL_INCLUDES', 'RS_GET_TABLE_REFERENCES' for getting information of include file or table.
    After that, I have to report by using ALV.
    Then, I will use both of string getting from function by using above function and internal table getting from CROSS.
    How do I put together in  INTERNAL TABLE.

    hi,
    look F1 to abap command <b>scan</b> and <b>read report</b>
    A.

  • How to get sliced image into my table ?

    hi all :)
    i have created a sliced image of my country and added
    rollover with disjointed fx.
    i have also exported the code which works fine by it self.
    however when i try to get the code into a table cell on my
    website it breaks the table.
    so please can you tell me what i have to do inorder to make
    it fit in please.
    the site is www.365cityads
    dot com.
    here you can see a placeholder map of sweden thats were
    i want the sliced map to be
    you can view the working map here on
    www.365cityads
    dot com/xmap/swemap.html
    here you can see that everything is working but breaks when
    i try to get it to the index.php page.
    please can anyone help me with this multiple nested table
    situation
    thanks
    K

    krughan wrote:
    > Hi pixlor :)
    > pixlor maybe im missing the bigger picture and there is
    something i can learn
    > or maybe its due to my understanding of english.
    >
    > after slicing up up sweden into 21 counties then
    exporting it to html
    > it worked fine no problems at all. (are you saying i
    need not slicing ?)
    >
    > my problems became about when i tried to fit the map
    into a table cell on my
    > site (365cityadds.com where you can see the map working
    now) that was the
    > problem before as it was breaking up
    > on every attempt.
    >
    > so i looked back on the orginal could working map code
    and notice
    > there were 3 parts to it 1st to go in the header 2nd to
    go in the desired cell
    > destination then the 3rd part was attached below
    > (is it here that im doing worng ?)
    >
    > as i said the map is in the right place on the site and
    seems to be doing what
    > i wanted. however what i cant get over is the amount of
    code generated by
    > firefox which makes the map slow to load on initial
    entry to the site (im
    > using preload images too)
    > (maybe im doing something wrong here. am i ?)
    >
    > pixlor, by no way am i being confrontational with you in
    any sort
    > of way. i assumed that you thought i was slicing the map
    sections into 21
    > matching table cells, how ever my assumption may and can
    be totaly wrong.
    >
    > if you have time to look at the front page of the site
    and see the
    > usage of the map and its code via right click . just to
    see if i used
    > the software as intended. :) thanks.
    >
    > i have use FW a few time (im not an expert) to do
    smaller stuff and
    > i really thought that i was using it correctly but if
    there are other
    > way that can make the map speed, cut code and/or an
    effecient
    > way of doing the same thenig then i ask you please let
    me know
    > or provide me with a link to reference(s)
    >
    > thank you again for responding. your input means alot to
    me
    >
    > Thanks
    > k
    >
    >
    >
    >
    This kind of complexity would be much better handled via
    Flash, but that
    may be outside your experience at this point.
    The code you saw was NOT generated by Firefox; it was the
    code generated
    by Fireworks to pull off the effect you wanted. The lag you
    experienced
    was Firefox having to download the code to the user's browser
    and then
    Firefox having to parse and display all the elements
    Generally, overlapping slices is not a good idea for many
    reasons -
    bloated code being one of them. Other issues that can occur
    are
    unreliable image display, multiple - unnecessary - sliced
    images and
    migraines from having to edit the code at the source level
    <grin>.
    Jim Babbage - .:Community MX:. & .:Adobe Community
    Expert:.
    http://www.communityMX.com/
    CommunityMX - Free Resources:
    http://www.communitymx.com/free.cfm
    .:Adobe Community Expert for Fireworks:.
    Adobe Community Expert
    http://tinyurl.com/2a7dyp
    See my work on Flickr
    http://www.flickr.com/photos/jim_babbage/

Maybe you are looking for