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)"
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.
Member
183 Points
401 Posts
Auto increment in vb.net and oracle table
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
but error
Appreciate the Help
All-Star
53021 Points
23607 Posts
Re: Auto increment in vb.net and oracle table
Nov 08, 2018 11:47 AM|mgebhard|LINK
Try reading the Oracle reference documentation; AUTO_INCREMENT.
https://docs.oracle.com/cd/E17952_01/mysql-5.7-en/example-auto-increment.html
Or Google.
https://www.google.com/search?q=oracle+auto+incremeant&rlz=1C1GGRV_enUS812US812&oq=oracle+auto+incremeant&aqs=chrome..69i57j0l5.6768j0j7&sourceid=chrome&ie=UTF-8
Contributor
3462 Points
1341 Posts
Re: Auto increment in vb.net and oracle table
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.