Subject | Re: [ib-support] Re: Exception handling |
---|---|
Author | Svein Erling Tysvaer |
Post date | 2002-11-21T14:11:52Z |
No, you cannot have triggers on views, I thought you were going to use it
so that it was impossible to overbook a hotel or something and then I
thought it would be better to prevent that from happening by using a
trigger (or check constraint) on the actual column that shouted NEJ when
you tried to book a room that wasn't available.
As for your view, I'm only curious as to why you use the old SQL-89
notation. In general SQL-92 is recommended, i.e.
CREATE VIEW VY_SANGPLATSER AS
select V.PLATSID, P.PERSNR, P.FNAMN, P.ENAMN, V.SANGNR, V.RUMNR,
A.AVDID, A.NAMN, P.KON, I.INSKRIVID, INTAG.INTAGID
from TBLINSKRIVNING I
join TBLINTAGNING INTAG on I.INSKRIVID = INTAG.INSKRIVID
join TBLVARDPLATS V on V.PLATSID = INTAG.PLATSID
join TBLAVDELNING A on A.AVDID = INTAG.AVDID
join TBLPATIENT P on P.PERSNR = I.PERSNR
;
(Easier to read and e.g. makes JoinLinks in IBO redundant)
Set
At 13:30 21.11.2002 +0000, you wrote:
so that it was impossible to overbook a hotel or something and then I
thought it would be better to prevent that from happening by using a
trigger (or check constraint) on the actual column that shouted NEJ when
you tried to book a room that wasn't available.
As for your view, I'm only curious as to why you use the old SQL-89
notation. In general SQL-92 is recommended, i.e.
CREATE VIEW VY_SANGPLATSER AS
select V.PLATSID, P.PERSNR, P.FNAMN, P.ENAMN, V.SANGNR, V.RUMNR,
A.AVDID, A.NAMN, P.KON, I.INSKRIVID, INTAG.INTAGID
from TBLINSKRIVNING I
join TBLINTAGNING INTAG on I.INSKRIVID = INTAG.INSKRIVID
join TBLVARDPLATS V on V.PLATSID = INTAG.PLATSID
join TBLAVDELNING A on A.AVDID = INTAG.AVDID
join TBLPATIENT P on P.PERSNR = I.PERSNR
;
(Easier to read and e.g. makes JoinLinks in IBO redundant)
Set
At 13:30 21.11.2002 +0000, you wrote:
>Could this be acomplished witha a insert/uppdate trigger on this
>following view where count is to be controlled on P.PERSNR is not
>larger then 20:
>
>CREATE VIEW VY_SANGPLATSER AS
>select V.PLATSID, P.PERSNR, P.FNAMN, P.ENAMN, V.SANGNR, V.RUMNR,
>A.AVDID, A.NAMN, P.KON, I.INSKRIVID, INTAG.INTAGID
>from TBLVARDPLATS V, TBLAVDELNING A, TBLPATIENT P, TBLINSKRIVNING I,
>TBLINTAGNING INTAG
>WHERE P.PERSNR = I.PERSNR
>AND
>V.PLATSID = INTAG.PLATSID
>AND
>A.AVDID = INTAG.AVDID
>AND
>I.INSKRIVID = INTAG.INSKRIVID
>;