I have a procedure which is being called at server side and I need to make it asynchronous.
So I have created another proc in which I'll create Oracle'Job and this will call that proc in its job_action. Proc is:
PROCEDURE upload_csv_file_data(a_what_to_do IN VARCHAR2,
a_logon_user IN VARCHAR2,
a_csv_data IN CLOB)
IS
v_job_action VARCHAR2(32676);
/*v_log_error VARCHAR2(32676);*/
v_job_name VARCHAR2(100);
BEGIN
v_job_action := 'process_csv_file_data(''' || a_what_to_do || ''',''' || a_logon_user || ''',' || a_csv_data || ');';
v_job_name := 'UPLOAD_CSV_FILE_DATA';
sys.dbms_scheduler.create_job(
job_name => v_job_name,
job_type => 'PLSQL_BLOCK',
job_action => 'begin ' || v_job_action || ' EXCEPTION WHEN OTHERS THEN NULL; end;',
start_date => SYSTIMESTAMP,
job_class => 'BATCH_CLASS',
comments => 'Start uplaoding CSV file data.',
auto_drop => TRUE,
enabled => TRUE);
END;
Proc which needs to be called IN JOB is:
CREATE OR REPLACE PROCEDURE process_csv_file_data(a_what_to_do IN VARCHAR2,
a_logon_user IN VARCHAR2,
a_csv_data IN CLOB)
IS
.
/*STEPS*/
.
END;
But since one of the passing parameters for this PROC is CLOB hence whenever I'm trying to call is PROC using in JOB it throws an error "ORA-06502: PL/SQL: numeric or value error".
As job_action datatype is of VARCHAR2(4000); and hence the moment CLOB datatype is dynamically passed while calling the proc in the Job action it throws an error "ORA-06502: PL/SQL: numeric or value error"
Kindly suggest on this. (can we pass the parameters using bind variables?)