Chapter 10B – Managing Databases with Oracle Database
Page 10B-155
SQL Solutions to parts I through V are below and in the file DBP-e15-Oracle-QACS-Import-Excel-
Data.sql.
I. Duplicate the PAYROLL worksheet in Figure 10B-89 in a worksheet (or spreadsheet)
in an appropriate tool (such as Microsoft Excel or Apache OpenOffice Calc).
J. Import the data in the PAYROLL worksheet into a table in the QACS database
named PAYROLL_TEMP. As mentioned in this chapter, be careful with data types to
make your job easier in subsequent questions!
K. Create the GetLastNameCommaSeparated user-defined function shown in Figure
10B–57.
CREATE OR REPLACE FUNCTION GetLastNameCommaSeparated
— These are the input parameters
(
varName Varchar2
)
— This is the variable that will hold the returned value
RETURN Varchar
END;
/
L. Create a user-defined function named GetFirstNameCommaSeparated that will
return the first name from a combined name in last-name-first order, with the names
separated by a comma and one space.
Note the use of the RTRIM function to remove trailing blanks from the first name: this