SlideShare a Scribd company logo
1 of 17
CREATE TABLE camioneros 
( 
nombre CHAR(18) NULL , 
cedula CHAR(18) NOT NULL , 
telefono CHAR(18) NULL , 
direccion CHAR(18) NULL , 
salario CHAR(18) NULL , 
destinatario CHAR(18) NULL , 
matricula CHAR(18) NULL 
); 
CREATE UNIQUE INDEX XPKcamioneros ON camioneros 
(cedula ASC);
ALTER TABLE camioneros 
ADD CONSTRAINT XPKcamioneros PRIMARY KEY (cedula); 
CREATE TABLE camiones 
( 
matricula CHAR(18) NOT NULL , 
modelo CHAR(18) NULL , 
tipo CHAR(18) NULL , 
potencia CHAR(18) NULL 
); 
CREATE UNIQUE INDEX XPKcamiones ON camiones 
(matricula ASC); 
ALTER TABLE camiones 
ADD CONSTRAINT XPKcamiones PRIMARY KEY (matricula);
CREATE TABLE paquete 
( 
codigo CHAR(18) NOT NULL , 
provincia CHAR(18) NULL , 
nombre CHAR(18) NULL , 
cedula CHAR(18) NULL 
); 
CREATE UNIQUE INDEX XPKpaquete ON paquete 
(codigo ASC); 
ALTER TABLE paquete 
ADD CONSTRAINT XPKpaquete PRIMARY KEY (codigo); 
CREATE TABLE provincias 
( 
codigo CHAR(18) NOT NULL , 
nombre CHAR(18) NULL 
);
CREATE UNIQUE INDEX XPKprovincias ON provincias 
(codigo ASC); 
ALTER TABLE provincias 
ADD CONSTRAINT XPKprovincias PRIMARY KEY (codigo); 
ALTER TABLE camioneros 
ADD (CONSTRAINT R_4 FOREIGN KEY (matricula) REFERENCES camiones (matricula) ON DELETE SET NULL); 
ALTER TABLE paquete 
ADD (CONSTRAINT R_3 FOREIGN KEY (codigo) REFERENCES provincias (codigo)); 
ALTER TABLE paquete 
ADD (CONSTRAINT R_5 FOREIGN KEY (cedula) REFERENCES camioneros (cedula) ON DELETE SET NULL);
CREATE TRIGGER tI_camioneros BEFORE INSERT ON camioneros for each row 
-- ERwin Builtin Trigger 
-- INSERT trigger on camioneros 
DECLARE NUMROWS INTEGER; 
BEGIN 
/* ERwin Builtin Trigger */ 
/* camiones camioneros on child insert set null */ 
/* ERWIN_RELATION:CHECKSUM="0000ef67", PARENT_OWNER="", PARENT_TABLE="camiones" 
CHILD_OWNER="", CHILD_TABLE="camioneros" 
P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", 
FK_CONSTRAINT="R_4", FK_COLUMNS="matricula" */ 
UPDATE camioneros 
SET 
/* %SetFK(camioneros,NULL) */ 
camioneros.matricula = NULL 
WHERE 
NOT EXISTS ( 
SELECT * FROM camiones 
WHERE 
/* %JoinFKPK(:%New,camiones," = "," AND") */ 
:new.matricula = camiones.matricula 
) 
/* %JoinPKPK(camioneros,:%New," = "," AND") */ 
and camioneros.cedula = :new.cedula;
-- ERwin Builtin Trigger 
END; 
/ 
CREATE TRIGGER tD_camioneros AFTER DELETE ON camioneros for each row 
-- ERwin Builtin Trigger 
-- DELETE trigger on camioneros 
DECLARE NUMROWS INTEGER; 
BEGIN 
/* ERwin Builtin Trigger */ 
/* camioneros paquete on parent delete set null */ 
/* ERWIN_RELATION:CHECKSUM="0000abe1", PARENT_OWNER="", PARENT_TABLE="camioneros" 
CHILD_OWNER="", CHILD_TABLE="paquete" 
P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", 
FK_CONSTRAINT="R_5", FK_COLUMNS="cedula" */ 
UPDATE paquete 
SET 
/* %SetFK(paquete,NULL) */ 
paquete.cedula = NULL 
WHERE 
/* %JoinFKPK(paquete,:%Old," = "," AND") */ 
paquete.cedula = :old.cedula;
-- ERwin Builtin Trigger 
END; 
/ 
CREATE TRIGGER tU_camioneros AFTER UPDATE ON camioneros for each row 
-- ERwin Builtin Trigger 
-- UPDATE trigger on camioneros 
DECLARE NUMROWS INTEGER; 
BEGIN 
/* camioneros paquete on parent update set null */ 
/* ERWIN_RELATION:CHECKSUM="0001e0e9", PARENT_OWNER="", PARENT_TABLE="camioneros" 
CHILD_OWNER="", CHILD_TABLE="paquete" 
P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", 
FK_CONSTRAINT="R_5", FK_COLUMNS="cedula" */ 
IF 
/* %JoinPKPK(:%Old,:%New," <> "," OR ") */ 
:old.cedula <> :new.cedula 
THEN 
UPDATE paquete 
SET 
/* %SetFK(paquete,NULL) */ 
paquete.cedula = NULL 
WHERE 
/* %JoinFKPK(paquete,:%Old," = ",",") */ 
paquete.cedula = :old.cedula; 
END IF;
/* ERwin Builtin Trigger */ 
/* camiones camioneros on child update no action */ 
/* ERWIN_RELATION:CHECKSUM="00000000", PARENT_OWNER="", PARENT_TABLE="camiones" 
CHILD_OWNER="", CHILD_TABLE="camioneros" 
P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", 
FK_CONSTRAINT="R_4", FK_COLUMNS="matricula" */ 
SELECT count(*) INTO NUMROWS 
FROM camiones 
WHERE 
/* %JoinFKPK(:%New,camiones," = "," AND") */ 
:new.matricula = camiones.matricula; 
IF ( 
/* %NotnullFK(:%New," IS NOT NULL AND") */ 
:new.matricula IS NOT NULL AND 
NUMROWS = 0 
) 
THEN 
raise_application_error( 
-20007, 
'Cannot update camioneros because camiones does not exist.' 
); 
END IF; 
-- ERwin Builtin Trigger
END; 
/ 
CREATE TRIGGER tD_camiones AFTER DELETE ON camiones for each row 
-- ERwin Builtin Trigger 
-- DELETE trigger on camiones 
DECLARE NUMROWS INTEGER; 
BEGIN 
/* ERwin Builtin Trigger */ 
/* camiones camioneros on parent delete set null */ 
/* ERWIN_RELATION:CHECKSUM="0000b734", PARENT_OWNER="", PARENT_TABLE="camiones" 
CHILD_OWNER="", CHILD_TABLE="camioneros" 
P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", 
FK_CONSTRAINT="R_4", FK_COLUMNS="matricula" */ 
UPDATE camioneros 
SET 
/* %SetFK(camioneros,NULL) */ 
camioneros.matricula = NULL 
WHERE 
/* %JoinFKPK(camioneros,:%Old," = "," AND") */ 
camioneros.matricula = :old.matricula; 
-- ERwin Builtin Trigger 
END;
/ 
CREATE TRIGGER tU_camiones AFTER UPDATE ON camiones for each row 
-- ERwin Builtin Trigger 
-- UPDATE trigger on camiones 
DECLARE NUMROWS INTEGER; 
BEGIN 
/* camiones camioneros on parent update set null */ 
/* ERWIN_RELATION:CHECKSUM="0000d8e3", PARENT_OWNER="", PARENT_TABLE="camiones" 
CHILD_OWNER="", CHILD_TABLE="camioneros" 
P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", 
FK_CONSTRAINT="R_4", FK_COLUMNS="matricula" */ 
IF 
/* %JoinPKPK(:%Old,:%New," <> "," OR ") */ 
:old.matricula <> :new.matricula 
THEN 
UPDATE camioneros 
SET 
/* %SetFK(camioneros,NULL) */ 
camioneros.matricula = NULL 
WHERE 
/* %JoinFKPK(camioneros,:%Old," = ",",") */ 
camioneros.matricula = :old.matricula; 
END IF;
-- ERwin Builtin Trigger 
END; 
/ 
CREATE TRIGGER tI_paquete BEFORE INSERT ON paquete for each row 
-- ERwin Builtin Trigger 
-- INSERT trigger on paquete 
DECLARE NUMROWS INTEGER; 
BEGIN 
/* ERwin Builtin Trigger */ 
/* provincias paquete on child insert restrict */ 
/* ERWIN_RELATION:CHECKSUM="0001e783", PARENT_OWNER="", PARENT_TABLE="provincias" 
CHILD_OWNER="", CHILD_TABLE="paquete" 
P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", 
FK_CONSTRAINT="R_3", FK_COLUMNS="codigo" */ 
SELECT count(*) INTO NUMROWS 
FROM provincias 
WHERE 
/* %JoinFKPK(:%New,provincias," = "," AND") */ 
:new.codigo = provincias.codigo; 
IF ( 
/* %NotnullFK(:%New," IS NOT NULL AND") */ 
NUMROWS = 0 
)
THEN 
raise_application_error( 
-20002, 
'Cannot insert paquete because provincias does not exist.' 
); 
END IF; 
/* ERwin Builtin Trigger */ 
/* camioneros paquete on child insert set null */ 
/* ERWIN_RELATION:CHECKSUM="00000000", PARENT_OWNER="", PARENT_TABLE="camioneros" 
CHILD_OWNER="", CHILD_TABLE="paquete" 
P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", 
FK_CONSTRAINT="R_5", FK_COLUMNS="cedula" */ 
UPDATE paquete 
SET 
/* %SetFK(paquete,NULL) */ 
paquete.cedula = NULL 
WHERE 
NOT EXISTS ( 
SELECT * FROM camioneros 
WHERE 
/* %JoinFKPK(:%New,camioneros," = "," AND") */ 
:new.cedula = camioneros.cedula 
) 
/* %JoinPKPK(paquete,:%New," = "," AND") */ 
and paquete.codigo = :new.codigo;
-- ERwin Builtin Trigger 
END; 
/ 
CREATE TRIGGER tU_paquete AFTER UPDATE ON paquete for each row 
-- ERwin Builtin Trigger 
-- UPDATE trigger on paquete 
DECLARE NUMROWS INTEGER; 
BEGIN 
/* ERwin Builtin Trigger */ 
/* provincias paquete on child update restrict */ 
/* ERWIN_RELATION:CHECKSUM="0002069f", PARENT_OWNER="", PARENT_TABLE="provincias" 
CHILD_OWNER="", CHILD_TABLE="paquete" 
P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", 
FK_CONSTRAINT="R_3", FK_COLUMNS="codigo" */ 
SELECT count(*) INTO NUMROWS 
FROM provincias 
WHERE 
/* %JoinFKPK(:%New,provincias," = "," AND") */ 
:new.codigo = provincias.codigo; 
IF ( 
/* %NotnullFK(:%New," IS NOT NULL AND") */ 
NUMROWS = 0
) 
THEN 
raise_application_error( 
-20007, 
'Cannot update paquete because provincias does not exist.' 
); 
END IF; 
/* ERwin Builtin Trigger */ 
/* camioneros paquete on child update no action */ 
/* ERWIN_RELATION:CHECKSUM="00000000", PARENT_OWNER="", PARENT_TABLE="camioneros" 
CHILD_OWNER="", CHILD_TABLE="paquete" 
P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", 
FK_CONSTRAINT="R_5", FK_COLUMNS="cedula" */ 
SELECT count(*) INTO NUMROWS 
FROM camioneros 
WHERE 
/* %JoinFKPK(:%New,camioneros," = "," AND") */ 
:new.cedula = camioneros.cedula; 
IF ( 
/* %NotnullFK(:%New," IS NOT NULL AND") */ 
:new.cedula IS NOT NULL AND 
NUMROWS = 0 
) 
THEN 
raise_application_error(
-20007, 
'Cannot update paquete because camioneros does not exist.' 
); 
END IF; 
-- ERwin Builtin Trigger 
END; 
/ 
CREATE TRIGGER tD_provincias AFTER DELETE ON provincias for each row 
-- ERwin Builtin Trigger 
-- DELETE trigger on provincias 
DECLARE NUMROWS INTEGER; 
BEGIN 
/* ERwin Builtin Trigger */ 
/* provincias paquete on parent delete restrict */ 
/* ERWIN_RELATION:CHECKSUM="0000d337", PARENT_OWNER="", PARENT_TABLE="provincias" 
CHILD_OWNER="", CHILD_TABLE="paquete" 
P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", 
FK_CONSTRAINT="R_3", FK_COLUMNS="codigo" */ 
SELECT count(*) INTO NUMROWS 
FROM paquete 
WHERE 
/* %JoinFKPK(paquete,:%Old," = "," AND") */
paquete.codigo = :old.codigo; 
IF (NUMROWS > 0) 
THEN 
raise_application_error( 
-20001, 
'Cannot delete provincias because paquete exists.' 
); 
END IF; 
-- ERwin Builtin Trigger 
END; 
/ 
CREATE TRIGGER tU_provincias AFTER UPDATE ON provincias for each row 
-- ERwin Builtin Trigger 
-- UPDATE trigger on provincias 
DECLARE NUMROWS INTEGER; 
BEGIN 
/* ERwin Builtin Trigger */ 
/* provincias paquete on parent update restrict */ 
/* ERWIN_RELATION:CHECKSUM="0000fe23", PARENT_OWNER="", PARENT_TABLE="provincias" 
CHILD_OWNER="", CHILD_TABLE="paquete" 
P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", 
FK_CONSTRAINT="R_3", FK_COLUMNS="codigo" */ 
IF
/* %JoinPKPK(:%Old,:%New," <> "," OR ") */ 
:old.codigo <> :new.codigo 
THEN 
SELECT count(*) INTO NUMROWS 
FROM paquete 
WHERE 
/* %JoinFKPK(paquete,:%Old," = "," AND") */ 
paquete.codigo = :old.codigo; 
IF (NUMROWS > 0) 
THEN 
raise_application_error( 
-20005, 
'Cannot update provincias because paquete exists.' 
); 
END IF; 
END IF; 
-- ERwin Builtin Trigger 
END; 
/

