Skip to Main Content

Portuguese

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Sequence without using sequence number

Kishor kaladharaSep 28 2018

There is a table called table_1 as below

Table_1

ID, seq_no, name, address

1   1            'A'             'B'

1   2            'A'             'B'

2   1            'B'             'B'

3   1            'C'             'B'

3   2            'D'             'B'

4   5            'D'             'B'

I'm trying to insert as below but giving unique constraint error as i've unique index on ID,SEQ_NO,NAME

select max(seq_no)+1 from table_1 where id =3) is taking same value if there are more than one row in select statement and i cannot use sequence also, can anybody help

?

insert into table_1(ID, seq_no, name, address)

select 6, (select max(seq_no)+1 from table_1 where id =3), name, address from table_1 where id =3;

Comments

3720642
Answer

The documentation wasn't helpful. After some messing around I found out that the problem was because I forgot to delete the line from my user's known_hosts file regarding the old fingerprint. (/home/username/.ssh/known_hosts)

Marked as Answer by 3720642 · Sep 27 2020
1 - 2

Post Details

Added on Sep 28 2018
0 comments
361 views