Questions tagged [nextval]
53 questions
1
vote
0 answers
How to insert rows with the serial column catching up from the largest value in the table in Postgres
I have a table like the following:
create table my_table
(
"ID" serial not null,
"Name" varchar(500)
);
Without changing the property of the table, is there any clean way to insert a new row to this table (already has…

cxc
- 201
- 2
- 10
1
vote
1 answer
Insert multiple rows with multiple values nextval Oracle SQL
I'm trying to insert 2 rows with several values and test_id.nextval into an existing dataframe without including the column headings in the code:
insert into x
select * from
(select 12345, 'text', test_id_seq.nextval from dual
union…

yPennylane
- 760
- 1
- 9
- 27
1
vote
2 answers
nextval(seq_name) not fetching correct value from DB
I have a flask with sqlalchemy tied to a postgres db. All components are working with reads fully functional. I have a simple model:
class School(db.Model):
__tablename__ = 'schools'
id = db.Column(db.Integer, db.Sequence('schools_id_seq'),…

Shawn Mehan
- 4,513
- 9
- 31
- 51
1
vote
2 answers
Get default serial value after INSERT inside PL/pgSQL
I have a table. I wrote a function in plpgsql that inserts a row into this table:
INSERT INTO simpleTalbe (name,money) values('momo',1000) ;
This table has serial field called id. I want in the function after I insert the row to know the id that…
user5303752
1
vote
1 answer
Oracle. Using NEXTVAL in an INSERT with GROUP BY
I have the following insert
INSERT INTO DFR_DIARY
(
SELECT ID_GEN_SEQUENCE.NEXTVAL,
A.TRANSACTION_REPORTING_UNIT_CD TRECON_RUC,
A.CYCLE_NUMBER_ID,
A.CYCLE_DATE CYCLE_STARTED_DT,
A.UNIT_DIARY_NUMBER_ID…

Ahmad Ghosheh
- 19
- 2
1
vote
0 answers
(iBatis) I want to insert multiple data list in a table
I develop web application using Spring and iBatis. I want to insert multiple data in a table. I throw DataMap including ArrayList in controller as follow.
param.put("aList", aList);
param.put("aaaSeq", aaaSeq);
commonDAO.insert(namespace,…

DaengGu
- 11
- 2
1
vote
3 answers
postgresql nextval question on sequences
I am trying to work with postgresql 'nextval' in PHP. How can I fill in the parenthesis in the third line in order to replace TXN_ID with the value of nextval('schemadb.audit_txn_seq')?
$DB->query("SELECT…

littleK
- 19,521
- 30
- 128
- 188
1
vote
5 answers
Get oracle sequenve next value without change it
I have a big problem. I need to know the next value of an oracle sequence without changing it.
If I use sequence.NEXTVAL , I get what I need. The problem is that the value changed, so the next record will get this value + 1 and it's not good for…

S.K
- 185
- 2
- 2
- 6
1
vote
1 answer
Cannot use sequence in a spooled UNION Query
I need to spool a query with column headers. The query itself runs correctly on its own, and the dummy header query runs correctly alone. The query uses a sequence to sequentially number the rows (they represent the equivalent of order line items),…

Kirk Fleming
- 497
- 5
- 15
1
vote
1 answer
PlSQL trigger error ORA-0000 ORA-06512:
create or replace
TRIGGER "SUP" AFTER INSERT ON "EMP_REPORT" REFERENCING OLD AS "OLD" NEW AS "NEW" FOR EACH ROW
DECLARE
miclaim_supervisor_count number;
employee_company_code VARCHAR2(10);
employee_businessunit number;
projMgrs NUMBER;
…

cHaNkX
- 35
- 1
- 3
- 12
1
vote
1 answer
oracle issue with trigger and nextval
I have a table called employees with the following data:
Employee_ID Employee_Salary Employee_HireDate
100 ---- -----
101 ---- -----
Now I want to create a trigger that…

Layla
- 5,234
- 15
- 51
- 66
1
vote
2 answers
serial type produce only even or odd numbers in postgresql
I want set some constraint to the serial type,it only produce even or odd numbers.

yjfuk
- 1,415
- 4
- 13
- 12
1
vote
1 answer
Zend DB with Postgres problems with nextval()
Ok this is a 2 part question, first primary concern is the nextval() bit. I have a table where one of the columns is an auto incrementing column. Being fairly new to postgres and Zend DB I am running into trouble. Inserting a new row on to a…

chris
- 36,115
- 52
- 143
- 252
0
votes
0 answers
Postgres nextval thread safety
We are experiencing a strange problem with triggers and a sequence generator in Postgres.
We have a trigger on table that inserts audit log informations (some business Data before update, some business Data after update, ...).
The problem we have is…

youness.bout
- 343
- 3
- 9
0
votes
1 answer
nextval on sequence returns all nextval values for all table rows in typeORM on postgresql table
I have a sequence in postgreSQL database, and when I run NEXTVAL(sequence_name) query inside pgAdmin 4 it returns only one value that is correct.
However inside NestJS project that's bootstrapped with TypeORM when I run…

milut.in
- 300
- 1
- 3
- 9