Generate_Sequence_number

How can I control the incrementing during execute_query/panning to a blank record?
I've created a sequence room_sequence that increments by one.
I used this in my block item default property. The problem with this was the sequence automatically incremented by one every time an execute_query was done.
So when I saved a third record the sequence jumped to a higher number which wasn't the next number expected. This also happened whenever I panned to the last empty record.
Obtained result was 1,2 & 16
Expected result should be 1,2 & 3
I removed the default value property and moved it to the item's when-new-record trigger but the sequencing didn't work from this trigger.
Any tips?

I tried your suggestion, I even tried it on pre-update but I got the same message for pre-insert and pre-update. "TOO MANY ROWS"
this is part of my code
SELECT my_seq.nextval into variable from tablename
:item_name := variable;
Do you have other ideas?
Thank you for your response. In your example above, which table are you doing the select from?
Sounds to me like you4re getting multiple records in return where
you only want a singular record.
I4d suggest you do it like this instead:
select my_seq.nextval into :item_name from dual;
Should work nicely in a PRE-INSERT trigger.
//Dick

Similar Messages

  • How I must use GENERATE_SEQUENCE_NUMBER?

    I have a form that has a detail and I want generate a unique
    sequence number when a record is created. But I don't know how
    use the GENERATE_SEQUENCE_NUMBER built-in. Somebody could help
    me?
    Thanks
    null

    I see... In this case you can redefine the triggers
    "KEY-DELREC" and "KEY-CREREC" for this block and before
    calling the corresponding procedures "DELETE_RECORD" and
    "CREATE_RECORD", you call a local procedure to resequence
    these numbers. This procedure also sets a global variable
    to be used as "Inital Value" if you are inserting a record.
    item : detail.item
    Initial Value = :global.next_item
    trigger : when-new-record (master block)
    :global.next_item := '1';
    trigger : key-delrec (detail block)
    delete_record;
    resequence_items('DELETE');
    trigger : key-crerec (detail block)
    resequence_items('INSERT');
    create_record;
    procedure : resequence_items
    procedure resequence_items (
    p_operation in varchar2
    ) is
    v_cursor_record pls_integer;
    v_top_record pls_integer;
    v_position pls_integer;
    begin
    if :system.record_status = 'NEW' then
    return;
    end if;
    v_top_record :=
    get_block_property(:system.cursor_block,top_record);
    v_cursor_record := to_number(:system.cursor_record);
    if p_operation = 'INSERT' then
    v_position := v_cursor_record + 1;
    :global.next_item := to_char(v_position);
    down;
    loop
    exit when :system.record_status = 'NEW';
    v_position := v_position + 1;
    :detail.item := v_position;
    down;
    end loop;
    end if;
    if p_operation = 'DELETE' then
    v_position := v_cursor_record;
    loop
    exit when :system.record_status = 'NEW';
    :detail.item := v_position;
    v_position := v_position + 1;
    down;
    end loop;
    end if;
    go_record(v_top_record);
    go_record(v_cursor_record);
    end;
    null

Maybe you are looking for

  • Urxvt and äöå

    Hey! I have this really hard-to-solve problem, so I decided to ask for help.. My keymap works just fine in other programs except for urxvt. Even in urxvt, all the other buttons except for ä å and ö work fine. Copy-pasting them doesn't work either, al

  • Upgrading iMovie from v9.0.9 to v10 with projects and events on external HD

    Seem to be running into an issue using iMovie v10 post-upgrade... I run iMovie v9.0.9 with many projects and events on several external (multi-TB) hard drives. They would not fit on my primary HD due to sheer file size. I was able to upgrade to v10,

  • One server & group having login + mail problems

    But other servers & groups are not. Here is my setup at a K-12 school: -Three XServe Intel Xeons (one per division of the school) for three groups of users, network home directories live on these intel machines, running 10.4.10 -One G5 server handles

  • HP Deskjet 990cxi crippled with Intel iMac

    Has any one been able to get the above printer to be fully operational with an Intel iMac? I have lost the ability to print in draft and have not been able to get two sided printing to work although it should(under Layout) using the Gimp Driver. I ha

  • PC Suite installs fonts to temp directory!

    I have been trying to clear out my temp folders and noticed some files that wouldn't delete. It seems that PC Suite is permanently installing some of it's fonts into the temp directory, in a folder called NGLATempNokia. I was able to delete it by shu