Skip to main content
Filter by
Sorted by
Tagged with
1 vote
2 answers
749 views

I have 2 applications (one is SpringBoot app and another is a C++ app) calling the same Oracle sequence SEQUENCE_A responsible for generating PK on the same table TABLE-A. The sequence DDL is as: ...
pixel's user avatar
  • 10.8k
1 vote
0 answers
796 views

I am using hibernate envers 5.6.9.final with spring boot 2.7.2. my problem is that hibernate_sequence sometimes generates duplicates value when it needs to insert a new record in revisionInfo tabel. ...
Hesam Karimian's user avatar
1 vote
0 answers
29 views

I see inconsistent hibernate behavior when using sequence to generate id, I have simple project with one entity Fruit and I'm using spring.jpa.hibernate.ddl-auto=create-drop so hibernate is launching ...
Raven Danish's user avatar
1 vote
2 answers
1k views

I am making a simple note app, and I want to create a table to track a note's edit history and save them with an incrementing version as a composite key with the note's id. So for example: note_id | ...
Brenden's user avatar
  • 124
0 votes
3 answers
313 views

I want to get the next 10 values of the SEQUENCE at once. I can get those individually by calling SELECT setval('myseq', ...); -- Next nextval will return 43 10 times back to back. On ...
HappyTown's user avatar
  • 6,634
3 votes
1 answer
633 views

I'm currently trying the inheritance system with PostgreSQL but I have a problem with the auto-increment index in my child tables. I have three tables: "Currency", "Crypto" and &...
Naografix's user avatar
  • 989
0 votes
0 answers
129 views

I have a Java system that uses Sequence in PK in database (postgreSQL and PGadmin) This sequence should take the current month (with two digits) followed by the current year. It turns out that a ...
Raquelhe's user avatar
0 votes
1 answer
114 views

I am having a constraint violation issue with Hibernate and the constraint is related primary key. I debugged a bit and see that the before insertion, sequence value selection as below select ...
Olgun Kaya's user avatar
  • 2,585
0 votes
1 answer
837 views

I am brushing up my knowledge about SQL and I am learning more and more. However, I am not understanding the purpose of the Sequence we use. I am using SQL Server.
cbirole's user avatar
  • 27
0 votes
1 answer
2k views

