From 321b0ecadc7347da38e3754b2418de951cec5865 Mon Sep 17 00:00:00 2001 From: pascal Date: Sun, 24 Jan 2021 18:04:45 +0100 Subject: [PATCH] date --- TP/TP1-Q3.sql | 20 ++++++++++---------- TP/TP1-sol.tex | 10 +++++----- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/TP/TP1-Q3.sql b/TP/TP1-Q3.sql index 98279e0..fcb9aad 100755 --- a/TP/TP1-Q3.sql +++ b/TP/TP1-Q3.sql @@ -15,12 +15,12 @@ -- VE004 -- Vehicule pas en cours de location -- VE003 --- '03-JAN-2007' +-- '03-JAN-20022' -- 370000 -- PB date de retour inf date debut -- VE003 --- '03-JAN-2018' +-- '03-JAN-2022' -- 37 -- PB Km de retour inf KM debut @@ -31,7 +31,7 @@ -- ORA-00001 : pb de clef non respectee -- ORA-02290 : check constraint Viole les contraintes d'integrite du modele. -insert into Tlocation2017 values ('C002','VE004',to_date('29-01-2016','DD-MM-YYYY'),to_date('10-02-2017','DD-MM-YYYY'),5000); +insert into Tlocation2021 values ('C002','VE004',to_date('29-01-2016','DD-MM-YYYY'),to_date('10-02-2021','DD-MM-YYYY'),5000); DROP TABLE tligne; CREATE TABLE tligne (ligne varchar2(100)); @@ -41,7 +41,7 @@ set verify off; set feed off; variable vnovehicule char(5); -variable vdateretour date; +variable vdateretour char(10); variable vkmfin number; prompt Entrer le numero du vehicule : @@ -64,20 +64,20 @@ begin dmessage:='numero de vehicule inconnu'; select noveh into dnovehicule -from Tvehicule2017 +from Tvehicule2021 where noveh='&vnovehicule'; dmessage:='Vehicule pas en cours de location'; select noclient into dnoclient -from Tlocation2017 +from Tlocation2021 where noveh='&vnovehicule'; select datedeb, kmdeb, noclient into ddatedebut, dkmdeb, dnoclient -from Tlocation2017 +from Tlocation2021 where noveh='&vnovehicule'; -if (ddatedebut >= &vdateretour) +if (ddatedebut >= TO_DATE(&vdateretour,'DD-MM-YYYY')) then Insert into tligne values ('PB date de retour inf date debut'); else @@ -85,8 +85,8 @@ if (dkmdeb >= &vkmfin) then Insert into tligne values ('PB Km de retour inf KM debut'); else -Insert into Tlocatretour2017 values (dnoclient,'&vnovehicule',ddatedebut,dkmdeb,&vkmfin,to_date(&vdateretour,'DD-MM-YYYY')); --- Insert into Tlocatretour2017 values (dnoclient,'&vnovehicule',ddatedebut,dkmdeb,&vkmfin,to_date('15-12-2019','DD-MM-YYYY')); +Insert into Tlocatretour2021 values (dnoclient,'&vnovehicule',ddatedebut,dkmdeb,&vkmfin,to_date(&vdateretour,'DD-MM-YYYY')); +-- Insert into Tlocatretour2021 values (dnoclient,'&vnovehicule',ddatedebut,dkmdeb,&vkmfin,to_date('15-12-2019','DD-MM-YYYY')); Insert into tligne values ('Retour bien effectue '); end if; diff --git a/TP/TP1-sol.tex b/TP/TP1-sol.tex index 94ea1a3..9871340 100644 --- a/TP/TP1-sol.tex +++ b/TP/TP1-sol.tex @@ -268,17 +268,17 @@ Les messages suivants sont à prévoir : -- VE004 -- Vehicule pas en cours de location -- VE003 --- '03-JAN-2007' +-- '03-JAN-2022' -- 370000 -- PB date de retour inf date debut -- VE003 --- '03-JAN-2020' +-- '03-JAN-2022' -- 37 -- PB Km de retour inf KM debut -- VE004 --- '03-JAN-2020' +-- '03-JAN-2022' -- 4000000 -- ORA-00001 : pb de clef non respectee @@ -292,7 +292,7 @@ CREATE TABLE tligne (ligne varchar2(100)); set echo off; set verify off; set feed off; variable vnovehicule char(5); -variable vdateretour date; +variable vdateretour char(10); variable vkmfin number; prompt Entrer le numero du vehicule : @@ -328,7 +328,7 @@ select datedeb, kmdeb, noclient into ddatedebut, dkmdeb, dnoclient from Tlocation2017 where noveh='&vnovehicule'; -if (ddatedebut >= &vdateretour) +if (ddatedebut >= TO_DATE(&vdateretour,'DD-MM-YYYY')) then Insert into tligne values ('PB date de retour inf date debut'); else