Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Visual Basic, Remote data control and Sequence of Oracle

Re: Visual Basic, Remote data control and Sequence of Oracle

From: Matthias Gresz <GreMa_at_t-online.de>
Date: 1998/03/26
Message-ID: <6fdl07$bq2$3@news01.btx.dtag.de>#1/1

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.de
Received on Thu Mar 26 1998 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US