简体   繁体   中英

Executing plsql code every few minutes in oracle apex

Hi I'm currently designing an application that needs to save people longitude and latitude but I'm having trouble figuring out how to refresh the longitude and latitude every few minutes as well as updating the database and writing the persons new latitude and longitude into my database table.

Edit:

I created a procedure as follows:

Create or replace procedure Ins_Location 
    (P_IMU_ID IN Number,
    P_IMUL_LATITUDE IN NUMBER,
    P_IMUL_LONGITUDE IN NUMBER)
is
begin
    insert into i_mobile_user_locations
        (IMU_ID,
        IMUL_LATITUDE,
        IMUL_LONGITUDE)
        VALUES
            (P_IMU_ID,
            P_IMUL_LATITUDE,
            P_IMUL_LONGITUDE);
end;

and then i created a process that would start the job as follows:

Begin
    DBMS_SCHEDULER.CREATE_JOB(
        job_name        => 'ins_location',
        job_type        => 'STORED_PROCEDURE',
        job_action      => 'BEGIN Ins_Location(:GLOBAL_ID,:P1_LAT,:P1_LNG); END;',
        start_Date      => systimestamp,
        repeat_interval => 'freq = minutely; interval = 5',
        enabled         => true,
        comments        => 'My Location insert'
    );
end;

But every time i try to execute the process it gives me this error: ORA-27452: "BEGIN Ins_Location(:GLOBAL_ID,:P1_LAT,:P1_LNG); END;" is an invalid name for a database object.

If you're on version 20.2 of apex, you can use the feature "Automations" for this. It is then implementation of DBMS_SCHEDULER within apex, which is very easy to use and has many out of the box features.

If you have to do something periodically , then use DBMS_SCHEDULER package - it is designed for such a purpose. It will - in your case - call a stored procedure which contains PL/SQL code you mentioned.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM