Oracle Sql Bonus Loancsv Considers Data Values Strings However Values Indeed Numbers Dates Q43903880
ORACLE SQL
Bonus: The Loan.csv considers all data valuesas strings. However, some values are indeed numbers and dates. Mapa string to a NUMBER or DATE data type in your program and insertinto a Loan table declared accordingly.
Note:
- For this example, it is strongly recommended to go from aworking-to-working condition. First, write the create tablestatement. Then use the first line of data values to manually writean `Insert Into ` statement in SQLDeveloper. From that determine apattern, based on which you should write your program to generateseveral `Insert Into` statements.
- Copy and paste the output from your program in SQLDeveloper tosee if your `Insert Into` statements are correct. If correct, datawill be inserted.
- No attribute is missing a value, so your program need not checkfor NULLs.
- For more information on screenshots read Resources FAQ on thewebsite. Failure to comply with Screenshot instructions will resultin loss of points.
Where Val1 and Val4 are numeric and Val2 and Val3 arestrings.
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 butNo 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 mydebt’, 715, 10, 21227, ‘MD’, 1, 0);
I programmed in Java to read the excel file and format the datainto these insert statements. I have to Map a string to a NUMBER orDATE data type program and insert into a Loan table declaredaccordingly.
Expert Answer
Answer to ORACLE SQL Bonus: The Loan.csv considers all data values as strings. However, some values are indeed numbers and dates. …
OR