Triggers and Upper, Lower limit?

Hi, I have a scheme library and a plan of borrowing activities, he says that for a child to borrow a book, he or she must be between the values and superior recommended for the title of the book.

I am trying to create a trigger for new borrowers who try to borrow a book and if they are not in the upper and lower age limits then it is not suitable for them to borrow and will print a message saying: it is not allowed.

I have these tables

Create table borrower (borId varchar2 (5))
borName varchar2 (20).
borAddress varchar2 (20).
Number of borMaxbooks (10),
number of Borage (2),
constraint pk_borId key (borId)) primary;




Create table Publisher (pubId varchar2 (5))
Nom_pub varchar2 (20).
PubAddress varchar2 (20).
constraint pk_pubId key (pubId)) primary;


Create table BookTitle (isbn varchar2 (5))
btName varchar2 (30),
number of yearPublished (4).
pubId varchar2 (5).
number of ageLower (2),
number of ageUpper (2),
Value number (4.2),
constraint pk_isbn primary key (isbn).
constraint fk_pubId foreign key (pubId) references Publisher (pubId));

Create the BookCopy table (bcId varchar2 (5))
ISBN varchar2 (5).
date of dateAcquired,
date of dateDestroyed,
constraint pk_bcId primary key (bcId).
constraint fk_isbn foreign key (isbn) references BookTitle (isbn));

Create table ready (borId varchar2 (5))
bcId varchar2 (5).
dateOut date,
Date payment date.
dateBack date,
primary key constraint pk_loan (borId, bcId, DateOut),
constraint fk_borId foreign key (borId) references Borrower (borId).
constraint fk_bcId foreign key (bcId) references BookCopy (bcId));


Create table Author (authorId varchar2 (5))
authorName varchar2 (20).
constraint pk_authorId key (authorId)) primary;

Create table paternity (authorId varchar2 (5))
ISBN varchar2 (5).
constraint pk_authorship primary key (authorid, isbn).
constraint fk_authorid foreign key (authorid) references Author (authorid),.
constraint fk_isbn2 foreign key (isbn) references bookTitle (isbn));



And it's my trip (I have no experience with the triggers so I know it won't). What is the correct syntax to force a check on the age limit instead of the "UpperAge > Borage < LowerAge" and is the correct one to use here variable ' Count'?

create or replace trigger CheckRecommendedAge
before insert or update on loan
for each line

declare
Number of BorID;
Number of LowerAge;
Number of UpperAge;
Number of Borage;
Ex Exception;


Begin
Select Count (*) in the Borage
Of booktitle, borrower
Borid =: new. Borid;
If LowerAge > Borage < UpperAge then
Dbms_output.put_line ('book borrowed successfully');
On the other
Rossanna ex;
End if;

Exception
When ex then
Raise_application_error(-2000), "borrower". : new. BorID | "Does not fit in terms of age");

Try this trigger, it should work. If syntax errors occur the message here... .new

create or replace trigger CRA
before insert or update on loan
for each row
declare
got_age Borrower.borAge%type;
lower_age BookTitle.ageLower%type;
upper_age BookTitle.ageUpper%type;
cus_exp exception;
begin
select borAge into got_age from Borrower where borId=:new.borId;
select ageLower,ageUpper into lower_age,upper_age from BookTitle where isbn=(select isbn from BookCopy where bcId=:new.bcId);
if got_age>lower_age and got_age

Tags: Database

