0% found this document useful (0 votes)
66 views16 pages

ADFo 2 1 Practice

This document describes two activities for practicing Oracle Application Express development. The first activity involves using SQL Workshop to load tables and sample data. The second activity creates a lookup table using the Data Workshop utility.

Uploaded by

Omar Halaseh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views16 pages

ADFo 2 1 Practice

This document describes two activities for practicing Oracle Application Express development. The first activity involves using SQL Workshop to load tables and sample data. The second activity creates a lookup table using the Data Workshop utility.

Uploaded by

Omar Halaseh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Oracle Application Express: Application Development Foundations

2-1: Using SQL Workshop


Practice Activities
This practice includes two activities.

1. Loading the Tables and Data:


In this activity, you use SQL Workshop to create the underlying database objects and data required for you to build the Demo
Projects application.

2. Creating a Lookup Table:


In this activity, you create a tabled named HARDWARE and load data in to the table. Then, you create a lookup table.

Try It / Solve It

Practice Activity 1: Loading the Tables and Data


It is essential to have at least the tables defined in order for the Create Application wizard to generate pages in your application. In this
hands-on-lab, you create the required database objects, and populate the tables with sample data.

1. Use SQL Workshop to upload a script that creates the tables for the Demo Projects application. Perform the following steps:
a) Click SQL Workshop and select SQL Scripts.

b) Click Upload.
c) Click Choose File, navigate to the working directory where you extracted apex-course-labs.zip.
Locate the Project_Basic_Tables.sql file, and double-click the file or click the file and then click Open.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
2

d) Click Upload.

e) Review the uploaded script to see what tables will be created.


In the SQL Scripts list, click the Edit icon (pencil), to the left of the script you just uploaded.

f) Click the Run icon to the right of the script you uploaded.
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
3

Click Run Now.

g) Click the View Results icon for the script you just ran.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
4

2. Currently the tables you created do not have any data. A script has been provided that creates an Oracle database package which
can be run at any time to insert or reset the data in the tables. Use SQL Workshop to upload a script that you can use to populate
table data. Perform the following steps:
a) Click SQL Scripts. Click Upload.
b) Click Choose File, where you extracted apex-course-labs.zip.
c) Locate the Project_Data.sql file, and double-click the file or click the file and then click Open.
d) Click Upload.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
5

e) Click the Run icon to the right of the script you uploaded (top row).

Click Run Now.

f) Click the View Results icon for the script you just ran (top row).

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
6

3. In step 1, you uploaded a package called DEMO_PROJECTS_DATA_PKG. However, this package has not yet been run so the
tables you created still do not have any data. The SQL Commands facility, within SQL Workshop, allows a developer to run any
valid SQL commands. You will run a SQL command to execute the data package and populate the tables. Use SQL Commands to
execute n Oracle Database package. Perform the following steps:

a) Click the Up arrow, before SQL Scripts.

b) Click SQL Commands.

c) Enter the following code:

begin demo_projects_data_pkg.load_sample_data;
end;

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
7

d) Click Run.

The Results show: Statement Processed.

4. Use the Object Browser within SQL Workshop to review all of the database objects, such as the tables and packages you created,
available in the underlying Oracle database schema which is associated with the Application Express workspace you logged into.
Perform the following steps:

a) At the top of the page, select SQL Workshop and then select Object Browser.

b) In Object Browser, select the DEMO_PROJ_TEAM_MEMBERS table, and then click on the Data tab.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
8

Note: There are a number of other tables listed, outside of those you created using the script file above. The APEX$ tables are
created by Application Express to store internal data specific to your workspace. Tables such as DEMO_CUSTOMERS were
created when the Sample Database Application was installed. The Sample Database Application is installed by default when
an Application Express Workspace is created.

c) To review the package you created, select Packages and select DEMO_PROJECTS_DATA_PKG. Click Body to review the
primary PL/SQL rather than the specification.

Note: This package includes complex PL/SQL code to insert images and replicate users entering in records. It is not important
that you understand the PL/SQL code in this package, as you will not normally have to populate data in this matter. Generally,
you would create the tables with no data and then use the application you build to insert the records.
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
9

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
10

Practice Activity 2: Creating a Lookup Table


In this practice, you use the Data Workshop utility to create a table and populate the table with data. Once this table is created, you also
create a lookup table.

1. Click SQL Workshop > Utilities > Data Workshop.

2. Click Data Load >Spreadsheet Data.

3. The Load Data Wizard appears.


Under Load To, select New Table, and under Load From, select Upload file.
Click Next.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
11

4. Click Choose File, open the working directory where you extracted apex-course-labs.zip. Locate the hardware.csv file, and
double-click the file or click the file and then click Open.
Ensure that First row contains column names is selected, accept the remaining defaults, and click Next.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
12

5. Enter Hardware for Table Name, verify the table properties, and click Next.

6. Accept the defaults on the Load Data - Primary Key page, and click Load Data.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
13

7. The new table is now created and is populated with the data.
Click Object Browser.

8. In the Object Selection pane, click Hardware.


The Detail pane now shows details about Hardware table. For the Hardware table, review the column names and data types.
Click Data.
Now you see a report of the data contained in the Hardware table.

9. You want to create a lookup table now. Perform the following steps:
a) Click Table. Click Create Lookup Table.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
14

b) Select DEPARTMENT for Column. Click Next.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
15

c) Accept the defaults on this page and click Next.

d) Click Create Lookup Table.

e) Review the table definition of DEPARTMENT_LOOKUP table.


Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
16

f) In the Object Selection pane, click HARDWARE.


Review the table details. Notice that the DEPARTMENT column has been extracted from the HARDWARE table and is now
available in the DEPARTMENT_LOOKUP table.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

You might also like