Last post Nov 09, 2018 11:35 PM by Lannie
Nov 08, 2018 10:03 AM|shsu|LINK
How can I insert a new number inside table of the oracleDB. For next insertion increment by 1 like that it goes on [Just like Auto increment of column by placing it as bigint and increment by 1]
when I tried as below
cmd.CommandText = "Insert into inciden(number) values(id.nextval)"
Sequence not exist message is showing.
Tried as below also:
SELECT TOP(1) NUMBER FROM incident BY 1 DESC
Appreciate the Help
Nov 08, 2018 11:47 AM|mgebhard|LINK
Try reading the Oracle reference documentation; AUTO_INCREMENT.
Nov 09, 2018 11:35 PM|Lannie|LINK
In oracle you have to create the SEQUENCE object first. The user account accessing the sequence needs to be granted SELECT privileges on the SEQUENCE object. Then the .NEXTVAL function will work. The Sequence object returns a number with you defining
the INCREMENT BY value when the sequence object was created.