here is my problemI have this code to make an autoincrement variable in oracle database:
CREATE TABLE Korisnici
(
id_korisnika number PRIMARY KEY,
ime_korisnika varchar2(200),
prezime_korisnika varchar2(200),
broj_telefona varchar2(30),
adresa_korisnika varchar2(400)
)
/
create sequence test_seq
start with 1
increment by 1;
CREATE OR REPLACE TRIGGER test_trigger
BEFORE INSERT ON Korisnici FOR EACH ROW
BEGIN
SELECT test_seq.NEXTVAL
INTO :NEW.id_korisnika
FROM DUAL;
END;
/
If I start from begining everything works great, I have numbers as 1,2,3,4....
I close the program, open it again, so oracle database connection is once again started. I add one more input and I have numbers like 20,21,22,23...
I put program on my android and connect from different device, when I input one user I have 30,31,33,34...
Why is this happening? And how to fix it?
Thank you
EDIT:
Here is my proc for reading data from database
CREATE OR REPLACE PROCEDURE Citanje_korisnika( p_rc OUT SYS_REFCURSOR )
AS
BEGIN
OPEN p_rc
FOR SELECT *
FROM Korisnici;
END;
I am a bit of newbie in oracle database.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…