Queries and Lookups

Post on 02-Jan-2016

30 views 3 download

description

Queries and Lookups. Simple Department Form. The Simple Form. Insert. Save. LOVBUT. Adding a Department. Query By Example. More Querying. Fetch all departments that begin with ‘SAL’. Adding Manager Info. Revised Module -- Insertion. Querying with Revised Module. - PowerPoint PPT Presentation

Transcript of Queries and Lookups

Queries and Lookups

Simple Department Form

The Simple Form

LOVBUT

Save

Insert

Adding a Department

Query By Example

More Querying

Fetch all departments that begin with ‘SAL’

Adding Manager Info

Revised Module -- Insertion

Querying with Revised Module

• Manager Fields do not fill in automatically

• So we would like to to improve the querying capability

• Unless form is primarily for data entry.

• One method: base form on a view

Defining a View

Basing Module on View

Module Diagram

• View is considered a table on module side.

• No internal structure.

The Form

• Querying now works as desired• But no lookup LOV for data entry!• Maybe we can add a lookup

Add a Lookup

Note a view can have a primary key

and foreign keys!

The New Version

Unfortunately ...

• Form Compiler Blows UP• Diagnostic messages about .cpp

files• ‘Tell your Oracle Representative’• Lesson, don’t add lookups to a table

already in a view!• But there is another way, closely

related ...

Module Views

Module View Looks Like Ordinary Module

Module Component API

• Oracle Designer creates the view for you,

• when you tell it to.

• Use MCAPI.• Creates DDL for

the view

The Underlying View

CREATE OR REPLACE VIEW cgv$MDPT_MV_DEPARTMENT(DNUMBER,DNAME,. . ., L_EMP_LNAME) ASSELECTDPT.DNUMBER DNUMBER,DPT.DNAME DNAME,. . . .,L_EMP.LNAME L_EMP_LNAMEFROMEMPLOYEES L_EMP,DEPARTMENTS DPTWHERE DPT.EMP_EMPID = L_EMP.EMPID (+)/

The View Based Form

Querying

Inserting New Data

Adding an Item Group