Dealing with time-keeping and changing entries

Hi everyone, I'm working on a project for school, and I have to develop a database that works somewhat like eBay. Only instead of auctions users create and place bets.
My question is, how would I go about implementing some sort of function that will allow me to change the status of a table entry once its BetTime (or in the case of eBay, Bid Life) ends?
an example of this would be:
BetID BetCreationTime BetEndTime Status
000 12:00 BetCreationTime + 5 hours OPEN
001 3:00 BetCreationTime + 8 hours OPEN
5 hours after Bet 000 is created (5:00), it must change status to CLOSED. The same goes for bet 001 8 hours after it is created (at 11:00)

Have a play with this Example in SQL and PL/SQL. Note that I do not want to store my STATUS because I need to get it at runtime.
SQL> CREATE TABLE BET
2 (BetID NUMBER(10)
3 ,BetCreationTime DATE
4 ,BetEndTime DATE)
5 /
Table created.
SQL> INSERT INTO BET VALUES (100,sysdate,sysdate+5)
2 /
1 row created.
SQL> INSERT INTO BET VALUES (101,sysdate,sysdate+7)
2 /
1 row created.
SQL> INSERT INTO BET VALUES (102,sysdate,sysdate-1)
2 /
1 row created.
SQL> commit;
Commit complete.
SQL> SELECT BetID
2 ,TO_CHAR(BetCreationTime,'DD-MON-YYYY HH24:MI:SS') Starting
3 ,TO_CHAR(BetEndTime,'DD-MON-YYYY HH24:MI:SS') Ending
4 ,round(BetEndTime-SYSDATE) "Remaining(Days)"
5 FROM BET;
BETID STARTING ENDING Remaining(Days)
100 01-NOV-2005 18:33:32 06-NOV-2005 18:33:32 5
101 01-NOV-2005 18:33:32 08-NOV-2005 18:33:32 7
102 01-NOV-2005 18:33:33 31-OCT-2005 18:33:33 -1
SQL> SET VERIFY OFF
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
2 BET_REMAIN NUMBER(10);
3 BET_STATUS VARCHAR(10);
4 BET_ENDDATE VARCHAR(11);
5 BET_ENDTIME VARCHAR(10);
6 BEGIN
7 SELECT round(BetEndTime-SYSDATE)
8 ,TO_CHAR(BetEndTime,'DD-MON-YYYY')
9 ,TO_CHAR(BetEndTime,'HH24:MI:SS')
10 INTO BET_REMAIN,BET_ENDDATE,BET_ENDTIME
11 FROM BET
12 WHERE BETID=&BETID;
13
14 IF BET_REMAIN <= 0
15 THEN
16 BET_STATUS := 'CLOSED';
17 DBMS_OUTPUT.PUT_LINE('This Bet is Closed on '||BET_ENDDATE||' at '||BET_ENDTIME);
18 ELSE
19 BET_STATUS := 'OPEN';
20 DBMS_OUTPUT.PUT_LINE('This Bet is Open for another '||BET_REMAIN||' Days Untill '||BET_ENDDATE||' at '||BET_ENDTIME);
21 END IF;
22
23 EXCEPTION WHEN NO_DATA_FOUND
24 THEN
25 DBMS_OUTPUT.PUT_LINE('This Bet does not Exist');
26 END;
27 /
Enter value for betid: 100
This Bet is Open for another 5 Days Untill 06-NOV-2005 at 18:33:32
PL/SQL procedure successfully completed.
SQL> /
Enter value for betid: 101
This Bet is Open for another 7 Days Untill 08-NOV-2005 at 18:33:32
PL/SQL procedure successfully completed.
SQL> /
Enter value for betid: 102
This Bet is Closed on 31-OCT-2005 at 18:33:33
PL/SQL procedure successfully completed.
SQL> /
Enter value for betid: 103
This Bet does not Exist
PL/SQL procedure successfully completed.
SQL>

