Oracle Apex Hands On Guide Lab
Oracle Apex Hands On Guide Lab
Hands-On Guide I
Description:
BISP is committed to provide BEST learning material to the beginners and advance learners. In the same series, we have prepared a complete end-to end Hands-on Beginners Guide for Oracle APEX. The document focuses on basic keywords, terminology and definitions one should know before starting Oracle APEX. Join our professional training program and learn from experts.
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Table of Contents
Introduction ..................................................................................................................................... 3 Components Of Oracle Apex :........................................................................................................... 3 Advantage: ....................................................................................................................................... 5 SQL Workshop as a component of Oracle APEX .............................................................................. 5 Creating a new Workspace & login inside it. ..................................................................................... 5 Working with component SQL Workshop : ..................................................................................... 12 [1] Working on Object Browser ....................................................................................................... 13 Creating a Table through Object Browser ...................................................................................... 14 Creating lookup table .................................................................................................................... 20 [2] Working on SQL commands ...................................................................................................... 23 [3] working on SQL Scripts ............................................................................................................. 25 Create Tables Through Script ......................................................................................................... 26 Create Triggers Through Script ...................................................................................................... 30 [4] Working On Query Builder ........................................................................................................ 39 [5] Working with Utilities ................................................................................................................ 45
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Introduction
Oracle Apex : Oracle Application Express is a rapid Web application development tool that lets you share data and create applications. Using only a Web browser and limited programming experience, you can develop and deploy applications that are fast and secure.
It has primarily three components these are : Application Builder :It helps to build following applications database applications websheet applications packaged applications etc. SQL Workshop : It is used for the following purpose Browse , create & edit database objects Execute SQL and PL/ SQL statements Upload & run SQL scripts Export & import SQL scripts Build & save queries using Query builder
Administration : It is used to perform the administrative tasks such as Manage Service Manage Users & Groups Monitor activity Manage Dashboards & reports
Background One popular misconception is that Application Express is merely new version of Web DB. Mike Hichwa created Web DB, a successful web front-end for Oracle, but the development of Web DB started to move in a direction that diverged from Mike's vision. When tasked with building an internal web calendar, Mike enlisted the help of Joel Kallman and started "Flows". They codeveloped the Web Calendar and Flows, adding features to Flows as they needed them to develop the calendar. In the earliest days of Flows, there was no front-end for it, so all changes to an application were made in SQL*Plus via inserts, updates and deletes. In some ways APEX is an evolution of Web DB, but it was developed with new code and no upgrade path.
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
History Evolution of oracle application Express is described below in tabular form Product Version Released Notes Name HTML DB HTML DB HTML DB Application Express Application Express 1.5 1.6 2.0 2004 2004 2005 January 2006 First release Added themes Added SQL Workshop HTMLDB was renamed to APEX. Version 2.1 of APEX was bundled with the free Oracle Express Edition (XE) database.
2.1
2.2
2006
Packaged Applications
Application Express
3.0
2007
This version featured several new features, including PDF Printing, Flash charting and Access Application Migration This version could also be installed into an Oracle XE database. This included a new major feature known as Interactive Reporting (enabled end-users to customize a report without programmer intervention, using techniques such as filtering, sorting, group-by, choosing displayed columns, etc. The user can even save multiple versions of their customized reports. The programmer can limit which features are enabled). Also added support for BLOB data type
Application Express
3.0.1
July 2007
Application Express
3.1
Spring 2008
Application Express
3.2
2009
Forms conversion
Application Express
4.0
June 2010
Some notable features are declarative Dynamic Actions (which allow reacting to changes on a page without the developer having to write custom Java script) and Plugins (which allow developers to create custom components such as items, regions and processes, that can be re-used across pages and applications). Also added Websheets and RESTful Web
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Application Express
4.1
August 2011
Notable new features included improved (customized) error handling, use of ROWID for updates, a data upload feature for end-users, and improved WebSheets (a hybrid of a spreadsheet and a Wiki, built using Apex itself). Notable new features included new theme (cloudy) and various templates. Notable new features such as application builder for mobile, mobile and responsive themes, and HTML5 support.
4.1.1
4.2
4.2.1
Bug Fixes.
4.2.2
April 2013
Bug Fixes, Improved PDF printing, new Survey Builder packaged application
Advantage:
Fast growing technology Web-based Developers familiar with PL/SQL can use the same skill set when developing Apex applications Easy to create mock-ups Easy to deploy (end user opens a URL to access an APEX application) Scalable (can be deployed to laptops, stand-alone servers, or Oracle RAC installations) Server-side processing and validations Strong and supportive user community (especially Oracle APEX forum) Basic support for group development Free hosting of demo applications provided by Oracle Apex applications can run on the free Oracle Express Edition (XE) database Individual components of an application can be retrieved or identified using SQL
SQL Workshop as a component of Oracle APEX Creating a new Workspace & login inside it.
Step 1: Open internet browser & write "http://localhost:8080/apex/apex_admin " into the URL address bar & click Enter button to open Oracle Apex Admin login page .
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 2: Application Express Administration Services page would appear, provide the required credential Username = admin Password = ***********
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 4: Fill required fields to create new workspace Workspace name = BISP Work space ID = optional Workspace = optional Click Next
Step 5: Select schema Re- use existing schema ? = Yes (if choosing existing schema else choose NO ) Choose Schema Name = HR Click Next
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 6 : Fill the required fields Administrator username = ADMIN Administrator Password = oracle First Name = abc last name = optional Email = [email protected] Click to Next
Step 7: Check confirm request & if everything is fine then click Create Workspace.
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 10: Log out confirmation page is displaying so click on Return to login Page to login inside your workspace .
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 11:To login inside work space complete required blank fields Workspace = BISP Username ADMIN Password = oracle Click Login to application express
Step 12: The password for this account must be changed & hence Enter current Password = oracle Enter new password = #Oracle123 Confirm New Password = #Oracle123 Click on Apply Changes
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 14: Enter New Password = #Oracle123 & then click Login to application Express
Step 15: Observe that we have successfully entered inside BISP work space & ready to work on components .
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 17:Click on SQL workshop to Create , edit & manage object of Oracle database 11g
Step 18: Now SQL Workspace is again further divided into following components: Object Browser SQL Commands SQL Scripts Utilities Restful services Now Click on Object Browser to manage database objects.
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 19: Inside object browser we can do two things either modify or create following objects inside HR schema , So to Modify these objects click drop down menu located on left pane of the page & select one of the following 1) Tables 2) Views 3) Indexes 4) Sequences 5) Types 6) Packages 7) Procedures 8) Functions 9) Triggers 10) Database Links 11)Materialized Views 12) Synonyms
Step 20: To Create these objects click drop down menu located on Right pane of the page & select one of the following & start creating object inside schema : 1) Tables 2) Views 3) Indexes 4) Sequences 5) Types 6) Packages 7) Procedures 8) Functions 9) Triggers 10) Database Links 11)Materialized Views 12) Synonyms www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com
Step 22: Now this page will appear so see at the right pane of page & click on create then select table to the drop down menu .
Step 23: Fill all the required field to create table inside HR schema Table Name = Student Preserve case = leave unchecked Column Name Type Precision ROLL_ID NUMBER NAME VARCHAR2 EMAIL VARCHAR2 www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com
Scale 5 50 50
10 -
Step 24: Choose Not populated select ROLL_ID(NUMBER) as primary key then click NEXT
Step 25: On the constraint page put radio button on Check then click on Next
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 26: Now before creating table it requests to confirm all the details specially schema & table name so after confirming details click on Create Table to create Student Table
Step 27: Successfully created Student Table into the HR schema & is visible on the left pane under Tables inside Object browser. So for a particular table we can view & modify following: 1) Table 2) Data 3) Indexes 4)Model 5)Constraints 6)Grants 7) Statistics 8) UI Defaults 9)Triggers 10) Dependencies 11) SQL Now these parameters are again sub categorized for example Table consists sub elements are : 1) Add Column 2) Modify Column 3) Rename Column 4) Drop Column 5) Rename 6) Copy 7) Drop 8) Truncate 9)Create Lookup Table Now click Data
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 28: Since Student Table is Newly created & hence it does not contains data so to insert data into it click on Data --> Insert Row
Step 29: Fill all the required fields to create rows of data . ROLL_ID = 01 Name = SHIVA PANDEY EMAIL = [email protected] CONTACT_NUM = 9876543210 DOB =23/03/1988 PHYSICS_MARKS = 98 CHEMISTRY_MARKS=95 MATHS_MARKS = 92 TOTAL_MARKS_OBTAINED=285 Then click to Create www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com
Step 30: Similarly complete another row by filling data as shown below then click Create
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 31: Two count Rows in a table click on Data --> Count Rows then it will display total number of rows in a table for example in my case Student table contains number of rows equal to 2 & hence Row Count = 2 .
Step 32: To drop a table click on Table ---> Drop , then follow the steps & drop your table successfully .
Step 33: As we have created Student table we can also like wise create other objects by simply clicking on Create button located at the right side of the page inside object browser .
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 34: Open SQL Workshop --> Object Browser --> Then on left side select Table --> Click on EMPLOYEES then under Employees table click on Table then click Create Lookup Table to create a new lookup table
Step 35: Select the column you would like to create a lookup table for. The selected column will become foreign key to the lookup table Schema =HR Table name =Employees Show = VARCHAR column Types Column JOB_ID- varchar2 Click Next
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 36: Specify the new table you wish to create. This new table will store a normalized list of values . Schema =HR Table name =Employees Column to normalize = JOB_ID New Table Name = JOB_ID_LOOKUP New Sequence = JOB_ID_LOOKUP_SEQ Click Next
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 38: Now see that we have successfully created a new JOB_ID_LOOKUP table which is now visible in the tables list s , so on clicking into JOB_ID_LOOKUP we can be able to see Table details . This lookup table contains only two columns one for JOB_ID_ID as primary key & another for JOB_ID .
Step 39: Now open SQL Workshop ---> SQL commands , & write query for look up table Select * from job_id_lookup ; Then click to RUN
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 40: Another way to view the data & detail of lookup table is to navigate through Object Browser --> Select Tables --> JOB_ID_LOOKUP --> Click on Data , so from here we can observe that JOB_ID_ID is in a sequence & is unique for every row that's why it is called primary key for this table & foreign key for Employees table from where it is originated .
Step 41: Open SQL Workshop -> SQL Commands www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com
Step 42: Execute Select Query on Employees table inside SQL Command & click Run to obtain its result . select first_name from employees where first_name like 'E%' Click RUN & also we have choice to save this query by clicking SAVE tab & can use it anytime. also select Number of rows want to retrieve
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Look result of executed select query i.e this employees table contains only three names starting with 'E' & these are Ellen , Elizabeth , Eleni & Click on Download to download the retrieved data & save it somewhere for future use .
Similarly another select query to query names starting with 'S' select first_name from employees where first_name like 'S%' Click RUN & also we have choice to save this query by clicking SAVE tab & can use it anytime. also select Number of rows want to retrieve
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 45: Click on Choose File to choose create table script file which is located somewhere in the system.
Step 46: Browse file & select V2_Teams_DB_CREATE file then click Open www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com
Step 47: Now look file is successfully uploaded & hence click on Upload Tab .
Step 48: Click on Run icon shown inside indicated red box.
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 49: A message prompt asking that you have requested to run the following script. Please confirm your request so click Run Now .
Step 51: Check that all statements Processed without error & click download to download detail.
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 52: Open Object Browser page by clicking into SQL Workshop --> Object Browser, then select Tables from Top Down menu & observe that we have successfully imported tables into HR Schema by simply uploading sql script file
Step 53:Also Created Sequence for various tables so Select Sequences & Click on ATTND_ID_SEQ Now Check Details of Sequence .
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 56: Click on Choose File to choose Triggers script file which is located somewhere in the system.
Step 57 : Browse file & select V2_Teams_TRIGGERS file then click Open
Step 58: Now look file is successfully uploaded & hence click on Upload Tab
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 60: Click on Run icon shown inside indicated red box.
Step 61: A message prompt asking that you have requested to run the following script. Please confirm your request so click Run Now .
Step 63: Check that all statements Processed without error & click download to download detail. www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 66: List of Triggers are shown now Click on BI ATTENDANCES & Observe all Details of a selected Trigger.
Step 67: Also check that Students Table have no Data so inserting of data can be done through two ways : Insert data one by one by clicking Insert Rows from Sub menu of Data Inserting Data by uploading script So i am going to upload data through script into Students table.
Step 68: Click on Upload to upload data insert script . www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com
Step 69: Click on Choose File to choose data Insert script file which is located somewhere in the system.
Step 70: Browse file & select V2_Teams_DB_INSERT file then click Open
Step 71 : Now look file is successfully uploaded & hence click on Upload Tab www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com
Step 73: Click on Run icon shown inside indicated red box.
Step 74: A message prompt asking that you have requested to run the following script. Please confirm your request so click Run Now .
Step 75: Click on File shown below the View Results www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com
Step 76: Check that all statements Processed without error & click download to download detail.
Step 77: To check whether data inserted through script is came into Students table , therefore Click Data tab from students table . Data is successfully inserted www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com
Step 78: Check Sequence of this Students Table & Observe that last number of sequence is 5020.
Step 79: Click on Students Table ---> Click on Constraints www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com
Step 80: Constraints contains Sub elements Create , Drop , Enable & Disable. Basically this student table contains one primary key & one foreign key as shown by red boxes . Now to create a new constraint (unique key) click on Create
Unique Column1 =STDUSERID(VARCHAR2) Then Click to Next Step 82: Click on Finish
Step 83: Open Sql workshop --> Object Browser --> Select Tables --> Students --> Constraints Now check here we have successfully created a unique id .
Step 85: Click on DEPARTMENTS table & it will be available at the query builder space then select the columns which you want to retrieve through query by checking these boxes .& click Run
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 87: Since we have build Query successfully then next step is to save it for future use .So click Save tab .
It will immediately display Detail of saved SQL query build into query builder , for example Owner , Name ,Description ,Updated by , Updated which is shown by the red box
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 89: Open SQL Commands by clicking on SQL Workshop --> SQL commands
Step 90: Click on Saved SQL to run the saved query build into query builder.
Step 91: On clicking Saved SQL it will display all the saved queries so choose one which likely going to execute . For example click on department _sql www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com
Step 92:Select whole query & when it looks blue as shown below Click on Run tab to execute query
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 94 : To build complex query in which various tables are involved click on Employees table , JOBs table , JOB HISTORY table & make relation between these tables so check mark the boxes like JOB_ID , MIN_SALARY , MAX_SALARY from JOBS table & START_DATE , END_DATE from JOB_HISTOY & FIRST_NAME , LAST_NAME from EMPLOYEES table & CLICK to Run
Step 96: Click on SQL to see build SQL Query , now see we have successfully build complex query through Query Builider www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com
Step 98: It will prompt for Save SQL so provide the required details Name = DEMO1 Description = Optional Click to Save Step 99: Now Query is saved with the Name Demo1 so whenever we need to execute such query use Demo1
Oracle Apex Provided us a component known as Utilities which further consists of sub components www.bisptrainigs.com www.hyperionguru.com
Query Builder ,Data Workshop , Generate DDL , Methods on Table , User Interface Defaults ,Schema comparison, Object Reports , Recycle Bin . So these sub components performs various tasks so in this document we will work only on Data Workshop . Step 102: Open SQL Workshop ---> Utilities
Step 100: Look at the Various Utilities & Click on Data Workshop to open it
Step 101: So from data workshop we can Load , Unload data & manage Repository so click on Text Data
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 102: Since we have already created table through script now we have only to load data inside Projects table , so to load data into existing account table choose radio button on Existing table also choose Load From Upload file then click Next .
Step 103:Select the database schema and name of the table you would like to load data into Table Owner = HR Table Name = PROJECTS Click Next
Step 105: Choose Project Data file from your system & then click to Open www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com
Step 106: Fill all the required files & File & Separator both are mandatory so separator = ,(comma) Click Next
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 107: This page preview how your data will be loaded . match database column names with column in the data . So choose PROJ_NAME in first column & PROJ_CLIENT into second column then click to Next
Now data imported & hence it is showing Text Data Load Repository
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Step 108: Open SQL Workshop ---> Object Browser ---> Tables ---> Projects---> Data . Observe that table is containing imported data & hence we have successfully loaded data into Projects table through utilities , in a similar way we can unload tables from schema by using utilities .
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com