822 Module1
822 Module1
822 Module1
Quest-ce que Oracle Developer ? Les outils Oracle Developer Forms Builder Report Builder Graphics Builder Procedure Builder Project Builder Query Builder Schema Builder Prsentation de lapplication dvelopper
Comme ensemble doutils, le package de Developer permet au programmeur de crer une interface utilisateur pour le serveur de base de donnes dOracle. Une telle interface utilisateur peut inclure des grilles de saisie de donnes, des Reports, des Graphiques et des programmes portables qui fonctionnent directement avec la base de donnes ou directement avec linterface utilisateur. Developer laisse vos applications entirement portables sur dautres plates-formes et emploie des drivers natifs Oracle pour se relier votre base de donnes. Oracle a travaill dur pour intgrer ses applications et ses outils dans le Web. Quand vous ajoutez le serveur dapplication Oracle, vos formulaires deviennent des formulaires Web.
Suivre ces tapes pour crer la base de donnes TOYSTORE. 1. Connectez-vous dans SQL PLUS. 2. Excuter le script suivant avec la commande SQL> start toystore.sql
1-2
/* ----------------- Script toystore --------------------------- */ /* ----------------- creation de tables --------------------------- */ /* --- CATEGORIE --------------------------------------------- */ CREATE TABLE CATEGORIE (SHELF_CATEGORY VARCHAR2(30) NOT NULL, SHELF_DESCRIPTION VARCHAR2(300) NULL, PRIMARY KEY (SHELF_CATEGORY)) ; /* --- BOUTIQUE --------------------------------------------- */ CREATE TABLE BOUTIQUE (STORE_ID NUMBER(10,0) NOT NULL, STORE_STATE CHAR(2) NULL, STORE_NAME VARCHAR2(40) NULL, ADDRESSLINE1 VARCHAR2(32) NULL, ADDRESSLINE2 VARCHAR2(32) NULL, CITY VARCHAR2(30) NULL, ZIP VARCHAR2(10) NULL, PRIMARY KEY (STORE_ID)) ; /* --- JOUET --------------------------------------------- */ CREATE TABLE JOUET (TOY_ID NUMBER(10,0) NOT NULL, TOY_NAME VARCHAR2(30) NULL, TOY_DESC VARCHAR2(2000) NULL, SHELF_CATEGORY VARCHAR2(32) NULL, WHOLESALE_COST NUMBER(8,2) NULL, SUGGESTED_RETAIL_PRICE NUMBER(8,2) NULL, PRIMARY KEY (TOY_ID)) ; /* --- BOUTIQUE_JOUET --------------------------------------------- */ CREATE TABLE BOUTIQUE_JOUET (STORE_ID NUMBER(10,0) NOT NULL, TOY_ID NUMBER(10,0) NOT NULL, SALE_PRICE NUMBER(8,2) NULL, LAST_STOCK_DATE DATE, CURRENT_STOCK_COUNT NUMBER(10,0), PRIMARY KEY (STORE_ID,TOY_ID)) ; /* ----------------------------------------- BOUTIQUE DATA ----- */ INSERT INTO BOUTIQUE VALUES (1382,'FL', 'Betsy''s Personal Treasures', '34988 East Main Blvd',null, 'Miami','87654') / INSERT INTO BOUTIQUE VALUES (2199,'OH', 'Gator Gate', 'Charlotte Mall','80 South Ave', 'Cincinatti','84001') / INSERT INTO BOUTIQUE VALUES (104,'WI', 'Bright Side of Life', 'Gateway Mall','1005 Gammon Road', 'Madison','54321') /
1-3
INSERT INTO BOUTIQUE VALUES (25,'HI', 'The Best of Toys', '411 Front Street',null, 'Lahaina','96781') / INSERT INTO BOUTIQUE VALUES (4965,'WI', 'Busy Bee Toys - Midwest', '100 North Central Ave','Suite 4510', 'Chicago','14822') / /* ------------------------------------------------ CATEGORIE DATA ------------- */ INSERT INTO CATEGORIE VALUES ( 'DOLL','Dolls, doll clothing, doll accessories'); INSERT INTO CATEGORIE VALUES ( 'GAME','All board games, video games, computer games'); INSERT INTO CATEGORIE VALUES ( 'MAGIC','Magic supplies, books, kits'); INSERT INTO CATEGORIE VALUES ( 'SCIENCE','Science kits and books'); INSERT INTO CATEGORIE VALUES ( 'WAR','Guns, weapons, action figures and accessories'); /* ------------------------------------------------ JOUET DATA ------------- */ INSERT INTO JOUET VALUES (406,'Blade Parade','Makes toy blades come out of any part of your body. These blades have infrared aimers and rockets so it always hit the target.', 'WAR',19.57,32.95) / INSERT INTO JOUET VALUES (438,'Morpho-bear','A stuffed bear that morphs into a dragon or anything you want and then becomes alive.', 'MAGIC',14.60,18.50 ) / INSERT INTO JOUET VALUES (466,'The Winger','Creates a cocoon and when you emerge you have wings and can fly.', 'MAGIC',35.00,49.95) / INSERT INTO JOUET VALUES (381,'Belt-o-matic','A belt with many special compartments that either shrink things or create clones of objects placed inside.', 'SCIENCE',10.40,12.79) / INSERT INTO JOUET VALUES (335,'Hug-o-Doll','Remote control doll that walks and hugs.', 'DOLL',12.45,15.00) / INSERT INTO JOUET VALUES (6714,'Ratso','You are the rat and you must solve a maze with cats and traps.', 'GAME',10.05,12.95) / INSERT INTO JOUET VALUES (766,'Barbara','Fashion plastic doll with dress and matching briefcase', 'DOLL',11.95,18.05)
1-4
/ /* ------------------------------------------------------- BOUTIQUE_JOUET DATA ----- */ INSERT INTO BOUTIQUE_JOUET VALUES (1382,766,9.50,'04-JUN-98',30) / INSERT INTO BOUTIQUE_JOUET VALUES (1382,6714,8.50,'12-MAY-98',40) / INSERT INTO BOUTIQUE_JOUET VALUES (1382,406,11.95,'15-APR-98',144) / INSERT INTO BOUTIQUE_JOUET VALUES (1382,438,16.75,'04-JUN-98',91) / INSERT INTO BOUTIQUE_JOUET VALUES (1382,381,12.79,'15-APR-98',157) / INSERT INTO BOUTIQUE_JOUET VALUES (2199,335,12.79,'15-APR-98',578) / INSERT INTO BOUTIQUE_JOUET VALUES ( 25, 335, 13.69, '11-JUL-98',394) / INSERT INTO BOUTIQUE_JOUET VALUES ( 25, 381, 12, '11-JUL-98',204) / INSERT INTO BOUTIQUE_JOUET VALUES ( 25, 406, 28.99, '11-JUL-98',64) / INSERT INTO BOUTIQUE_JOUET VALUES ( 25, 466, 44, '11-JUL-98',224) / INSERT INTO BOUTIQUE_JOUET VALUES ( 25, 766, 15.55, '11-JUL-98',543) / INSERT INTO BOUTIQUE_JOUET VALUES ( 25, 6714, 12, '11-JUL-98',460) / INSERT INTO BOUTIQUE_JOUET VALUES ( 104, 335, 13.45, '11-JUL-98',38) / INSERT INTO BOUTIQUE_JOUET VALUES ( 104, 381, 11.25, '11-JUL-98',88) / INSERT INTO BOUTIQUE_JOUET VALUES ( 104, 406, 27, '11-JUL-98',49) / INSERT INTO BOUTIQUE_JOUET VALUES ( 104, 438, 17, '11-JUL-98',129) / INSERT INTO BOUTIQUE_JOUET VALUES
1-5
( 104, 466, 43.99, '11-JUL-98',255) / INSERT INTO BOUTIQUE_JOUET VALUES ( 1382, 335, 13, '11-JUL-98',236) / INSERT INTO BOUTIQUE_JOUET VALUES ( 1382, 466, 43.45, '11-JUL-98',136) / INSERT INTO BOUTIQUE_JOUET VALUES ( 2199, 381, 12, '11-JUL-98',272) / INSERT INTO BOUTIQUE_JOUET VALUES ( 2199, 406, 26.55, '11-JUL-98',32) / INSERT INTO BOUTIQUE_JOUET VALUES ( 2199, 438, 16, '11-JUL-98',112) / INSERT INTO BOUTIQUE_JOUET VALUES ( 2199, 466, 43, '11-JUL-98',192) / INSERT INTO BOUTIQUE_JOUET VALUES ( 2199, 766, 14.99, '11-JUL-98',512) / INSERT INTO BOUTIQUE_JOUET VALUES ( 2199, 6714, 11.25, '11-JUL-98',432) / INSERT INTO BOUTIQUE_JOUET VALUES ( 4965, 335, 13.05, '11-JUL-98',400) / INSERT INTO BOUTIQUE_JOUET VALUES ( 4965, 438, 16.00, '11-JUL-98',160) / INSERT INTO BOUTIQUE_JOUET VALUES ( 4965, 466, 40.50, '11-JUL-98',240) / INSERT INTO BOUTIQUE_JOUET VALUES ( 4965, 766, 15, '11-JUL-98',560) / /* -------------------------------- ADD FOREIGN KEY NOW ----------- */ ALTER TABLE BOUTIQUE_JOUET ADD( FOREIGN KEY (STORE_ID) REFERENCES BOUTIQUE (STORE_ID)); /* -------------------------------- ADD FOREIGN KEY NOW ----------- */ ALTER TABLE BOUTIQUE_JOUET ADD( FOREIGN KEY (TOY_ID) REFERENCES JOUET(TOY_ID)); /* -------------------------------- ADD FOREIGN KEY NOW ----------- */ ALTER TABLE JOUET ADD( FOREIGN KEY (SHELF_CATEGORY) REFERENCES CATEGORIE(SHELF_CATEGORY));
Vous pouvez tester si vos tables sont bien cres et contiennent des donnes avec les commandes SQL suivantes :
1-6
SQL> SELECT * FROM CAT; TABLE_NAME TABLE_TYPE ------------------------------ ---------------------------------BOUTIQUE TABLE BOUTIQUE_JOUET TABLE CATEGORIE TABLE JOUET TABLE SQL> DESC BOUTIQUE; Name Null? Type ----------------------------------------------------- -------- ---------------STORE_ID NOT NULL NUMBER(10) STORE_STATE CHAR(2) STORE_NAME VARCHAR2(40) ADDRESSLINE1 VARCHAR2(32) ADDRESSLINE2 VARCHAR2(32) CITY VARCHAR2(30) ZIP VARCHAR2(10) SQL> DESC BOUTIQUE_JOUET; Name Null? Type ----------------------------------------------------- -------- ----------------STORE_ID NOT NULL NUMBER(10) TOY_ID NOT NULL NUMBER(10) SALE_PRICE NUMBER(8,2) LAST_STOCK_DATE DATE CURRENT_STOCK_COUNT NUMBER(10) SQL> DESC CATEGORIE; Name Null? Type ----------------------------------------------------- -------- -----------------SHELF_CATEGORY NOT NULL VARCHAR2(30) SHELF_DESCRIPTION VARCHAR2(300) SQL> DESC JOUET; Name Null? Type ----------------------------------------------------- -------- ---------------TOY_ID NOT NULL NUMBER(10) TOY_NAME VARCHAR2(30) TOY_DESC VARCHAR2(2000) SHELF_CATEGORY VARCHAR2(32) WHOLESALE_COST NUMBER(8,2) SUGGESTED_RETAIL_PRICE NUMBER(8,2) SQL> SELECT STORE_ID, STORE_STATE,STORE_NAME,CITY 2 FROM BOUTIQUE; STORE_ID ST STORE_NAME CITY --------- -- ---------------------------------------- ------------1382 FL Betsy's Personal Treasures Miami 2199 OH Gator Gate Cincinatti 104 WI Bright Side of Life Madison 25 HI The Best of Toys Lahaina 4965 WI Busy Bee Toys - Midwest Chicago
1-7
SQL> SELECT TOY_ID,TOY_NAME FROM JOUET; TOY_ID TOY_NAME --------- -----------------------------406 Blade Parade 438 Morpho-bear 466 The Winger 381 Belt-o-matic 335 Hug-o-Doll 6714 Ratso 766 Barbara 7 rows selected. SQL> SELECT rpad( SHELF_CATEGORY,8) AS CATEGORIE , RPAD(SHELF_DESCRIPTION,10) AS DESCRIPTION 2 FROM CATEGORIE; CATEGORI DESCRIPTIO -------- ---------DOLL Dolls, dol GAME All board MAGIC Magic supp SCIENCE Science ki WAR Guns, weap SQL> SELECT STORE_ID , TOY_ID , SAL 2 FROM BOUTIQUE_JOUET ; STORE_ID TOY_ID SALE_PRICE --------- --------- ---------1382 766 9.5 1382 6714 8.5 1382 406 11.95 1382 438 16.75 1382 381 12.79 2199 335 12.79 25 335 13.69 25 381 12 25 406 28.99 25 466 44 25 766 15.55 25 6714 12 104 335 13.45 104 381 11.25 104 406 27 104 438 17 104 466 43.99 1382 335 13 1382 466 43.45 2199 381 12 2199 406 26.55
1-8
STORE_ID TOY_ID SALE_PRICE --------- --------- ---------2199 438 16 2199 466 43 2199 766 14.99 2199 6714 11.25 4965 335 13.05 4965 438 16 4965 466 40.5 4965 766 15 29 rows selected.
1-9