Home » SQL & PL/SQL » SQL & PL/SQL » insert rows (12c)
insert rows [message #681346] Thu, 09 July 2020 17:47 Go to next message
DRDBA
Messages: 22
Registered: March 2007
Junior Member
I have following rows in a table:

DB_NAME T DESCR MOD_DATE MOD_BY
---------------- - ------ ---------------------------
DEVDW D CFSDW 27-APR-20 LOCAL
DEV C DEVDB 26-APR-20 LOCAL

I would like to add additional rows like below, there are similar tables with thousands or rows, can you please advise.

DB_NAME T DESCR MOD_DATE MOD_BY
---------------- - ------ ---------------------------
DEVDW D CFSDW 27-APR-20 LOCAL
DEVDW2 D CFSDW 27-APR-20 LOCAL
DEV C DEVDB 26-APR-20 LOCAL
DEV2 C DEVDB 26-APR-20 LOCAL
Re: insert rows [message #681347 is a reply to message #681346] Thu, 09 July 2020 19:36 Go to previous messageGo to next message
Solomon Yakobson
Messages: 3269
Registered: January 2010
Location: Connecticut, USA
Senior Member
It looks like you are looking for:

INSERT /*+ APPEND */ -- you can also add PARALLEL and see if it improves performance
  INTO YOUR_TABLE
  SELECT  DB_NAME || '2',
          T,
          DESCR,
          MOD_DATE,
          MOD_BY
    FROM  YOUR_TABLE
/
SY.

[Updated on: Thu, 09 July 2020 19:39]

Report message to a moderator

Re: insert rows [message #681351 is a reply to message #681347] Fri, 10 July 2020 11:53 Go to previous messageGo to next message
DRDBA
Messages: 22
Registered: March 2007
Junior Member
Thanks for the response, my actual requirement is to add a complete different value in column-1.

like this..

DB_NAME T DESCR MOD_DATE MOD_BY
---------------- - ------ ---------------------------
DEVDW D CFSDW 27-APR-20 LOCAL
QADW D CFSDW 27-APR-20 LOCAL-----> new row
DEV C DEVDB 26-APR-20 LOCAL
PROD C DEVDB 26-APR-20 LOCAL-----> new row
Re: insert rows [message #681352 is a reply to message #681351] Fri, 10 July 2020 12:10 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Please read the OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Indent the code, use code tags and align the columns in result.

Also always post your Oracle version, with 4 decimals (query v$version), as often solution depends on it.

With any SQL or PL/SQL question, please, Post a working Test case: create table (including all constraints) and insert statements along with the result you want with these data then we will be able work with your table and data. Explain with words and sentences the rules that lead to this result.

Re: insert rows [message #681355 is a reply to message #681346] Fri, 10 July 2020 15:33 Go to previous message
EdStevens
Messages: 1376
Registered: September 2013
Senior Member
DRDBA wrote on Thu, 09 July 2020 17:47
I have following rows in a table:

DB_NAME T DESCR MOD_DATE MOD_BY
---------------- - ------ ---------------------------
DEVDW D CFSDW 27-APR-20 LOCAL
DEV C DEVDB 26-APR-20 LOCAL

I would like to add additional rows like below, there are similar tables with thousands or rows, can you please advise.

DB_NAME T DESCR MOD_DATE MOD_BY
---------------- - ------ ---------------------------
DEVDW D CFSDW 27-APR-20 LOCAL
DEVDW2 D CFSDW 27-APR-20 LOCAL
DEV C DEVDB 26-APR-20 LOCAL
DEV2 C DEVDB 26-APR-20 LOCAL
Aside from any other comments about any other aspect of your problem - DO NOT USE 2-DIGIT YEARS WHEN SPECIFYING DATES!!!!!!!!! Does the the term 'Y2K bug' sound the least bit familiar?
Previous Topic: Run Time Errors 933 and 512 executing Proc
Next Topic: issue in inserting pdf file in a table
Goto Forum:
  


Current Time: Thu Mar 28 09:53:35 CDT 2024