Who can help me with a trigger?
Hi, I have a little problem with my database that can be resolved, or so I think that, with a trigger. First of all, that is.create table person
(id_utente number (5) Primary Key,)
name varchar2 (40),
sexo varchar2 (1) check (sex = ' or sex = 'F').
Morada varchar2 (60),
date of data_nascimento,
contacto number (10),
numero_BI number (9)
);
create table Serviço
(id_servico number (5) Primary Key,)
Description varchar2 (40),
Valor number (5),
date of data_inicio,
date of data_fim,
check (data_fim > = data_inicio)
);
create the table modalidade
(id_modalidade number (5) Primary Key,)
Description varchar2 (40),
Valor number (5)
);
create table quarto
(id_quarto number (5) Primary Key,)
Description varchar2 (40)
);
create the table inscricao_servico
(id_inscricao_servico number (5) Primary Key,)
id_servico number (5) references Serviço (id_servico).
id_utente number (5) references user (id_utente),.
date of data_pagamento
);
create the table inscricao_mod
(id_inscricao_mod number (5) Primary Key,)
id_modalidade number (5) references modalidade (id_modalidade).
id_utente number (5) references user (id_utente),.
date of data_inscricao,
date of data_cessacao,
check (data_cessacao > data_inscricao)
);
create table voy
(id_estadia number (5) Primary Key,)
id_utente number (5) references user (id_utente),.
id_quarto number (5) quarto references (id_quarto).
date of data_entrada,
date of data_saida,
check (data_saida > data_entrada)
);
create the table pag_mensalidade
(id_pag_mensalidade number (5) Primary Key,)
id_inscricao_mod number (5) references inscricao_mod (id_inscricao_mod).
mes_mensalidade number (6).
date of data_pagamento,
unique (id_inscricao_mod, mes_mensalidade)
);
insert into person values (1, 'Manel', am', 'Rua large', to_date('80.02.02','yy.mm.dd'), 123456789, 687654321);
insert into person values (2, "Artur", am', 'Rua pequeña', to_date ('81.03.04', 'yy.mm.dd'), 223456789, 587654321);
insert into person values (3, 'Cardoso', ', 'Rua estreita', to_date ('82.04.05', 'yy.mm.dd'), 323456789, 487654321);
insert into person values (4, 'Abílio', ', 'Rua larga', to_date ('79.07.06', 'yy.mm.dd'), 423456789, 787654321);
insert into person values (5, 'Antunes', ', 'Rua nova', to_date ('79.06.01', 'yy.mm.dd'), 423557982, 387654822);
insert into modalidade values (1, 'Total', 800);
insert into modalidade values (2, ' Diurno ate 18' 600 ');
insert into modalidade values (3, ' Diurno ate 22', 700 ');
Insert in quarto values (1, '412');
Insert in quarto values (2, '413');
Insert in quarto values (3, '414');
insert into values of quarto (4, '415');
Insert in quarto values (5, '416');
insert into Serviço values (1, ' Excursao a Fatima ", 150, to_date ('11.05.13', 'yy.mm.dd'), to_date ('11.05.13', 'yy.mm.dd'));
insert into Serviço values (2, 'Ida ao cinéma', 10, to_date ('11.08.22', 'yy.mm.dd'), to_date ('11.08.22', 'yy.mm.dd'));
insert into Serviço values (3, 'Apoio domiciliario', 100, to_date ('11.07.01', 'yy.mm.dd'), to_date ('11.07.31', 'yy.mm.dd'));
insert into voy values (1, 1, 1, to_date ('11.05.05', 'yy.mm.dd'), null);
insert into voy values (2, 2, 2, to_date ('10.01.02', 'yy.mm.dd'), null);
insert into voy values (3, 3, 3, to_date ('09.12.15', 'yy.mm.dd'), to_date ('10.02.25', 'yy.mm.dd'));
insert into inscricao_mod values (1, 1, 1, to_date ('09.12.15', 'yy.mm.dd'), null);
insert into inscricao_mod values (2, 2, 2, to_date ('11.11.11', 'yy.mm.dd'), null);
insert into inscricao_mod values (3, 1, 3, to_date ('10.04.10', 'yy.mm.dd'), to_date ('11.09.21', 'yy.mm.dd'));
insert into inscricao_servico values (1, 1, 1, null);
insert into inscricao_servico values (2, 1, 2, to_date ('11.10.01', 'yy.mm.dd'));
insert into inscricao_servico values (3, 2, 4, null);
insert into inscricao_servico values (3, 4, 5, to_date ('10.12.12', 'yy.mm.dd'));
insert into pag_mensalidade values (1, 1, 201110, to_date ('11.10.23', 'yy.mm.dd'));
insert into pag_mensalidade values (2, 2, 201111, to_date ('11.11.27', 'yy.mm.dd'));
insert into pag_mensalidade values (3, 3, 201112, NULL);
insert into pag_mensalidade values (1, 4, 201111, NULL);
drop table voy;
drop table inscricao_servico;
drop table quarto;
drop table pag_mensalidade;
drop table inscricao_mod;
drop table modalidade;
drop table Serviço;
drop table person;
OK, the problem is: the table "voy" means "stay" and "quarto" means "room". I must, before inserting it on 'Hotel', to check whether or not this room is available.
I can do this:
insert into voy values (4, 3, * 3 *, to_date ('09.12.15', 'yy.mm.dd'), to_date ('10.02.25', 'yy.mm.dd'));
But if, after this command, I do this:
insert into voy values (5, 4, * 3 *, to_date ('09.12.15', 'yy.mm.dd'), to_date ('10.02.25', 'yy.mm.dd'));
He accepts and he shouldn't, because I put 3 and 4 users in the same room at the same time.
the 3rd field is the id of the room, and the two fields are the date of entry (data_entrada) and (data_saida) release date. If a piece is linked to a specific residence in which the release date has not disappeared by, this room should not be available. In addition, the release date can be null, which means that the release date is unknown.
I hope I was clear on my question.
Thanks, Chiapa
I have not yet tested, but this should do:
CREATE OR REPLACE TRIGGER valida_estadia
BEFORE INSERT ON estadia
FOR EACH ROW
DECLARE
quarto NUMBER;
BEGIN
SELECT COUNT(1)
INTO quarto
FROM estadia
WHERE id_quarto = :new.id_quarto and
(data_saida > :new.data_entrada or
data_saida IS NULL);
IF quarto > 0 THEN
RAISE_APPLICATION_ERROR(-20001,'There is already a user in the room.');
END IF;
END valida_estadia;
/
Published by: René Argento on 02/10/2012 11:43
Tags: Database
Similar Questions
-
Hi, I'm new to BC and I have a site that is created on the platform of the BC, but unfortunately this is not admissible. Is there anyone who can help me with a safe way to turn my site into sensitive site?
Of course. Send me the link and I can quote it. It could be days rather than hours to do it properly. There, some work involved to do this.
-
Someone who can help me with. Updated Adobe Bridge CS6 5.0.2 update is not applicable. Error code: U44M2P28
be sure to use the correct update (32 or 64 bit).
-
Hello world
We tried to gif a 14GB of ram and make server complete a booking for her.
This is a server for the exams and the vendor told us to do.I can't any more then 5500MB reservation on it, when I anymore that I get
"Insufficient resources to meet the level of failover configured for vSphere HA.We have:
2 X 5.1 ESXi hosts
Each host has
2 x processors (8 Cores each) with HT active.
255,75 GB of RamvSphere HA has been activated.
Admission control policy is enabled and that the ability to failover is 1 host.What is the problem here?
Thank you
Ernst.Admission control policy is all about to give you the kind of guarantee that if the host failure happens then there will be enough resources to perform the successful failover.
in simple terms, it comes to reserve the resources of failover.
I would recommend going through the notion of vSphere HA, reduced control policy the following document.
From the Page number 22, the details that you need to study is given. Focus especially on part calculations Slot size of it.
in your case you HA vSphere with number of failure of host to tolerate as admission control strategy defined.
This means system will calculate CPU and memory slots out of the resources in your cluster, and the total number of units, it will keep some resources like reserved for failover, and others will be available to be used. It all depends on how much failure of hosts that you want to tolerate.
now in your case, if you try to increase booking one of the virtual machine, which will then affect the number of locations in your environment, and so reserved ability to failover is violated, the system will not let you do what you want to do. As the energy on a virtual machine, or growing booking a powered VM etc..
If you find that you have enough resources in your cluster and due to some virtual machines with very large cpu or memory reservation, number of places is less than you can still manage the settings some advanced in vSphere HA configuration, but I strongly recommend, try to take the help of someone who has done it before.
also try to go through other admission control strategies which are explained in the document for more inputs.
-
Is there anyone who can help me with Super Start
I need assistance with Super Start. I checked the faqs and my problem is not covered.
Great Start has a "backup" feature that allows you to export and import manually or via a "cloud" service
http://www.enjoyfreeware.org/SuperStart/export-importThere is also a folder named /superstart/ in the Firefox profile folder that contains various data files that are associated with Super Start. The file named sites.v1.json contains the data for the 'tiles' that are on the page "start". And there is a folder named snapshots with the images for the page tiles "start". Other files are in the folder / / superstart, but I know not what they are for - has in Super Start I've not used.
https://support.Mozilla.org/en-us/KB/profiles-where-Firefox-stores-user-dataThere are also a bunch of about: config preferences for Super Start. I am a new user of Super Start, but do not have much experience with it. I installed only for having a "homepage" with tiles for 6 news sites I visit every day.
-
How communicate you with a real person who can help set up my Photoshop CS6 license from a computer Windows to a new Mac?
Hello
My son has Adobe Photoshop CS6 when he attended a school for dyslexia and disorders on the autism spectrum with software for students in the United Kingdom.
He has used with success of this edition.
I have the codes on the box but didn't post here not sure of what?
He moved to one-sixth of the Collyers in Horsham college and had to buy a new laptop. The College being all Apple we brought a pro IMac.
He studied art, graphics and media education.
It is a challenge for a person with an age of 7 years in reading! Spell checking in the Photoshop really helped his presentation work. The IMac has the recognition voice very good text.
It will be if everything's going to be all right on to art College to study graphics.
The problem is that he must now get his Photoshop on his new laptop computer and the version that he only works on Windows.
It is possible to send a new code for the CS6 works on his laptop?
In the future it will need to Photoshop and Illustrator professionally, but at this level, we cannot justify paying a monthly fee for the latest version.
Hope you can help.
Regarding the contact with a real person who can help, which will be necessary for you to follow through with what you want so be prepared to have your exercised patience and hope that it is not.
To the link below, click on the still need help? the option in the blue box below and choose the option to chat...
Make sure that you are logged on the Adobe site, having cookies enabled, clearing your cookie cache. If it fails to connect, try to use another browser.Get help from cat with orders, refunds and exchanges (non - CC)
http://helpx.Adobe.com/x-productkb/global/service-b.html ( http://adobe.ly/1d3k3a5 ) -
Get in touch with someone who can help
Hello world.
I have posted a question twice and have had no response from the community.
Are there opportunities that I could actually talk to a professional Adobe to try to solve this problem, as is my work?
I can't find any links to talk to a professional who can help you.
Does anyone have an idea how to talk to someone who actually works at Adobe please?
Thanks in advance for your help.
George
A lot of Adobe people wander in these forums...
I looked over your messages (orders of jumpy / unresponsive Visual reading / very slow body caught my attention), and I had a few questions for clarification:
You wrote:
> We started some new projects on this machine, and every time that read us, video always crashes on a frame while the audio playback is.
What type of film freeze; some or all types?
Is the local slow sequence, or on a network? [If network, the behavior improve once copied local images?]
Your iMac looks nicer that mine and must be able to read most of the types of sequences with aplomb...
-
Hello
My name is Peter, I come from Sweden, I had 10 windows on my computer and I want to use my Photoshop, but the program does not start,I have all already tried to start the program in compatibility mode , but it does not anyway, y at - there someone here who can help me?
Best regards
Peter
reset your preferences-
Acrobat: http://help.adobe.com/en_US/acrobat/X/pro/using/WS58a04a822e3e50102bd615109794195ff-7feb.w .html
Adobe media encoder: https://forums.adobe.com/thread/1713540
Legacy: http://helpx.adobe.com/after-effects/using/preferences.html
Dreamweaver: https://helpx.adobe.com/dreamweaver/kb/restore-preferences-dreamweaver-cs6-cc.html
Flash: http://helpx.adobe.com/flash/kb/re-create-preferences-flash-professional.html
Illustrator: http://helpx.adobe.com/illustrator/using/setting-preferences.html
InDesign: https://forums.adobe.com/thread/526990
Lightroom: https://helpx.adobe.com/lightroom/help/setting-preferences-lightroom.html
Muse (mac): https://forums.adobe.com/thread/1246022?tstart=0
Photoshop: https://forums.adobe.com/thread/375776
Photoshop elements: https://helpx.adobe.com/photoshop-elements/kb/preference-file-locations-photoshop-elements .html, http://www.photokaboom.com/photography/learn/Photoshop_Elements/troubleshooting/1_delete_p references_file.htm
elements of first: https://helpx.adobe.com/photoshop-elements/kb/preference-file-locations-photoshop-elements .html
First pro: http://www.mediacollege.com/adobe/premiere/pro/troubleshooter/trash-preferences.html
If that fails, uninstall, clean (http://www.adobe.com/support/contact/cscleanertool.html) and reinstall
-
Indians kept constantly calling and convinced me to sign up and they would protect my computer for a fee (which I paid by credit card), they were very convincing even had control of my cutsor. After many attempts to communicate with them in different ways, I got no response at all, my computer will not update anything and goes very slow, which report to aand who can help me to get my computer back to normal, I've never had any problems until I signed up with them, they are very good even show your computer infected files on your computer, I'm not good with computer stuff so any help would be appreciated.
Thank you
First, contact your credit card company / bank and have to cancel your card for a new. You have made a serious mistake.
Then reformat and reinstall the operating system on your system.
-
My activation key for windows 7 (bought from my college) does not work. How can I contact someone who can help?
-MikeHello djplexus
First, you will need to understand how to set up the dual boot. This will allow you to be able to choose between XP and 7 at startup.With regard to the creation of an image of Windows XP Backup there is no Windows XP software that will do it for you. You will need to look to third-party vendors for support with this issue. Thank you. -
Spent many hours on the phone with technical support of at & t reset my email ID and password. My mail to yahoo at & t sending and reception, but the same message generates a Mailer Daemon failure notice when sent from Outlook Express for XP. at & t said that there is a Microsoft bug that they cannot solve. Who can help me to solve this problem that just started last night after years of functioning? Please contact me at * address email is removed from the privacy *. Thank you.
Why always a message in Oulook Express that the recipient of this message is not digitally signed, and then another one saying unencrypted and I click send anyway. How can I remove all this and just be able to send directly to who I want? When Outlook is genrating and alert error there are no detaisl provided on the error.
Start over. First eliminate interference antivirus (see www.oehelp.com/OETips.aspx#3). After that go to file | Identities and editing and new identity. Set up your e-mail account to the$ T, and then use the settings they specify on their website for OE and also told you to support. (OE can connect and send to THE$ T, there is therefore no clear 'bug' with OE towards them). See if it works then.
Steve
-
Bought the new printer (Photosmart C410b) HP with ePrint option.
Try to create a new account in eprintcenter.com to save my printer
to use ePrint. Get a similar message for 2 days:
"Sorry, we have server problems. We noticed the problem and will come up with a solution.
I use the German Web site. Is there really a problem since 2 days or is there a any error on my part?
Who can help?
Paschahelen
Problem solved! Found the solution by checking German blogs with the same question.
System doesn´t accept "Umlaute" (Aug), which are common in European languages.
-
I have RECIVED YEAR EMAIL FROM ADOBE AS: as gesture of goodwill, we can help you with the upgrade for PSE 13. We ask you to place the order for Adobe Photoshop elements 13 upgrade and then provide you with the serial number of the full version of the product, even against the new order of upgrade"IS this UPGRADE FREE AND CE WHO SHOULD DO, HOW can I HAVE THIS UPGRADE?
HOW I CAN PLACE THE ORDER AND IS IT FREE?
-
Hello world
See the image below. Part of a great shape I did for work. Had a little problem however. Add a new line with the button 'Add a new revision' works perfect (also when saved and reopened). But when I add the changes with the button + on the right (a, b, c), they disappear when I save and reopen the file. Someone who can help?
Thank you!
Hello
I solved the problem you described.
https://files.Acrobat.com/a/preview/e192fe2f-3268-4075-ae2d-09d471e2e783
I hope this helps.
-
I want to do the "Java EE 5 Compatibility Test'.who can help me?
My custmer product want to join the list of Java EE compatibility as this page: http://www.oracle.com/technetwork/java/javaee/overview/compatibility-javaee5-jsp-141098.html
but I don't know which Department should I cotract with in oracle. Who can help me?John wrote:
My custmer product want to join the list of Java EE compatibility as this page:http://www.oracle.com/technetwork/java/javaee/overview/compatibility-javaee5-jsp-141098.html
but I don't know which Department should I cotract with in oracle. Who can help me?Well you certainly found in the wrong place here!
The forum discuss something like the process of proof of success that individuals can win, it does not deal with product certifications.
It is possible that one of the forums under (http://forums.oracle.com/forums/category.jspa?categoryID=285) may be a more appropriate place, but I can not really help you a lot
~~~~~~~~~
I guess you have a j2ee server not on this list (http://www.oracle.com/technetwork/java/javaee/overview/compatibility-javaee5-jsp-141098.html), you need to certify.
~~~~~~~~~
It can... or maybe not... that's your starting point...
JSR-000244 JavaTM Platform, Enterprise Edition 5 specification
(Final version)It is the version final of this specification, as described in Section 3.5 of the Java Community SM, version 2.6 program.
Specifications:* If you want to read the specifications of assessment, or build an application that uses the specification, click here:
Download
* If you want to build an implementation of the specification, click here:
Download~~~~~~~~~~~~~~~~~~~~
Otherwise in general, I think that http://jcp.org can be your starting point.
See also:
http://JCP.org/aboutJava/communityprocess/final/jsr244/index.html
More references,
References:
http://en.Wikipedia.org/wiki/J2EE#Java_EE_5_certified
http://www.Oracle.com/technetwork/Java/JavaEE/community/index.html
http://Java.Sun.com/J2EE/vendorltr.PDF
http://www.Oracle.com/technetwork/Java/community/index.html
http://www.Oracle.com/technetwork/Java/JavaEE/Overview/index.html
http://en.Wikipedia.org/wiki/Java_Community_Process
http://en.Wikipedia.org/wiki/Technology_Compatibility_Kit~~~~~~~~~~~~~~~
Thank you for treating me like a grocle unknowing who has anwered your plea for directions without know what he's talking about!
Published by: bigdelboy on April 8, 2011 10:30 (Changed link to the Java Forum)
Maybe you are looking for
-
I just installed Office 2007 on my computer and downloaded some documents on the internet. When I try to open Firefox becomes crazy and opens the tabs of the browser faster that I can close them, with no sign of stopping. How can I stop what is happe
-
original title: I paid for help Friday, and my computer was off throughout the weekend. Today it has no voice, and I don't know what else is wrong. Why my computer doesn't work today? Friday, it has been resolved and was off throughout the weekend. T
-
How to set the amount of time before the screen turns off during the slow activity
Adjust the idle time before the screen saver stops
-
How can I start using the netsh wlan command line ICS (microsoft virtual card)?
I am using windows 7 Home premium SP1. I tried everything, but I can't able to start ICS? whenever I try, its gives me the error each time. give me any suggestions? Thank you.
-
Adobe Reader could not load the dll base
Original title: program compatibility Application Applications Apps game games Legacy Crash accidents Application Hang hangs Adobe Reader 9, X, and XI all will not pdf error message load Adobe Reader could not load the dll base saying tried to uninst