Similar Messages

  • Has anyone had had success with Time Machine and Airport Express 6th gen?

    For the last six months I have attempted to use the Time Machine product to provide first level backup for my two MacBook Airs and iMac.  Tryed a number of powered USB drives, tryed all of the current 10.8, 10.9 OSX software.  The Time Machine product seems to work for about a month to six weeks and then fails with message about the file integrity or access problems.  In all cases I can acess files on the drive and the only application that struugles with the AE usb drive is Time Machine.
    You would think that if it works for a month it should work for a year?
    I have purchased Carbon Copy Cloner and it seems to function without a problem and I think that I am probably better off with a once a day clone than a Time Machine with data integrity problems.
    Has anyone had long term success with Time Machine and AE sixth gen?

    You are connecting a USB hard disk to the new 802.11ac AirPort Extreme, not an Express, correct? If so, it works fine with both bus powered and self-powered drive enclosures, and I have no immediate explanation for what's going on.
    You would think that if it works for a month it should work for a year?
    Yes, besides the passage of time the only thing that is changing is the amount of available space on the backup volume, which could be a factor. Are you using separate drives for each Mac, or are they all being backed up to the same drive? If it's only one drive, is it partitioned or are they all sharing a single partition?
    Are you sharing backup volumes with other, non-Time Machine files? That shouldn't cause the problem, but it's not a good idea. 
    What errors are being logged in system.log? Filter for backupd to find all Time-Machine related entries.

  • How do i run an external monitor with my macbook and change settings so that when i close the lid the signal to the monitor is not lost and i can continue using the mac with a mouse and a wireless keyboard?

    How do i run an external monitor with my macbook and change settings so that when i close the lid the signal to the monitor is not lost and i can continue using the mac with a mouse and a wireless keyboard?

    No, nothing will prevent the computer from going to sleep when you close its display except third-party hacks that are designed to do exactly that. I strongly advise against using any of those, as they may interfere with successful entry into clamshell mode (and they carry other downside risks as well). Just wait until the computer is asleep (with its sleep light pulsing), then press any key on the keyboard. It sounds as though your setup is working as it's designed to do.

  • I need to reinstall my computer, how do I deal with Premiere pro and After effects?

    Hello,
    As my question states I need to reinstall my computer (laptop) and I'm not quite sure on how to deal with Premiere pro and After effects.
    I am thinking that I need to do some sort of backup and save my projects and footage on a sepparate drive.
    If I reinstall my computer, install my creative suit production premium, and move back all of my projects and footage, won't I have to re-link every single clip?
    I am currently workning on several different projects and having to re-link everything is something I don't even want to think about, that would take me days if not weeks.
    Another option on my mind would be to use Creative cloud. I do have the free version but I have never used it even once before and I'm not quite sure what the purpose of the cloud is and if this is a way to use it.
    I have no idea how to go about this computer reinstalation without either loosing tons of work or having to re-link every single clip used.
    I am videoediting only as a hobby so I have no experience working with other people and sharing projects or the like, wich is my understanding of what the cloud is for.
    Any and all help would be grealty appreciated, I know this is probably really easy but ever since i got my Suit I haven't reinstalled, upgraded och changed my computer so I am just clueless as to how to go about this.
    I have Creative suit production premium, I also have the free Creative cloud.
    It is only Premiere pro and After effects that I am using and am worried about.
    Thank you for any help.
    -Lisa Kajupank
    (and oh, I just notice my name - umustbejoking - I think I just wrote that cause they wouldn't let me use anything else, saying it was already taken. So nevermind that haha.)
    Message was edited by: umustbejoking

    If the computer's running Mac OS X, move the cursor to the very top of the computer's screen, click on Store, and choose Authorize this Computer.
    If the computer's running Windows, press the Alt and S keys and choose Authorize this Computer, or click here, follow the instructions, click on Store in the menu bar, and choose Authorize this Computer.
    (84620)

  • Backing up Mac HD with Time Capsule AND an external hard drive

    I am sure that this question has been asked one way or another but I can't seem to find the exact answer.
    I would like to back up my Mac HD with the Time Capsule AND another hard drive essentially to create two backups. Should one fail, I still have another copy as a precaution. The Time Capsule will be my primary back up because my external hard drive is usually switched off and will only be turned on from time to time to perform "less frequent" backups.
    With Time Capsule AND the external hard drive on, will Time Machine just update the backup on the external hard drive without becoming confused with the other copy on Time Capsule? In other words, can Time Machine distinguish between two different Time Machine Backup files and bring them up to date accordingly?
    I understand there is an archive function on the Time Capsule, which would also serve the purpose. However, I am wondering if there is another way.
    Thanks.

    Rheopaipo wrote:
    I am sure that this question has been asked one way or another but I can't seem to find the exact answer.
    I would like to back up my Mac HD with the Time Capsule AND another hard drive essentially to create two backups. Should one fail, I still have another copy as a precaution. The Time Capsule will be my primary back up because my external hard drive is usually switched off and will only be turned on from time to time to perform "less frequent" backups.
    With Time Capsule AND the external hard drive on, will Time Machine just update the backup on the external hard drive without becoming confused with the other copy on Time Capsule? In other words, can Time Machine distinguish between two different Time Machine Backup files and bring them up to date accordingly?
    I understand there is an archive function on the Time Capsule, which would also serve the purpose. However, I am wondering if there is another way.
    I don't think it's possible to configure Time Machine to back up to two locations without modifying its settings frequently.
    You might consider using that external drive to hold a bootable backup. You can create such a thing with either of the utilities SuperDuper! or Carbon Copy Cloner. If you pay the registration fee for SuperDuper! (~US$28), there's a mode where it will back up only what has changed, which makes the backup operation run quicker. (Carbon Copy Cloner may offer a similar feature.)

  • I have a mid 2010 Macbook Pro running Snow Leopard and foolishly upgraded to Yosemite.  Is it possible to go back in time with Time Machine and reinstall Snow Leopard.  Then upgrade to Lion or Mavericks?  Any other ideas on how I can exit Yosemite?

    I have a mid 2010 Macbook Pro running Snow Leopard and foolishly upgraded to Yosemite. Now have numerous problems.  Is it possible to go back in time with Time Machine and reinstall Snow Leopard?  Then upgrade to Lion or Mavericks?  Any other ideas on how I can exit Yosemite?

    Once you get yourself back to Snow Leopard, if you still want to upgrade somewhat, I would suggest the following:
    1. Get an external hard drive that you can use for experiments with new OS versions. You could partition it into 2 or 3 partitions. You could then clone your existing Snow Leopard system to one partition using Carbon Copy Cloner (well worth $40) or SuperDuper ($25).
    2. Buy OS X Mountain Lion for $20, through the Apple online store (I don't think it's available through the App Store). Apple has decided to make it very difficult for anyone to get Mavericks unless they have already downloaded it.
    You will receive two e-mails from Apple, one containing a PDF with a redemption code, and one with the password you will need to unlock the PDF. Using the code, you will download Mountain Lion from the App Store, where it will appear among your Purchased items.
    After ML finishes downloading, its installer app will launch itself. When you see this launch screen, QUIT the install app immediately! Go to your applications folder, find the Install OS X Mountain Lion app, and copy it to a safe location outside of your Applications folder. Keeping one or more copies will allow you to reinstall without unnecessary aggravation if you later need or want to do that. At this point, you can re-launch the Installer in the Applications folder and let it run. You can install it on a clean partition on your external HD, or you can allow it to upgrade the Snow Leopard clone you created on your external drive, or you can do both. This should allow you to test how everything works for as long as you like.
    3. If you left yourself a free partition on your test drive, try a clean install of Yosemite and set everything up from scratch (do not migrate anything). This will allow you to see whether your problems with it were related to something in your Snow Leopard system.

  • Just moved to new home, updated router and new system with Time Warner and now we cannot get the appl

    just moved to new home, updated router and new system with Time Warner and now we cannot get the apple any ideas?

    Castle15 wrote:
    just moved to new home, updated router and new system with Time Warner and now we cannot get the apple any ideas?
    Cannot get the Apple.. what?
    Model and actual device you are talking about?
    Apple covers a pretty huge range.. If you mean extreme.. did you reset it to factory and start over.. that is always necessary when you change a network. You cannot pick up a router from one home and network and plonk it into another and have it work.. aint gonna happen.
    You also need to power down any pure cable modem for 20min or so to get it to forget the old MAC address that captured the IP so the Apple ??? has a chance to work.

  • Partitioning an External 320gb drive for use with Time Machine and...

    I want to be able to use my Western Digital 320GB external drive for use with Time Machine and to use as extra storage space on both my Mac and when I boot into Windows Vista.
    Is this possible?
    I was playing around in Disk Utility and would I partition the part I want to use for Time Machine with the Mac OS Journaled, and whatever I want as space for windows, use a MS - DOS format?
    Has anyone done this before?
    Cheers-

    Unless you are using 64 bit version of MSWindows (64 bit XP/Vista), it won't be able to handle a disk with GUID partition table (GPT). Disks with Apple Partition Map (APM) or GUID partition table are the only ones that Time Machine will work with (not MBR disks). Note also that the MBR/APM/GPT are at the DISK level and not the partition level, so don't mix the format with partitioning scheme. Time Machine disks are meant to live in the Mac universe (for now, anyway) and sharing with the MSWindows 32-bit universe is not possible.
    See http://img87.imageshack.us/my.php?image=macpcdiskdd06sv8.png for some additional background.

  • HT1338 problems with time  machine and parallels desktop,  mac osx mountain lion 10.8

    have a good day, i have been problems with time  machine and parallels desktop, dont work in mac osx 10.8, i upgrate two mac´s (macbook air, imac), in the two machines shows problems, could you help me please.
    two machines have good ram memory (macbook air 11.1 2010 early , imac 2009 late).
    i am waiting for your help.
    thanks.
    Jesus.

    Take a look here:
    http://pondini.org/TM/Troubleshooting.html
    Specifically, you'll probably want to try item #A5 on that page, but there's a lot of other info there that may be useful.

  • My start up disc is full i have a macbook air, i back everuthing up with time capsule and  have movies all my music libraries and photos onto that too so as i have free space, but my max still says my startup disc is full with "other"

    my start up disc is full i have a macbook air, i back everuthing up with time capsule and  have movies all my music libraries and photos onto that too so as i have free space, but my max still says my startup disc is full with "other"

    First, empty the Trash if you haven't already done so. Then reboot. That will temporarily free up some space.
    According to Apple documentation, you need at least 9 GB of available space on the startup volume (as shown in the Finder Info window) for normal operation. You also need enough space left over to allow for growth of your data. There is little or no performance advantage to having more available space than the minimum Apple recommends. Available storage space that you'll never use is wasted space.
    If you're using Time Machine to back up a portable Mac, some of the available space will be used to make local snapshots, which are backup copies of files you've recently deleted. The space occupied by local snapshots is reported as available by the Finder, and should be considered as such. In the Storage display of System Information, local snapshots are shown as "Backups." The snapshots are automatically deleted when they expire or when free space falls below a certain level. You ordinarily don't need to, and should not, delete local snapshots yourself.
    To locate large files, you can use Spotlight as described here. That method may not find large folders that contain a lot of small files.
    You can also use a tool such as OmniDiskSweeper (ODS) to explore your volume and find out what's taking up the space. You can delete files with it, but don't do that unless you're sure that you know what you're deleting and that all data is safely backed up. That means you have multiple backups, not just one.
    Proceed further only if the problem hasn't been solved.
    ODS can't see the whole filesystem when you run it just by double-clicking; it only sees files that you have permission to read. To see everything, you have to run it as root.
    Back up all data now.
    Install ODS in the Applications folder as usual.
    Triple-click the line of text below to select it, then copy the selected text to the Clipboard (command-C):sudo /Applications/OmniDiskSweeper.app/Contents/MacOS/OmniDiskSweeper
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window (command-V). You'll be prompted for your login password, which won't be displayed when you type it. You may get a one-time warning not to screw up. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator.
    I don't recommend that you make a habit of doing this. Don't delete anything while running ODS as root. If something needs to be deleted, make sure you know what it is and how it got there, and then delete it by other, safer, means.
    When you're done with ODS, quit it and also quit Terminal.

  • Recently my MacBookPro locked up on startup. Could not get past a certain point of progress bar. I had upgraded to Yosemite few weeks back, with no issues. I ended up doing a Recovery with Time Machine and I got all my apps, photos, documents, etc. back o

    Recently my MacBookPro locked up on startup. Could not get past a certain point of progress bar. I had upgraded to Yosemite few weeks back, with no issues. I ended up doing a Recovery with Time Machine and I got all my apps, photos, documents, etc. back okay --- except I got error messages that my "registration for Photoshop (I use CS4 Extended) and Photo Mechanic are no longer working".  I worked on Photoshop first, and tried (several times) to fix it with their online help suggestions.  Nothing worked.
    Is there a simpler way to "get my licenses/registrations back"???  I am also going to contact Camera Bits about the Photo Mechanic issues.   Thanks

    Same problem and for months now. I haven't been able to find a solution, but I suspect that's because I don't know exactly what's wrong.

  • Help with Time Evaluation and function exit (HRPTIM03 / SAPLHRLV_001)

    Hello,
    Hopefully someone can help me with an issue I am having with time evaluation and a user exit I wrote.  The code for my exit is at the end of this post.  IN DEV and QAS, everything works.  However, in PRD, multiple rules are considered fulfilled (when looking in PT60), and so employees get two sets of vacation entitlements per month.
    We have three rules for quota type 03 (vacation).  Rules 3,6, and 9.  Only rule 9 should apply to the individuals with the two job numbers in the code.
    Any help would be greatly appreciated.
    Shane
    WHEN ABSENCE QUOTA TYPE IS 3 (VACATION)
    CASE XT559L-QTYPE.
    WHEN '3'.
    CASE - COMPARE SELECTION RULE FOR ABSENCE QUOTA TYPES
      CASE XT559L-ACCNR.
    WHEN RULE SELECTED IS 009
        WHEN '9'.
        IF JOB NUMBER IS 5084 OR 3084, THEN THE RULE APPLIES
          IF XP0001-STELL = '5084' OR XP0001-STELL = '3084'.
            XSUBRC = '0'.
        OTHERWISE, THE RULE DOES NOT APPLY
          ELSE.
            XSUBRC = '1'.
          ENDIF.
    WHEN ANY OTHER RULE IS SELECTED
        WHEN OTHERS.
        IF JOB NUMBER IS 5084 OR 3084, THEN THE RULE DOES NOT APPLY
          IF XP0001-STELL = '5084' OR XP0001-STELL = '3084'.
            XSUBRC = '1'.
        OTHERWISE, THE RULE APPLIES NORMALLY
          ELSE.
            XSUBRC = '0'.
          ENDIF.
      ENDCASE.
    WHEN OTHERS.
    ENDCASE.

    The problem was that even though the code was transported to PRD, and listed as Active - it still was not activated, and had to manually be done though CMOD.

  • Capitalization doesn't work as described. One can start with lower case and change to upper, but changing from upper case to any of the other options doesn't work. Is there a way around this or is this just a glitch that needs fixing?

    In Pages capitalization doesn't work as described. One can start with lower case and change to upper, but changing from upper case to any of the other options doesn't work. Is there a way around this or is this just a glitch that needs fixing?

    I think it does work as described, but the description is not very complete. Capitalization does not change any of the characters that you type; what it does is allow some of the lower case characters to display as capitals. If you copy the result and paste it as plain text, you'll see that the lower case characters are still there. It doesn't actually say anywhere that it can make capitals display as lower case, and it can't.
    The obvious way around this is to actually type what you want.
    The more powerful way is to install WordService from Devon Technologies which adds the functionality of Pages' capitalization menu as well a lot of other ones. WordService actually changes the character to the one displayed, and it works in most of the applications on your Mac.

  • Can I backup with Time machine and continue to use my mac?

    Hi I backed up my complete system with time machine and left the system alone. My question is when I do future backups can I continue to use the computer whilst the backup is happening or should I leave it alone whilst the backup is happening?
    Thanks!

    The automatic backups aren't nearly as noticeable as the initial backup. Time Machine is designed to do its thing politely in the background while you use your computer. I rarely even notice it. However, if you are using resource intensive apps you might want to turn off Time Machine in System Preferences until your are finished so your apps have access to all available horsepower.

  • How to deal with Physical Inv and Q stock

    Hi,
    Can someone help me with the following query
    How to deal with Physical Inv and Q stock

    Hi,
    The process remains the same. However when you create the PID ensure that it gets created using st. type as 2 (QI stock).
    Hope that helps.
    Regards,
    Pravin

Maybe you are looking for

  • I can't install CS 5.5 Production Premium on my new iMac. I no longer have the CD's to reinstall. I

    I can't install CS 5.5 Production Premium on my new iMac. I no longer have the CD's to reinstall. I downloaded the software using this link from Adobe http://helpx.adobe.com/creative-suite/kb/cs5-5-product-downloads.html . When I try to put my Serial

  • 101 error - file is downloaded, i see it on my pc but can not open it

    Please, do not send me to this link ; http://helpx.adobe.com/creative-suite/kb/troubleshoot-download-assistant.html as it does not answer any question. I downloaded via assistant the program, Photoshop cs6, I even found it on my computer, not in prog

  • CF 9 in IIS

    Hi, I am trying to install CF9 in windows 2003 server using IIS6, the IIS is not using the defaul webserver folder. They have a domain name configured and inside they have many folders, each for different apps. I want to add a new folder for my CF9 a

  • I cannot import music into itunes

    I use the request "add folder to itunes" but the files do not appear in my library. Neither does the request "add files to itunes". I am using windows and have the newest available version of Itunes. What can I do to successfully import multiple fold

  • Service entry ML81N layout

    Hi Expert, As we know that service entry display (ML81N) consists of column in its line item. Such as short text, gross price, WBS element, cost center, etc. We can configure the layout setting thru the u2018configuration iconu2019 on the upper right