When I execute the following insert query: insert into FEED_STAGING_GOOD_TRADE (JOBEXECUTIONID, STAGINGID, ROWNUMBER, system, traderef, mtmvaluation, mtmvaluationccy, prcmtmquality, prcdate) values (...
Amine's user avatar
  • 989
0 votes
1 answer
1k views

I am trying to alter database sequence and restart it with value returned by complex SELECT statement. This is a simplified example that I prepared to replicate the issue: ALTER SEQUENCE abc....
Aleks Vujic's user avatar
  • 2,329
3 votes
3 answers
12k views

My table is defined as: CREATE TABLE accounts IF NOT EXISTS ( id SERIAL PRIMARY KEY, name VARCHAR(100) NOT NULL ); At some circumstances, I want to fetch next val of id before inserting data ...
kamaci's user avatar
  • 75.9k
0 votes
1 answer
429 views

I have the next issue -> I have a table on my db with a composite id... Supose (Id1,Id2,Id3,Id4), the Id4 is generated by a sequence on the db... My question is, in spring boot, I generate the ...
Emmanuel Acosta's user avatar
0 votes
1 answer
159 views

I have to make a new column inside of an already existing database that keeps track of the number of occurences of a certain kind. Here's an example to be more clear: id | eqid | etcd | this would be ...
matthew fabrie's user avatar
0 votes
1 answer
171 views

I am trying to make a Postgres sequence that will reset once the id of the item it is linked to changes, e.g: ID SEQUENCE_VALUE 1 1 2 1 1 2 1 3 ...
matthew fabrie's user avatar
1 vote
1 answer
1k views

I've started working on a legacy oracle database and using Spring boot Jpa trying to insert a new row in a table (CHANNELMGR_REQUEST) without Identity: This table has a Numeric column (CM_ISN) and ...
Dindar's user avatar
  • 3,313
0 votes
2 answers
1k views

I need a help on persisting an entity in a Oracle DB table that uses trigger and sequence for PK. By now, I tried these from other stackoverflow questions: @Id @GeneratedValue(generator="...
Mikaelangel's user avatar
7 votes
1 answer
3k views

I have created a sequence (let's call it my_seq) in a schema (let's call it my_schema) of my PostgreSQL (version 13) database. I am sure the sequence exists because I can find it in the result set of ...
jPenF5's user avatar
  • 81
0 votes
1 answer
523 views

I have created a sequence but its not inserting ids in sequence order. For Ex: First I have created one set of record seq number generated as 1, 2, 3, 4 Again I have created another set of records ...
Abinnaya's user avatar
  • 223
1 vote
2 answers
3k views

My class for the table topics is as below. The primary key is autogenerated serial key. While testing, I deleted rows from the table and was trying to re-insert them again. The UUID is not getting ...
Maitreyee Das's user avatar
0 votes
2 answers
661 views

There are 2 applications : one is using Spring boot - 1.5.18.Release version, which has hibernate version as 5.0.12.Final :https://search.maven.org/artifact/org.springframework.boot/spring-boot-...
CodeRunner's user avatar
0 votes
1 answer
338 views

I have table with SERIAL PRIMARY KEY and when importing csv file with some data and it fails for any reason, when importing successes the PRIMARY KEY instead of starting from zero (in case the table ...
Julio's user avatar
  • 305
0 votes
0 answers
27 views

I've a table with following structure: CREATE TABLE web.cabinet_account_section ( id serial NOT NULL, section_id text NULL, account_id int4 NULL, cabinet_param_id int4 NULL, ...
funnelCONN's user avatar
0 votes
0 answers
156 views

I have a Postgres database with many tables. I want to declare a function that reset all auto_increment values (next_value) of all the tables to max(id) of the table. For example, if max(id) of ...
محسن عباسی's user avatar
0 votes
1 answer
98 views

There is role sequence_owner. This is special tech role for working with sequence only. create role sequence_owner; GRANT sequence_owner TO administrator; GRANT USAGE, SELECT, UPDATE ON ALL SEQUENCES ...
yazabara's user avatar
  • 1,353
0 votes
1 answer
63 views

I'm creating an item record number generator. The goal is to have a table to house all record number/sequencers for a variety of different types. For example, for a "Part" you may want a ...
JaredSund's user avatar
1 vote
1 answer
164 views

I am trying to create a SQL table, but I keep getting this error. Error report - ORA-00902: invalid datatype 00902. 00000 - "invalid datatype" Here is my code. CREATE TABLE viewers ( ...
Alex McGraw's user avatar
4 votes
2 answers
2k views

I have the following SQL script which sets the sequence value corresponding to max value of the ID column: SELECT SETVAL('mytable_id_seq', COALESCE(MAX(id), 1)) FROM mytable; Should I lock 'mytable' ...
Artem Larin's user avatar
1 vote
3 answers
4k views

I have a table with id column as a number which have meanings. Different types of accounts start from different ranges. E.g Organisation 10000 <-> 100000, users 1000000 <-> 1kk. How can i ...
xxx_coder_noscope's user avatar
10 votes
4 answers
7k views

I imported the Postgres SQL file to my server using TablePlus(SQL client), but after I insert new row I got error like this: SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates ...
Muhammad Dyas Yaskur's user avatar
5 votes
3 answers
7k views

I'm having a table where I sometimes enter data in inline editors where I manually add the id value which is usually auto-incremented. In a case where id 4 was auto generated using scripts and then ...
Charith Jayasanka's user avatar
0 votes
1 answer
1k views

How to start my id column from 1 ? My tabel is : id | origin | destination | duration ----+-------------+-------------+---------- 6 | Paris | New York | 540 7 | Tokyo | ...
Kunal Prakash's user avatar
0 votes
1 answer
170 views

In database server Postgres 9.x or Postgres 10.x can I share the same sequence from 2 user? For example in the same database dbTest there are 2 schemas userA is schema owner schemaA with a sequenceA ...
sunrelax's user avatar
1 vote
1 answer
115 views

I have created a function to update a column in a postgresSQL table using Sequence nextval() function.Function body is as follows BEGIN EXECUTE 'CREATE SEQUENCE '|| sequence_name || ' START 1'; ...
Susampath's user avatar
  • 716
0 votes
0 answers
281 views

I am fairly new to hibernate and this is very strange - I am trying to run a Spring-Hibernate rest application on tomcat using eclipse. I have an entity defined as below - @Entity @Table(name = "...
Gunwant's user avatar
  • 1,009
0 votes
4 answers
129 views

I´ve a problem than i can´t resolve a select with a sequence, here´s my query SELECT SEQ_ARRIENDO.nextval, TO_CHAR(SYSDATE,'YYYY') ANNO_PROCESO, cam.nro_patente, ( SELECT ...
Héctor Mancilla's user avatar
1 vote
0 answers
34 views

I have a id field where id is serial and in the same table i have unique constraints. The problem here is when an unique constraint fails if the current ID value is 5 then after failing the next ID ...
Jithin Kumar S's user avatar
0 votes
1 answer
293 views

I was looking at the examples and types while seeing how to use the SEQUENCE command in T-SQL (Azure SQL Database, SQL Server, etc.), but when it lists the types SEQUENCE can be configured as (INT, ...
Netside's user avatar
  • 80
1 vote
1 answer
2k views

I have a query CREATE SEQUENCE "SEQ_ID" MINVALUE 1 MAXVALUE 99999 INCREMENT BY 1 START WITH 121 CACHE 20 NOORDER NOCYCLE; This one is of oracle commands. Now, I ...
Prajna's user avatar
  • 159
2 votes
2 answers
2k views

I need to create a custom sequence based on a specific column, added as a prefix. I know it is possible to customize the sequence as well as the nextval, but I'm not sure if it is possible to use the ...
Francesco Simeoli's user avatar
0 votes
2 answers
93 views

I am trying to insert an alphanumeric sequence in Oracle but it is not working. create sequence LIB start with 1 increment by 1; select 'LIBR'||to_char(seq_no.nextval,'FM0000099') from dual; ...
Amit prajapati's user avatar
1 vote
2 answers
342 views

Kind of a general question here but is there an easy way to determine, in Oracle database, if a field has a sequence number attached to it? This seems like it should be obvious, but I'm missing it. ...
alexherm's user avatar
  • 1,350
0 votes
3 answers
843 views

I have a script (that can fail) with multiple inserts that include nextval as insert into table a (id, value) (id_seq.nextval, 'value'); ... If script fails and I rollback the inserts, the sequence ...
Ori Marko's user avatar
  • 59.3k
1 vote
3 answers
2k views

I have got a composite primary key in a table in PostgreSQL (I am using pgAdmin4) Let's call the the two primary keys productno and version. version represents the version of productno. So if I ...
user avatar
0 votes
2 answers
452 views

I'm having troubles resetting the sequences as automatically as possible. I'm trying to use the next query from phpPgAdmin: SELECT SETVAL('course_subjects_seq', (SELECT MAX(subject_id) FROM ...
an4rei's user avatar
  • 57
0 votes
1 answer
1k views

I have a (Oracle) sequence that I use to assign an order number to new orders being inserted into a database table. It started at 1, and increments by 1 for each new order. I have a new requirement ...
osullic's user avatar
  • 612
0 votes
1 answer
111 views

I'm trying to insert a Number as an ID in a column in my database by a loop which sets the new ID by a Sequence. When I try to insert it, the row hasn't been created or the field where my number ...
Silky 's user avatar
  • 53
1 vote
2 answers
4k views

I made a primary key called t_id in the table of DB by using the query t_id SERIAL PRIMARY KEY. At the very first time, it started well on 1. Then I deleted all the data and from then, it starts on 2 ...
user avatar
0 votes
0 answers
72 views

I need to update product_details table with unique ID(CHARGE_NUMBER) againt each batch_ID and for the next batch ID unique ID again will start with 1 I have write a code using sequence. update ...
Deepak Patil's user avatar
0 votes
1 answer
622 views

I have a table where the ID sequence goes like 01,02 and so on (I have a few pre-inserted values). When I try to insert a new row there (not specifying the ID explicitly, but rather values for other ...
Nikrango's user avatar