Question: ORACLE SQL Bonus: The Loan.csv considers all data values as strings. However, some values are indeed numbers and dates. Map a string to a NUMBER

ORACLE SQL

Bonus: The Loan.csv considers all data values as strings. However, some values are indeed numbers and dates. Map a string to a NUMBER or DATE data type in your program and insert into a Loan table declared accordingly.

Note:

  1. For this example, it is strongly recommended to go from a working-to-working condition. First, write the create table statement. Then use the first line of data values to manually write an `Insert Into ` statement in SQLDeveloper. From that determine a pattern, based on which you should write your program to generate several `Insert Into` statements.
  2. Copy and paste the output from your program in SQLDeveloper to see if your `Insert Into` statements are correct. If correct, data will be inserted.
  3. No attribute is missing a value, so your program need not check for NULLs.
  4. For more information on screenshots read Resources FAQ on the website. Failure to comply with Screenshot instructions will result in loss of points.

Where Val1 and Val4 are numeric and Val2 and Val3 are strings.

drop table Loan; create table Loan (

Amount number(6,0), Loan_date date, Loan_Title varchar(60), Risk_Score number(3,0), Debt_to_income_ratio number(6,2), Zipcode number(5), State varchar(2), Employment_Length number(1), Policy_Code number(1),

check (Amount between 0 and 999999), check (Debt_to_income_ratio between 0 and 9999.99) );

Inserted data by inserting into Oracle SQL

insert into Loan values(1000, '26-May-07', 'Wedding Covered but No Honeymoon', 693, 10, 48127, 'NM', 4, 0); insert into Loan values(1000, '26-May-07', 'Consolidating Debt', 703, 10, 1027, 'MA', 1, 0); insert into Loan values(11000, '27-May-07', 'Want to consolidate my debt', 715, 10, 21227, 'MD', 1, 0);

I programmed in Java to read the excel file and format the data into these insert statements. I have to Map a string to a NUMBER or DATE data type program and insert into a Loan table declared accordingly.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!