Results 1 to 6 of 6

Thread: PL/SQL trigger

  1. #1
    Join Date
    Oct 2012
    Posts
    3

    Unanswered: PL/SQL trigger

    I want to compare two values in PL/SQL.

    When I add a student into a class I want to track the number of students. So it increments by one per record.

    And if the number of students exceeds the number of max room capacity then I want to display a message.
    Last edited by hondaEk; 10-31-12 at 09:43.

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >then I want to display a message.

    2 or 3 tier application?
    post results from following SQL

    SELECT * FROM V$VERSION;
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Oct 2012
    Posts
    3
    Quote Originally Posted by anacedent View Post
    >then I want to display a message.

    2 or 3 tier application?
    post results from following SQL

    SELECT * FROM V$VERSION;
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE 11.2.0.1.0 Production
    TNS for 64-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production

  4. #4
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    This is part of hondaEk's e-mail I received (sorry, I can't solve your (or anyone else's) problems via e-mail messages). Generally speaking: you'll get help sooner if you post what you have to say here, rather than waiting for someone to answer the mail.

    Quote Originally Posted by hondaEk, slightly modified as he requested it so
    Code:
    IF (vCount = 7 ) THEN ...
    But my issue now is that I hardcoded the "7" which is meant to be the real number of seats from some table.
    Create another variable and select number of seats from "some" table into it. Then - in the IF statement - compare vCount with number of seats.

    P.S. After the PM I received: it is not that I don't WANT to help; I just thought that description should be enough for you to find the way out. Or, did you expect me to write a trigger for you?
    Last edited by Littlefoot; 11-01-12 at 07:49. Reason: hondaEk was concerned that his teacher might find this discussion, so I modified some words.

  5. #5
    Join Date
    Oct 2012
    Posts
    3
    Quote Originally Posted by Littlefoot View Post
    This is part of hondaEk's e-mail I received (sorry, I can't solve your (or anyone else's) problems via e-mail messages). Generally speaking: you'll get help sooner if you post what you have to say here, rather than waiting for someone to answer the mail.


    Create another variable and select number of seats from "some" table into it. Then - in the IF statement - compare vCount with number of seats.

    P.S. After the PM I received: it is not that I don't WANT to help; I just thought that description should be enough for you to find the way out. Or, did you expect me to write a trigger for you?
    I actually took a wrong approach to answering the question. I think the best way for me is to increment an attribute by 1 when a new record is created. Then do some sort of query to get the max capacity and compare it with a specific student which will require another query (i think).

    The hard part I'm having troubles now is to do the WHERE condition. I think I need something like WHERE new:=variable = variable but to be honest I don't know what it really does. Currently researching and what not-

  6. #6
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •