Henry
Henry

Reputation: 13

Convert DBMS_SCHEDULER.CREATE_JOB in Oracle to PostgreSQL

I'm converting DBMS_SCHEDULER.CREATE_JOB in Oracle SQL to PostgreSQL. I can't find it like Oracle in PostgreSQL. Can anyone help me to resolve this?

DBMS_SCHEDULER.CREATE_JOB(   
                          JOB_NAME   => CONCAT('ANALYZE_',my Column,'_',my Column), 
                          JOB_TYPE   => 'PLSQL_BLOCK', 
                          JOB_ACTION => my Column, 
                          ENABLED    => TRUE, 
                          COMMENTS   => CONCAT('ANALYZE_',my Column) 
                         ); 

Upvotes: 0

Views: 1000

Answers (1)

Justin Cave
Justin Cave

Reputation: 231661

PostgreSQL doesn't have a built-in scheduler. You can schedule jobs using the operating system's built-in scheduler. Or you can install pgAgent and use that to schedule jobs. Or you could use any number of third-party job scheduling tools.

I'm not completely sure what your job is doing here-- you say the job_action is "my column" which implies that the column in the table contains a PL/SQL block but that seems weird if "my column" is also used to create the job_name. I'd guess that whatever solution you go with will need to include a bit of additional plumbing in PostgreSQL. For example, rather than creating the job, perhaps you write a row to a table and then have a separate job that goes through that table and actually takes the appropriate action.

Upvotes: 3

Related Questions