When testing or developing with databases, random data is often required. Beyond generating SQL scripts, we can use AI models like ChatGPT/Claude/CoPilot to produce actual random data. Then we can then load into your database. This approach combines AI’s flexibility with traditional database tools for a powerful data generation workflow.
LLMs excels at:
Clearly define the structure and type of data you need. For example:
> Hi, I have an Oracle table:
> - Table Name: `employees`
> - Columns: `id (number)`, `name (varchar2)`, `email (varchar2)`, `hire_date (date)`, `salary (number)`
Request ChatGPT to generate rows of data. For example:
Generate 200 rows of random data for an
employees
table with the following columns:id
,name
,hire_date
,salary
. make Sure that names are in Hebrew, Hire date is at least year ago and salary is in the range 10000 to 60000 Please provide data in a CSV format as file like this:id,name,email,hire_date,salary 1,יוסי כהן,yossi@example.com,2022-01-15,5000 2,משה אבוטבול,moshea@example.com,2023-03-20,4500 ...
Save the generated data into a CSV file (employees_data.csv
).
Use Oracle tools like SQL*Loader or an external table to load the data.
employees.ctl
):
LOAD DATA
INFILE 'employees_data.csv'
INTO TABLE employees
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
(id, name, email, hire_date DATE "YYYY-MM-DD", salary)
sqlldr userid=username/password control=employees.ctl