Re: Using sequences with WebDB

From: Klaus Zeuch <Klaus.Zeuch_at_erls04.siemens.de>
Date: Fri, 3 Dec 1999 15:10:07 +0100
Message-ID: <828iq9$2do$1_at_papyrus.erlm.siemens.de>


solution outside webdb: create a before insert trigger for that table - you don't have to deliver id's via webdb-form (replace my_... with your schema object's names)

create or replace trigger my_trigger

before insert on                   my_table
referencing new as new old as old
for each row
declare
  v_nextid number;
begin
  if ( :new.my_id_column is null ) then
    select
           my_Sequence.nextval
      into
           v_nextid
      from
        dual;

    :new.my_id_column := v_nextid;
  end if;
exception
  when others then
    raise;
end;

<kbrown_nd97_at_my-deja.com> schrieb in im Newsbeitrag: 82415n$tul$1_at_nnrp1.deja.com...
> *******************************************
> I've built a table, an update form for that
> table, and a sequence.
>
> I need the <sequencename>.nextval to populate an
> id field in my table on insert, but I don't
> understand how or where in WebDB to make that
> assignment.
>
> Any thoughts on how to accomplish this?
> *******************************************
>
> yes put schemaname.#sequencename.nextval in the
> default value field.
>
> *******************************************
>
> -- Hello, I am having trouble getting the
> solution listed above to work. I consistently
> get the "sequencename.nextval" printing in the
> form field, instead of the number I am trying to
> get it to print. Is this something to do with
> the version of WebDB that I am using?
>
> The version is WebDB 2.1.0.9.3
>
> Perhaps this only works in later versions?
>
> Can someone help me?
>
> Thanks.
>
> - Kevin Brown
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Fri Dec 03 1999 - 15:10:07 CET

Original text of this message