Similar Questions

  • Search in a table 1 d using a upper/lower limit and recover index

    Was not successful in finding something I could change my goal, so I hope someone else can help. Still a little new to LabView, so some of the more obvious things are always slide past my opinion.

    Long story short, I just need to be able to watch a table 1 d of points (say [0.2222,0.3333 0.4444 0.7777, 0.8888, 0.6666 1.0000], although normally it may be 100-500 points for a long time) and ask whether or not there is a number between a range (say 0.5-0.8) and returns the index of each point that falls within this range to be used for other purposes.

    What could be the most effective way to achieve this?

    Thank you very much!

    Conditional tunnels, one of the pieces of syntactic sugar added to LV in a more pleasant:

    Best LV13 +, but still not too shabby in LV12.

  • Graph waveform control - limit lower and upper limit Autoscale

    The graph is a waveform their a way to define the lower limit of the graph Y to zero and then have it autoscale the Y maximum limit as a percentage of the maximum value of the graph (150% for example)?

    Direction of examples or read about a starting point would be great!

    Thank you

    Joe

    Ireland

    Turn off autoscale and put the max with a property node based on the max of the data table.

  • PXI-6120 HAVE values only show the low limit values

    Hello, I use a PXI-6120 with traditional DAQ driver module screws switch a signal of AI to a PFI channel that allows synchronization of area of OCCUPANCY the AI. In order to measure a single channel of AI with the same set-up, I stopped the criterion VI and tried to see the only measure max. Unfortunately, I opened a task DAQmx, I created for another application, which does not work probably because I have not reset the card after the stop of the VI. Since then, readings of IT are all flat on the lower limit values and the OD has remained at about 0.2 volts any value I write for her. In the meantime, I tried to reset and to recalibrate the device, which worked in DAQ and DAQmx (not the self-calibration in mx). But I have the impression, that the Council has kind of stuck in a State that I can't easily find and/or access. Does anyone have an idea, how can I do a factory reset, or what could be the problem? Greetings! Olli


  • 7410 no option to select the upper/lower case paper tray

    I installed the latest version of the software for XP for my all-in - One 7410, but there is no option to select the lower tray.  It shows that "upper status bar.  In the past, she offered tray tray upper, lower, lower then higher, higher than the lowest, etc.  With the installation later, he seems to have disappeared.  Can anyone offer advice to recover my options (to use the lower tray, for example)?  Thanks in advance.

    Message edited by mmcphie on 06/11/2009 14:22
    Message edited by mmcphie on 06/11/2009 14:23

    Problem solved!  By chance, I stumbled on the solution of the problem in another HP forum.  There is something lacking in the register, and when you add a key word, the issue is resolved immediately.

    I found the solution below Resource Center Forums > multifunction, copier, fax & > multifunction color, then the thread titled paper tray Officejct 7410 by default (as of February 4, 2006).  When I added the registry HPDJEnableSecondTray key as Marshall has suggested, it solved the problem.  As also noted, it seems to be a bug in the software when you reinstall.

    I got lucky stumble on this solution after a few searches on Google and write here for anyone else having a hard time to find.

  • I recently opened firefox and the lower half of the page is filled with directions to Custom Search Menu Wizard

    I recently opened firefox and the lower half of the page is filled with directions to Custom Search Menu Wizard tried everything and cannot figure out how to get it out. With the help of 3.6.26 version. The status bar is just above Directions, I tried closing all toolbars and nothing gets rid of it. Help, please

    It seems that a recent update of Fast Video Download (with SearchMenu) 4.1.5 broke the version of Firefox 3.6 on their module. You can upgrade to the latest version of Firefox to:

    http://www.Mozilla.org/Firefox

    https://support.Mozilla.org/en-us/questions/915364

    https://support.Mozilla.org/en-us/questions/915355

  • Touchpad does not scroll and the lower bar disappears on Satellite Pro L

    Hi, as I said just on the laptop as usual, but for some reason now the Touchpad will not Parade (but work the touch to click). And the lower bar disappears only when I'm on the internet chrome (chrome on his party, but still there on internet explore, but who wants to use the Explorer! lol).

    It makes it so difficult to click between the research and writing! It is still there as it should be on doc word, excel etc.

    Little things, but super boring and I don't understand why change, or how they're connected. Hold fixed, its so stupid he would change just on me.

    Any help is very appreciated!
    Thank you, Jenna

    Hello

    The touchpad settings can be changed in Control Panel-> mouse
    Here, you will have to go to the last tab advanced and click on the Advanced button.

    You should now get a menu with all the options available for touchpad.
    It should be an option called use scroll function. This should be checked/enabled.

    Check it!

  • I am running Windows Vista and a low disk space error message.

    I am running Windows Vista and a low disk space error message.  I ran disk cleanup, disk defragmentation and cleaned up all the old files and still only have 793 MB free on GB total 103.  I noticed that my 6.0.6002.18005_001c11ba_blobs.bin file takes 54.9 GB of space.  In research, it seems that it is safe to delete this file--is that true?  If so, how? It seems that I need permission to do this.

    To give the control is a two-step process. Take ownership and then to give permissions.

    Owner of a file allows the owner to change permissions even if they do not have the authorization to do so. It's the only thing that made property. The person who creates an object owns the object. For admins, the objects that are created are the property of administrators, not the individual.

    You need start exploring as administrator to Start - All Programs - Accessories - made Windows Explorer right click and choose run as administrator.

    You must therefore make a right-click folders / drive, you are interested in tick - button Properties - Security - Advanced button - property - Edit - Replace owner on Sub containers and objects tab - select one user-then Ok your way of out.

    Right-click new - folder Properties - Security - Advanced - tab permissions - Edit button - select the account - check the two checkboxes - button - Advanced - Search now button Add button - select your tick - Ok button - total control in the list. OK your way out.

    .
  • error - operation of menu not valid and a lower-level exception occurred in ImportMPEG (importer) how can I fix this?

    When I export a file in Adobe Premiere Pro, I get the error: operation of menu invalid and a lower-level exception occurred in ImportMPEG (importer) how can I fix this?

    I am running Windows 8.1 Pro, Intel Core i7 - 5930K @ 3.50 GHz CPU

    RAM - 16 GB

    Adobe Premiere Pro CC 2015

  • How can I put an upper limit and lower limit on the chart inside a while loop?

    Need some help here. I'm working on a project, I collected data thru OR myDAQ, draw a waveform graph, is possible to add a limit upper and lower the table on waveform? I tried ways but can't seem to work. Any help is appreciated thank you.


  • generate a digital triggering out CH1 (low and high) for the USB-5133

    Hello

    I would like to generate a digital triggering on the USB 5133 CH1, is this possible?  I tried with the PFI 1 successfully but the output is only 3.5 v and I need to 5V, because this trigger signal goes to a box of pulse generates a signal, which is received by the CH0 on the USB-5133. This configuration works on the 5102 OR but because of the treatment, I am obliged to try a new device.

    Channel 0 and 1 are only entries then you will not be able to use them to generate a signal.  All of our products current digitizer that are recommended for new designs use 3.3V CMOS logic levels for PFI lines in output mode.  Your best bet to generate a digital triggering 5V would be to use an external buffer that can accept 3.3V CMOS levels as an input, but is under voltage of 5V.  Here are some that might work for you, but there are many others: http://www.onsemi.com/PowerSolutions/product.do?id=M74VHC1GT126DT1G adding a buffer in line with the trigger signal will add delay, so you will need to ensure that it is acceptable for your application.

    Hope this helps,

    -Matt

  • Value SQL lower and upper

    Hello

    Could someone help me with the below script SQL code.

    TABLE A:

    Column1

    8

    11

    13

    17

    19

    TABLE B:

    Column 1 column 2

    5                  5.2

    10                6.2

    15                7.2

    20                8.2

    Result:

    column 1 column 2 (Interpolation)

    8 5.2+(6.2-5.2)*(8-5)/(10-5)

    11 6.2+(7.2-6.2)*(11-10)/(15-10)

    13 6.2+(7.2-6.2)*(13-10)/(15-10)

    17 7.2+(8.2-7.2)*(17-15)/(20-15)

    19 7.2+(8.2-7.2)*(19-15)/(20-15)

    Thank you

    Hello

    So, each value in the new colonne_1 is like a table separated; in other words, lines with colonne_1 = 360 have no effect on the results for lines that colonne_1 = 216 and vice versa.  Is this fair?

    In this case, add PARTITION BY colonne_1 to all analytical clauses and include colonne_1 in the join condition in the main query, like this:

    WITH got_slope AS

    (

    SELECT column_1, column_2, column_3

    Advance (column_2) OVER ( PARTITION BY colonne_1

    ORDER BY column_2) AS next_2

    (The LEAD (column_3) OVER ( PARTITION BY colonne_1

    ORDER BY column_2)

    -column_3

    ) / ((Column_2) ahead OF ( PARTITION BY colonne_1 )

    ORDER BY column_2

    )

    -column_2

    )                                     AS slope

    OF table_b

    )

    SELECT a.column_1

    a.column_2

    , b.column_3 + ((a.column_2-b.column_2))

    * slope

    ) AS column_3_interpolation

    FROM table_a a

    JOIN got_slope b ON a.column_1 = b.column_1

    AND a.column_2 > = b.column_2

    AND a.column_2< >

    ORDER BY a.column_1 DESC

    a.column_2

    ;

    The rest of the query, it's just that I've posted before (except for the new column names).

  • lack of upper/lower case filters registry cd/DVD

    Missing upper and lower filters in the registry for the DVD.  Computer, he sees but will not read any CD or DVD.  Haven't tried 2 different drives sata and IDE, no chance.  also don't run the Microsoft program go.  His missing files and I need to know where to get them and how to put it.  This seems to be a problem for many people, and after much research, I have yet to find an answer

    Thank you

    Hello

    Do you have all these, or only some? Manual methods often work when the automated
    those who do not. There are also a lot of information on the verification of the register and with Evan and other
    steps.

    Please try the whole process which, often, not always, will solve the problem. Of course if you
    do not use all the methods so that they cannot help.

    --------------------------------------------------------------------------------------------------------

    If you have tried the above methods, you can try a repair Installation which
    will not change the parameters that are in the methods shown previously. So, if you do not
    really tried all these methods carefully then it probably a waste of time. A repair Installation
    can help in some cases, when the previously listed settings are no longer in-game. Repair
    Installation should allow you to maintain the programs and data that are redundant backsups
    always a good idea.

    How to do a repair installation to repair Windows 7
    http://www.SevenForums.com/tutorials/3413-repair-install.html

    I hope this helps.

    Rob Brown - MS MVP - Windows Desktop Experience: Bike - Mark Twain said it right.

  • Convert the data to uppercase (upper/lower case text

    I have data in the field as
    ABERCHROBIE FITCH - like this

    I want to change all the data in the field, as
    Aberchrombie Fitch - first letter should b in the capital and all the remaining letters should be in small.


    Ex:
    FITCH-> Fitch
    Concat (Upper (Left(columname,1)), LOWER (SUBSTRING (columnname OF 2 for LENGTH (columname)))

    ABERCHORMBIE FITCH Aberchrombie - Fitch
    ?

    AMERICAN EAGLE-> American Eagle
    ?
    ....

    can someone help me change the first letter to the capital and the remaining letters to small

    Published by: user12255470 on October 18, 2010 18:49

    user12255470,

    under fx, apply the formula: LOWER (your column)---> the result which is "abercrombie fitch.
    now go to "Properties of the column" and select "additional formatting" options > check "Use CSS Custom Style" & put the style according to

    text-transform: capitalize;

    If the answer points please :-)

    -bifacts
    http://www.obinotes.com

  • Upper/lower case issue of incompatibility in the selection of a line

    I'm new to APEX and am sure that it is easy to answer.

    I have a report and form. On the report screen, I have a textitem called P1_JOB_NAME that contains the JOB_NAME value returned by a SQL select statement. The JOB_NAME values return table in cases, upper and lower. In order to have the sorting of columns P1_JOB_NAME correctly on the report screen, I added the UPPER() function to the select SQL to force uppercase values and sorting has been corrected.

    However, for this reason, when I try to edit a record, I get an error NO DATA FOUND because the value of P1_JOB_NAME is now capitalized and the data in the table are lowercase. What is the simplest fix for this problem?

    Thank you

    Jason

    Hi Jason,

    For 10 points... I'll post again ;)

    Glad I could help you!

    Concerning

    Roel

Maybe you are looking for