Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Visual Basic, Remote data control and Sequence of Oracle
On 25 Mar 1998 19:46:17 GMT, "Mikel Bengoa" <miksil_at_jet.es> wrote: Hi,
you can get the new value from a sequence by creating a dynaset:
szSQL="Select <mysequence>.nextval my_new_pk from dual"
Use this SQL-Statemen only in a PASSTHROUGH-query, the result will be accessed by myDynaset("my_new_pk").
If further application progress isn't in need of the pk-value then hide the pk setting by using triggers:
drop trigger tIB_myTable;
create trigger tIB_myTable before INSERT on myTable for each row
begin
Select mysequence.NEXTVAL into :new.pk from dual;
end;
/
:new is the refernce to the newly inserted record, pk your primary key-field.
Another tip:
Never use bound controls in transaction oriented applications. Take a look at Jenning's 'Database Developpe's Guide' (SAMS) that explains a good work-around.
>Hi,
>
>I have a form in Visual Basic 5.0 with a Remote data control linked to
>Oracle and some text box linked to this remote data control. As Primary Key
>field I would like to use a Sequence of Oracle. When the user add a new
>register I would like to use the sequence. How can I get it?
>
>Thanks in advanced
>
>
-- Regards Matthias Gresz :-) GreMa_at_T-online.deReceived on Thu Mar 26 1998 - 00:00:00 CST
![]() |
![]() |