More Related Content

Similar to Aviles manuel hurtado katherine

the following SPOOL command will capture the results of .docx
 the following SPOOL command will capture the results of    .docx the following SPOOL command will capture the results of    .docx
the following SPOOL command will capture the results of .docxMARRY7
 
#include iostream #include string#includeiomanip using.docx
#include iostream #include string#includeiomanip using.docx#include iostream #include string#includeiomanip using.docx
#include iostream #include string#includeiomanip using.docxajoy21
 
#include iostream #include string #include fstream std.docx
#include iostream #include string #include fstream  std.docx#include iostream #include string #include fstream  std.docx
#include iostream #include string #include fstream std.docxajoy21
 
Example syntax alv grid list
Example syntax alv grid listExample syntax alv grid list
Example syntax alv grid listNur Khoiri
 
Final Case Study Churn (Autosaved)
Final Case Study Churn (Autosaved)Final Case Study Churn (Autosaved)
Final Case Study Churn (Autosaved)Marreddy P
 

Similar to Aviles manuel hurtado katherine (6)

the following SPOOL command will capture the results of .docx
 the following SPOOL command will capture the results of    .docx the following SPOOL command will capture the results of    .docx
the following SPOOL command will capture the results of .docx
 
#include iostream #include string#includeiomanip using.docx
#include iostream #include string#includeiomanip using.docx#include iostream #include string#includeiomanip using.docx
#include iostream #include string#includeiomanip using.docx
 
