| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Increament
This is such an Oracle syntax to use values as results of query (In SQL all
the data must be in some table, this is pseudo table). As NEXTVAL, it's
pseudo column, you see.
"Oliver Wong" <oliverwong_at_aforce.com> a écrit dans le message news:
3BDD10C5.660A8F8D_at_aforce.com...
> What is mean by "Dual"?
>
>
> Brian Tkatch wrote:
>
> > On Mon, 29 Oct 2001 12:02:22 +0800, Oliver Wong
> > <oliverwong_at_aforce.com> wrote:
> >
> > >How can I create a field that will increament by n?
> > >Thank you!
> > >
> > >
> > >
> >
> > Most probably you want to use a SEQUENCE and a TRIGGER.
> >
> > Check out the CREATE SEQUENCE command. By default it starts at one and
> > increments by one, but you can change both of these.
> >
> > The CREATE TRIGGER command can create a trigger that will
> > automatically put the number in the column.
> >
> > An example:
> >
> > CREATE TABLE MyTable (Id NUMBER PRIMARY KEY);
> >
> > CREATE SEQUENCE MyTableSEQ NOCACHE ORDER;
> >
> > CREATE OR REPLACE TRIGGER MyTableANR
> > BEFORE INSERT ON MyTable
> > FOR EACH ROW
> > BEGIN
> > SELECT MyTableSEQ.NEXTVAL INTO :NEW.Id FROM Dual;
> > END MyTableANR;
> > /
> >
> > Brian
>
Received on Mon Oct 29 2001 - 05:17:40 CST
![]() |
![]() |