Create a CSV File
In this example, the PL/SQL examination results for an elite group of programmers, which
may include a few cats, are stored in a CSV file.
- The CSV file contains header records which identify each stats project, followed by data for that project.
- The header record must start with the word "PROJECT" and be followed by a description.
- The data records consist of a description for the data value, followed by its numeric value.
- You can have data for multiple projects in the CSV file.
PROJECT,PL/SQL Exam Results
Fred,90
Jim,93
Ann,97
Ian,98
Steve F,100
Bruce Scott,99
Tiger,95
Mary,91
Connor McD,100
Seyi,96
Harsh,98
Peter,89
Doris,85
Winston,92
Charlie,91
Morse,90
Import CSV Data into Oracle
Next we will import the data into Oracle tables STATS_PROJECT which identifies the project, and STATS_DATA which contains its data.
- Copy the CSV file to DATA_HOME/received
- Run script APP_HOME/com/import_stats
XEPDB1\APPSDEMO>import_stats
XEPDB1\APPSDEMO>ECHO OFF
Enter the password for DEMO_CONNECT: ******
CSV FILE FOUND: d:\user_data\XEPDB1\APPSDEMO\data\RECEIVED\stats_demo.csv
1 file(s) copied.
SQL*Plus: Release 21.0.0.0.0 - Production on Wed Mar 18 17:16:23 2026
Version 21.3.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Last Successful login time: Wed Mar 18 2026 16:43:22 +00:00
Connected to:
Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0
old 2: v_filename VARCHAR2(100) := '&1';
new 2: v_filename VARCHAR2(100) := 'stats_demo.csv';
Information [Log mode is S] [Program not named] at 18-MAR-26 17:03:23.568000000
[SQLERRM not passed] Message: Data Import from file: stats_demo.csv
Information [Log mode is S] [Program not named] at 18-MAR-26 17:03:23.691000000
[SQLERRM not passed] Message: Success!
PL/SQL procedure successfully completed.
Disconnected from Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0
Run SQL Report to Find Project ID
Run the SQL report /sql/stats_data to find your project data.
Bond and Pollard Limited
========================
Project Statistics Data Page: 1
Project ID Description Data ID Data Project ID Data Description Value
---------- -------------------- ------- --------------- -------------------- ------------------------------
99 PL/SQL Exam Results 417 99 Fred 90
99 PL/SQL Exam Results 418 99 Jim 93
99 PL/SQL Exam Results 419 99 Ann 97
99 PL/SQL Exam Results 420 99 Ian 98
99 PL/SQL Exam Results 421 99 Steve F 100
99 PL/SQL Exam Results 422 99 Bruce Scott 99
99 PL/SQL Exam Results 423 99 Tiger 95
99 PL/SQL Exam Results 424 99 Mary 91
99 PL/SQL Exam Results 425 99 Connor McD 100
99 PL/SQL Exam Results 426 99 Seyi 96
99 PL/SQL Exam Results 427 99 Harsh 98
99 PL/SQL Exam Results 428 99 Peter 89
99 PL/SQL Exam Results 429 99 Doris 85
99 PL/SQL Exam Results 430 99 Winston 92
99 PL/SQL Exam Results 431 99 Charlie 91
99 PL/SQL Exam Results 432 99 Morse 90
Generate the Statistics Report
Run the SQL report /sql/stats_project to display the statistics for your project, which has Project ID 99.
----------------------------------------------------------
FREQUENCY TABLE
----------------------------------------------------------
KEY=85 Frequency=1
KEY=89 Frequency=1
KEY=90 Frequency=2
KEY=91 Frequency=2
KEY=92 Frequency=1
KEY=93 Frequency=1
KEY=95 Frequency=1
KEY=96 Frequency=1
KEY=97 Frequency=1
KEY=98 Frequency=2
KEY=99 Frequency=1
KEY=100 Frequency=2
----------------------------------------------------------
STATISTICS
Sum=1504
N Total=16
Distinct N=12
Mean=94.0000
Median=94.0000
Mode 1 = 90
Mode 2 = 91
Mode 3 = 98
Mode 4 = 100
Lowest=85
Highest=100
Range=15
Variance Population=19.0000
Variance Sample=20.2667
Standard Deviation Population=4.3589
Standard Deviation Sample=4.5019
Interquartile Range=7.2500
PCT_DISC ( 0.80)=98.0000
PCT_CONT ( 0.80)=98.0000


