Home > Ask the Oracle Experts > (Archive) Oracle Applications Questions & Answers > Transfering a table on date change
Ask The Oracle Expert: Questions & Answers
EMAIL THIS

Transfering a table on date change

Carol Francum EXPERT RESPONSE FROM: Carol Francum

Pose a Question
Other Oracle Categories
Meet all Oracle Experts
Become an Expert for this site


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


>
QUESTION POSED ON: 21 January 2004
How do I transfer a record from one table to another on the system date change? Should I use triggers? If yes, how?

>
EXPERT RESPONSE
A trigger is a piece of code that fires on a given event. Triggers can be based at the system level, on a table or, in 8i and 9i, on a specific column within a table. You say you want the trigger to initiate on the change of system date, and transfer records from one table to another. Triggers normally operate on events like inserting, updating or deleting information in a column, row or table. Changing the date across the system does not qualify as that kind of event.

I think you would be better off to write a stored procedure in PL/SQL, and use another mechanism to start the procedure based on system time. The DBMS_JOB package in PL/SQL is designed to do what you appear to want. It allows a user to schedule a job to run at a specific time, or specific intervals. A job consists of PL/SQL code (ie, a stored procedure). The user also indicates via job parameter how often the code should be run.

The following example shows how to schedule a job to execute at midnight every night:

DBMS_JOB.SUBMIT (:v_jobnum, 'my_procedure;', trunc(sysdate) + 1, 'sysdate + 1');

The 'trunc(sysdate) + 1' se>ts the time back to the current day, midnight and informs the scheduler to start the job at the following midnight. The 'sysdate + 1' sets the interval to 1 day. This job would run the first time at midnight, then every midnight afterwards.

To schedule the job at 8 a.m., specify the next_date parameter as trunc(sysdate) + 1 + 8/24.

You may want to examine the following Notes on Oracle MetaLink:
Note 61730.1 Using the DBMS_JOB Package details how to use this package when scheduling a job.

Note 1068369.6 Example: Using DBMS_JOB.SUBMIT to Execute Jobs at Regular Intervals details examples of using the DBMS_JOB.SUBMIT.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
Oracle E-Business Suite
Oracle's Fusion Applications: Way behind or right on track?
Oracle OpenWorld 2008 Special Report
Special report: Collaborate '08
Oracle forced migration fears a matter of education, OAUG says
Oracle password best practices
The E-Business Suite user's guide to Oracle OpenWorld 2007
Oracle OpenWorld 2007 Special Report
Oracle buys GRC firm LogicalApps
SunGard challenges Oracle in public sector
Millipore swaps out SAP for Oracle

(Archive) Oracle Applications
Implementing Financials 11i on one box and adding another later
Determining which table was just modified
Identifying patch prerequisites
Assertion error when running Forms 6.0
Avoid changing size of ACS segments
Data points in Discoverer
Why there are fewer primary keys/foreign keys in Oracle Apps
Moving Oracle Apps 11.0 from Unix to another platform
Using a single box for Oracle Financials
Adding flexfield to standard form

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



Oracle White Papers: Fusion Middleware
HomeNewsTopicsTipsAsk the ExpertsMultimediaWhite PapersProductsBlogs
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2003 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts