queries and lookups

24
Queries and Lookups

Upload: ulysses-mcdaniel

Post on 02-Jan-2016

32 views

Category:

Documents


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

Page 1: Queries and Lookups

Queries and Lookups

Page 2: Queries and Lookups

Simple Department Form

Page 3: Queries and Lookups

The Simple Form

LOVBUT

Save

Insert

Page 4: Queries and Lookups

Adding a Department

Page 5: Queries and Lookups

Query By Example

Page 6: Queries and Lookups

More Querying

Fetch all departments that begin with ‘SAL’

Page 7: Queries and Lookups

Adding Manager Info

Page 8: Queries and Lookups

Revised Module -- Insertion

Page 9: Queries and Lookups

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

Page 10: Queries and Lookups

Defining a View

Page 11: Queries and Lookups

Basing Module on View

Page 12: Queries and Lookups

Module Diagram

• View is considered a table on module side.

• No internal structure.

Page 13: Queries and Lookups

The Form

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

Page 14: Queries and Lookups

Add a Lookup

Note a view can have a primary key

and foreign keys!

Page 15: Queries and Lookups

The New Version

Page 16: Queries and Lookups

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 ...

Page 17: Queries and Lookups

Module Views

Page 18: Queries and Lookups

Module View Looks Like Ordinary Module

Page 19: Queries and Lookups

Module Component API

• Oracle Designer creates the view for you,

• when you tell it to.

• Use MCAPI.• Creates DDL for

the view

Page 20: Queries and Lookups

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 (+)/

Page 21: Queries and Lookups

The View Based Form

Page 22: Queries and Lookups

Querying

Page 23: Queries and Lookups

Inserting New Data

Page 24: Queries and Lookups

Adding an Item Group