Skip to Main Content

SQL & PL/SQL

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!

How to update similar values to a set of rows within the same table?

msMay 3 2022

Hi Everyone,
I am using Oracle DB Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
I have the following create table script. I want to update multiple rows within the same table with same values
For e.g.

CREATE TABLE DUMMY_TEST_TABLE AS
select '0000000957' seq_no from dual union all
select '0000000957' from dual union all
select '0000000958' from dual union all
select '0000000958' from dual union all
select '0000000969' from dual union all
select '0000000969' from dual union all
select '0000000957' from dual union all
select '0000000958' from dual union all
select '0000000959' from dual;

SELECT * FROM DUMMY_TEST_TABLE;
I want to update the table and set the batch id with same seq no with similar batch_id either through sql or plsql and get the o/p as below. Could someone pls help arrive at the query.

Seq_no     Batch_Id
---------------------
0000000957 001
0000000957 001
0000000957 001
0000000958 002 
0000000958 002
0000000958 002
0000000969 003
0000000969 003
0000000970 004

Thanks

This post has been answered by Frank Kulash on May 3 2022
Jump to Answer
Comments
Post Details
Added on May 3 2022
6 comments
1,289 views