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: Incredible ! Oracle HELP PLEASE !

Re: Incredible ! Oracle HELP PLEASE !

From: Daniel Morgan <dmorgan_at_exesolutions.com>
Date: Wed, 26 Jun 2002 16:56:46 GMT
Message-ID: <3D19F233.8282D5A7@exesolutions.com>


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

The following from http://tahiti.oracle.com

ORDER: Specify ORDER to guarantee that sequence numbers are generated in order of request. You may want to use this clause if you are using the sequence numbers as timestamps. Guaranteeing order is usually not important for sequences used to generate primary keys.

But if you are learning Oracle then I would also suggest the following: Drop all CHAR columns and replace with VARCHAR2 Drop all DEC columns and replace with NUMBER Specify a storage clause unless you are working againt LMT tablespaces with uniform extent
Create your indexes explicity with a name and specify the tablespace

There is little value in learning things in the form of the samples above.

Daniel Morgan Received on Wed Jun 26 2002 - 11:56:46 CDT

Original text of this message

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