Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Time Activated Functions In SQL

  • 03-04-2006 9:41am
    #1
    Registered Users, Registered Users 2 Posts: 871 ✭✭✭


    I was just wondering if it is possible to create a PL/SQL function that is time activated, eg called at midnight?


Comments

  • Moderators, Politics Moderators Posts: 41,240 Mod ✭✭✭✭Seth Brundle


    You mean a stored procedure.
    What version of Oracle?
    What OS?
    You can do this inside the enterprise manager (or via a script)

    Also read
    http://www.geekinterview.com/question_details/16884
    http://sybernet.sri.com/sybase/procedures/SP_HTML_CRON_REGISTER.html


  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey


    time activated functions

    I believe they're more commonly called Jobs ;)

    DBMS_JOB is most-likely what you're looking to play with here. One tip: Make sure job_queue_processes / job_queue_interval are set up in init.ora. These parameters are version dependant (interval is for 8 & 8i only, IIRC).

    You could use OS-dependant scheduling systems like cron in *nix, but DBMS_JOB avoids many potential issues that external schedulers can run into.

    jc


  • Registered Users, Registered Users 2 Posts: 871 ✭✭✭gerTheGreat


    OK, so i've gotten this far. I've created this function, but it's apparently containing an error, can anyone see the problem?

    CREATE OR REPLACE FUNCTION AGE (BIRTH_DATE in DATE)
    RETURN NUMBER IS
    AGE NUMBER;
    BEGIN
    AGE := TRUNC(MOUNTHS_BETWEEN(SYSDATE, BIRTH_DATE)/12.0);
    RETURN AGE;
    END;


    (P.S. thanks kbannon and bonkey, I'm not totally sure if i have the admin access to do that but I'll give it a shot once I get the function working)


  • Moderators, Politics Moderators Posts: 41,240 Mod ✭✭✭✭Seth Brundle


    Im kind of surprised that you are running a function at a certain time. Where is the returned value going?

    edit: I presume you haven't compiled that finction yet given the typos in it.


Advertisement