Reputation: 3
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.
Upvotes: 0
Views: 690
Reputation: 18685
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.
Upvotes: 1
Reputation: 142798
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.
Upvotes: 0