Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9054069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:35:21+00:00 2026-06-16T13:35:21+00:00

Possible Duplicate: Trigger based on sysdate 1.I have a table on which i have

  • 0

Possible Duplicate:
Trigger based on sysdate

1.I have a table on which i have to perform update operations everyday at 12:00(24 Hr. Format).

How should I accomplish this?

Table Schema:

CREATE TABLE CHARGES   
(
    total NUMBER(30),
    admitdate TIMESTAMP(6),
    dischargedate TIMESTAMP(30)
)

Update Algorithm:

if 
{
   dischargedate="null" 
   then total=admitdate-sysdate=difference in days * Total
   Do this every day at 12:00(24 Hr. Format)
}
else
{  
  do nothing.    
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T13:35:23+00:00Added an answer on June 16, 2026 at 1:35 pm

    The standard to run a job every 24 hours would be to run a job at this interval using the system package DBMS_SCHEDULER.

    For instance:

    BEGIN
      DBMS_SCHEDULER.create_job (
        job_name        => 'update_charges',
        job_type        => 'PLSQL_BLOCK',
        job_action      => 'BEGIN my_procedure; END;',
        start_date      => TRUNC(SYSDATE) + 0.5,
        repeat_interval => 'freq=daily;',
        end_date        => NULL,
        enabled         => TRUE,
        comments        => 'Update the discharged date in charges.');
    END;
    /
    

    You then create a procedure to run:

    create or replace PROCEDURE my_procedure is
    
    begin
    
      update charges
         set total = admitdate - sysdate
       where dischargedate is null;
    
    end;
    /
    

    This would update the column total to be the number of days between the admitdate and SYSDATE.

    However, I question the need to do this at all. It sounds very much like the age-old “Should I store Age” question. I believe the answer is no. You are absolutely bound to be wrong at some point and there are a number of possibilities that might cause the job to be manually run incorrectly. I would calculate this column on the fly as you extract data from the database.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Throw an error in a MySQL trigger I have a table definition
Possible Duplicate: trigger an event when contenteditable is changed I have a table on
Possible Duplicate: jquery trigger - ‘change’ function I have a radio button set called
Possible Duplicate: mysql getting last_insert_id() in a trigger I have MySQL TRIGGER firing AFTER
Possible Duplicate: Trigger Heap Dump of a 1.5 JVM running on Windows I have
I have the following insert trigger, which is essentially writing a duplicate row from
Possible Duplicate: Jquery trigger file input I'm working on a form which allows users
Possible Duplicate: How do you trigger javascript functions from flash? Possible Duplicate: How do
Possible Duplicate: A non-nested animation sequence in jQuery? I have an html/css/js iOS app
Possible Duplicate: Notification when WPF UI closes I have asked a very similar question

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.