How to insert 1000 rows into an oracle database?

Member

by orpha , in category: MySQL , a month ago

How to insert 1000 rows into an oracle database?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by addison , a month ago

@orpha 

You can insert 1000 rows into an Oracle database using a SQL script or a programming language like PL/SQL.


Here is an example of how you can insert 1000 rows using a SQL script:

  1. Create a table with the necessary columns in your Oracle database:
1
2
3
4
5
6
CREATE TABLE your_table (
    id NUMBER,
    column1 VARCHAR2(50),
    column2 VARCHAR2(50),
    ...
);


  1. Write a SQL script to generate and insert 1000 rows into the table:
1
2
3
4
5
6
7
8
INSERT INTO your_table (id, column1, column2, ...)
SELECT 
    rownum as id,
    'value1' as column1,
    'value2' as column2,
    ...
FROM dual
CONNECT BY LEVEL <= 1000;


Replace 'value1', 'value2', etc. with the actual values you want to insert into each column.

  1. Run the SQL script in your Oracle database to insert the 1000 rows into the table.


Alternatively, you can achieve the same by writing a PL/SQL script that contains a loop to insert 1000 rows one by one into the table.


Please note that this is just a basic example, and you may need to modify the script based on your specific requirements and table structure.