sas aeroplan sample
sas aeroplan samplesas aeroplan sample
sas aeroplan sample
 
#include iostream #include string #include fstream std.docx
#include iostream #include string #include fstream  std.docx#include iostream #include string #include fstream  std.docx
#include iostream #include string #include fstream std.docx
 
Example syntax alv grid list
Example syntax alv grid listExample syntax alv grid list
Example syntax alv grid list
 
Final Case Study Churn (Autosaved)
Final Case Study Churn (Autosaved)Final Case Study Churn (Autosaved)
Final Case Study Churn (Autosaved)
 

Recently uploaded

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 

Aviles manuel hurtado katherine

  • 1. CREATE TABLE camioneros ( nombre CHAR(18) NULL , cedula CHAR(18) NOT NULL , telefono CHAR(18) NULL , direccion CHAR(18) NULL , salario CHAR(18) NULL , destinatario CHAR(18) NULL , matricula CHAR(18) NULL ); CREATE UNIQUE INDEX XPKcamioneros ON camioneros (cedula ASC);
  • 2. ALTER TABLE camioneros ADD CONSTRAINT XPKcamioneros PRIMARY KEY (cedula); CREATE TABLE camiones ( matricula CHAR(18) NOT NULL , modelo CHAR(18) NULL , tipo CHAR(18) NULL , potencia CHAR(18) NULL ); CREATE UNIQUE INDEX XPKcamiones ON camiones (matricula ASC); ALTER TABLE camiones ADD CONSTRAINT XPKcamiones PRIMARY KEY (matricula);
  • 3. CREATE TABLE paquete ( codigo CHAR(18) NOT NULL , provincia CHAR(18) NULL , nombre CHAR(18) NULL , cedula CHAR(18) NULL ); CREATE UNIQUE INDEX XPKpaquete ON paquete (codigo ASC); ALTER TABLE paquete ADD CONSTRAINT XPKpaquete PRIMARY KEY (codigo); CREATE TABLE provincias ( codigo CHAR(18) NOT NULL , nombre CHAR(18) NULL );
  • 4. CREATE UNIQUE INDEX XPKprovincias ON provincias (codigo ASC); ALTER TABLE provincias ADD CONSTRAINT XPKprovincias PRIMARY KEY (codigo); ALTER TABLE camioneros ADD (CONSTRAINT R_4 FOREIGN KEY (matricula) REFERENCES camiones (matricula) ON DELETE SET NULL); ALTER TABLE paquete ADD (CONSTRAINT R_3 FOREIGN KEY (codigo) REFERENCES provincias (codigo)); ALTER TABLE paquete ADD (CONSTRAINT R_5 FOREIGN KEY (cedula) REFERENCES camioneros (cedula) ON DELETE SET NULL);
  • 5. CREATE TRIGGER tI_camioneros BEFORE INSERT ON camioneros for each row -- ERwin Builtin Trigger -- INSERT trigger on camioneros DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* camiones camioneros on child insert set null */ /* ERWIN_RELATION:CHECKSUM="0000ef67", PARENT_OWNER="", PARENT_TABLE="camiones" CHILD_OWNER="", CHILD_TABLE="camioneros" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_4", FK_COLUMNS="matricula" */ UPDATE camioneros SET /* %SetFK(camioneros,NULL) */ camioneros.matricula = NULL WHERE NOT EXISTS ( SELECT * FROM camiones WHERE /* %JoinFKPK(:%New,camiones," = "," AND") */ :new.matricula = camiones.matricula ) /* %JoinPKPK(camioneros,:%New," = "," AND") */ and camioneros.cedula = :new.cedula;
  • 6. -- ERwin Builtin Trigger END; / CREATE TRIGGER tD_camioneros AFTER DELETE ON camioneros for each row -- ERwin Builtin Trigger -- DELETE trigger on camioneros DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* camioneros paquete on parent delete set null */ /* ERWIN_RELATION:CHECKSUM="0000abe1", PARENT_OWNER="", PARENT_TABLE="camioneros" CHILD_OWNER="", CHILD_TABLE="paquete" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_5", FK_COLUMNS="cedula" */ UPDATE paquete SET /* %SetFK(paquete,NULL) */ paquete.cedula = NULL WHERE /* %JoinFKPK(paquete,:%Old," = "," AND") */ paquete.cedula = :old.cedula;
  • 7. -- ERwin Builtin Trigger END; / CREATE TRIGGER tU_camioneros AFTER UPDATE ON camioneros for each row -- ERwin Builtin Trigger -- UPDATE trigger on camioneros DECLARE NUMROWS INTEGER; BEGIN /* camioneros paquete on parent update set null */ /* ERWIN_RELATION:CHECKSUM="0001e0e9", PARENT_OWNER="", PARENT_TABLE="camioneros" CHILD_OWNER="", CHILD_TABLE="paquete" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_5", FK_COLUMNS="cedula" */ IF /* %JoinPKPK(:%Old,:%New," <> "," OR ") */ :old.cedula <> :new.cedula THEN UPDATE paquete SET /* %SetFK(paquete,NULL) */ paquete.cedula = NULL WHERE /* %JoinFKPK(paquete,:%Old," = ",",") */ paquete.cedula = :old.cedula; END IF;
  • 8. /* ERwin Builtin Trigger */ /* camiones camioneros on child update no action */ /* ERWIN_RELATION:CHECKSUM="00000000", PARENT_OWNER="", PARENT_TABLE="camiones" CHILD_OWNER="", CHILD_TABLE="camioneros" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_4", FK_COLUMNS="matricula" */ SELECT count(*) INTO NUMROWS FROM camiones WHERE /* %JoinFKPK(:%New,camiones," = "," AND") */ :new.matricula = camiones.matricula; IF ( /* %NotnullFK(:%New," IS NOT NULL AND") */ :new.matricula IS NOT NULL AND NUMROWS = 0 ) THEN raise_application_error( -20007, 'Cannot update camioneros because camiones does not exist.' ); END IF; -- ERwin Builtin Trigger
  • 9. END; / CREATE TRIGGER tD_camiones AFTER DELETE ON camiones for each row -- ERwin Builtin Trigger -- DELETE trigger on camiones DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* camiones camioneros on parent delete set null */ /* ERWIN_RELATION:CHECKSUM="0000b734", PARENT_OWNER="", PARENT_TABLE="camiones" CHILD_OWNER="", CHILD_TABLE="camioneros" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_4", FK_COLUMNS="matricula" */ UPDATE camioneros SET /* %SetFK(camioneros,NULL) */ camioneros.matricula = NULL WHERE /* %JoinFKPK(camioneros,:%Old," = "," AND") */ camioneros.matricula = :old.matricula; -- ERwin Builtin Trigger END;
  • 10. / CREATE TRIGGER tU_camiones AFTER UPDATE ON camiones for each row -- ERwin Builtin Trigger -- UPDATE trigger on camiones DECLARE NUMROWS INTEGER; BEGIN /* camiones camioneros on parent update set null */ /* ERWIN_RELATION:CHECKSUM="0000d8e3", PARENT_OWNER="", PARENT_TABLE="camiones" CHILD_OWNER="", CHILD_TABLE="camioneros" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_4", FK_COLUMNS="matricula" */ IF /* %JoinPKPK(:%Old,:%New," <> "," OR ") */ :old.matricula <> :new.matricula THEN UPDATE camioneros SET /* %SetFK(camioneros,NULL) */ camioneros.matricula = NULL WHERE /* %JoinFKPK(camioneros,:%Old," = ",",") */ camioneros.matricula = :old.matricula; END IF;
  • 11. -- ERwin Builtin Trigger END; / CREATE TRIGGER tI_paquete BEFORE INSERT ON paquete for each row -- ERwin Builtin Trigger -- INSERT trigger on paquete DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* provincias paquete on child insert restrict */ /* ERWIN_RELATION:CHECKSUM="0001e783", PARENT_OWNER="", PARENT_TABLE="provincias" CHILD_OWNER="", CHILD_TABLE="paquete" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_3", FK_COLUMNS="codigo" */ SELECT count(*) INTO NUMROWS FROM provincias WHERE /* %JoinFKPK(:%New,provincias," = "," AND") */ :new.codigo = provincias.codigo; IF ( /* %NotnullFK(:%New," IS NOT NULL AND") */ NUMROWS = 0 )
  • 12. THEN raise_application_error( -20002, 'Cannot insert paquete because provincias does not exist.' ); END IF; /* ERwin Builtin Trigger */ /* camioneros paquete on child insert set null */ /* ERWIN_RELATION:CHECKSUM="00000000", PARENT_OWNER="", PARENT_TABLE="camioneros" CHILD_OWNER="", CHILD_TABLE="paquete" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_5", FK_COLUMNS="cedula" */ UPDATE paquete SET /* %SetFK(paquete,NULL) */ paquete.cedula = NULL WHERE NOT EXISTS ( SELECT * FROM camioneros WHERE /* %JoinFKPK(:%New,camioneros," = "," AND") */ :new.cedula = camioneros.cedula ) /* %JoinPKPK(paquete,:%New," = "," AND") */ and paquete.codigo = :new.codigo;
  • 13. -- ERwin Builtin Trigger END; / CREATE TRIGGER tU_paquete AFTER UPDATE ON paquete for each row -- ERwin Builtin Trigger -- UPDATE trigger on paquete DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* provincias paquete on child update restrict */ /* ERWIN_RELATION:CHECKSUM="0002069f", PARENT_OWNER="", PARENT_TABLE="provincias" CHILD_OWNER="", CHILD_TABLE="paquete" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_3", FK_COLUMNS="codigo" */ SELECT count(*) INTO NUMROWS FROM provincias WHERE /* %JoinFKPK(:%New,provincias," = "," AND") */ :new.codigo = provincias.codigo; IF ( /* %NotnullFK(:%New," IS NOT NULL AND") */ NUMROWS = 0
  • 14. ) THEN raise_application_error( -20007, 'Cannot update paquete because provincias does not exist.' ); END IF; /* ERwin Builtin Trigger */ /* camioneros paquete on child update no action */ /* ERWIN_RELATION:CHECKSUM="00000000", PARENT_OWNER="", PARENT_TABLE="camioneros" CHILD_OWNER="", CHILD_TABLE="paquete" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_5", FK_COLUMNS="cedula" */ SELECT count(*) INTO NUMROWS FROM camioneros WHERE /* %JoinFKPK(:%New,camioneros," = "," AND") */ :new.cedula = camioneros.cedula; IF ( /* %NotnullFK(:%New," IS NOT NULL AND") */ :new.cedula IS NOT NULL AND NUMROWS = 0 ) THEN raise_application_error(
  • 15. -20007, 'Cannot update paquete because camioneros does not exist.' ); END IF; -- ERwin Builtin Trigger END; / CREATE TRIGGER tD_provincias AFTER DELETE ON provincias for each row -- ERwin Builtin Trigger -- DELETE trigger on provincias DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* provincias paquete on parent delete restrict */ /* ERWIN_RELATION:CHECKSUM="0000d337", PARENT_OWNER="", PARENT_TABLE="provincias" CHILD_OWNER="", CHILD_TABLE="paquete" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_3", FK_COLUMNS="codigo" */ SELECT count(*) INTO NUMROWS FROM paquete WHERE /* %JoinFKPK(paquete,:%Old," = "," AND") */
  • 16. paquete.codigo = :old.codigo; IF (NUMROWS > 0) THEN raise_application_error( -20001, 'Cannot delete provincias because paquete exists.' ); END IF; -- ERwin Builtin Trigger END; / CREATE TRIGGER tU_provincias AFTER UPDATE ON provincias for each row -- ERwin Builtin Trigger -- UPDATE trigger on provincias DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* provincias paquete on parent update restrict */ /* ERWIN_RELATION:CHECKSUM="0000fe23", PARENT_OWNER="", PARENT_TABLE="provincias" CHILD_OWNER="", CHILD_TABLE="paquete" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_3", FK_COLUMNS="codigo" */ IF
  • 17. /* %JoinPKPK(:%Old,:%New," <> "," OR ") */ :old.codigo <> :new.codigo THEN SELECT count(*) INTO NUMROWS FROM paquete WHERE /* %JoinFKPK(paquete,:%Old," = "," AND") */ paquete.codigo = :old.codigo; IF (NUMROWS > 0) THEN raise_application_error( -20005, 'Cannot update provincias because paquete exists.' ); END IF; END IF; -- ERwin Builtin Trigger END; /