Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Help ORACLE.
Oscar wrote:
>
> Hi, I have a big problem with Oracle. Can anyone help me, make the test.
> The problem is that the sequence is not correlative.
>
> CreateTable:
>
> drop table LGC02
> ;
> drop sequence ID_LGC02
> ;
> create table LGC02 (
> ID_LGC02 DEC (9,0) NULL,
> TIARLG CHAR (1) NULL,
> TITRLG CHAR (1) NULL,
> FECHLG DEC (6, 0) NULL,
> HORALG DEC (6, 0) NULL,
> WSIDLG CHAR (10) NULL,
> USERLG CHAR (8) NULL,
> DATA_A CHAR (200) NULL
> )
> ;
> create unique index IID_LGC02 on LGC02 (ID_LGC02)
> ;
> create sequence ID_LGC02 start with 1
> ;
>
> Now Introduce values:
>
> insert into LGC02 ( ID_LGC02,TIARLG, TITRLG, FECHLG, HORALG, WSIDLG, USERLG,
> DATA_A)
> VALUES (ID_TIGSA_LGC02.nextval, 'O',
> 'A', 260602, 165225, 'SERVIDOR ',
> 'CGIFS ',
> 'VC11020601000011020601
> 0000000000000000000000000000000000000000000000000000000000000000000000000000
> ')
>
> make this sentence 4 times. ( then ID_LGC02 will be 1,2,3,4 )
>
> NOW the sentence:
>
> select ID_LGC02.nextval from LGC02
>
> OK if you did insert 4 times it will show 5,6,7,8 !!!! OK but then
>
> THIS IS THE MISTAKE !! OR NOT
>
> NOW:
>
> insert into LGC02 ( ID_LGC02,TIARLG, TITRLG, FECHLG, HORALG, WSIDLG, USERLG,
> DATA_A)
> VALUES (ID_TIGSA_LGC02.nextval, 'O',
> 'A', 260602, 165225, 'SERVIDOR ',
> 'CGIFS ',
> 'VC11020601000011020601
> 0000000000000000000000000000000000000000000000000000000000000000000000000000
> ')
>
> is supose to introduce like a next val 5 but NOT it puts 9 !!!!
>
> My problem is that I need to have 5 insteas of 9. Can Anyone help
> me ? Thank's. Oscar
You can't rely on sequences if you need an incremental value with following numbers.
Regards,
Knut Received on Wed Jun 26 2002 - 11:02:29 CDT