get job_id in running job (dbms_job) [message #265794] |
Fri, 07 September 2007 07:30  |
cordess
Messages: 5 Registered: April 2005
|
Junior Member |
|
|
I use the Job mechanism to start pl/sql procedures.
Now i want those procedures to make Outputs to some Tables. The output must contain the job_id of the running job.
I don't want the procedure make the output(with jobid), wich starts the job! I need a way to get the job_id in the running Job.
Do anybody know a way to get this job_id?
My english is not the best, i hope you understand, what I'm looking for.
Cordess
|
|
|
Re: get job_id in running job (dbms_job) [message #265803 is a reply to message #265794] |
Fri, 07 September 2007 07:58   |
ThomasG
Messages: 3212 Registered: April 2005 Location: Heilbronn, Germany
|
Senior Member |
|
|
When you think about the program parts here .....
Calling Procedure
|
v
Configured dbms_job
|
v
"Job" Procedure
The parts that know the job ID are the calling procedure and the configured dbms_job. The "Job" Procedure could by called by itself, too, without a job being involved.
So one way to do what you want might be to add the job ID as IN parameter to the job procedure, and then hardcode the ID in the call in dbms_job to match the actual job id.
|
|
|
|
Re: get job_id in running job (dbms_job) [message #265822 is a reply to message #265794] |
Fri, 07 September 2007 08:46   |
cordess
Messages: 5 Registered: April 2005
|
Junior Member |
|
|
I see you are german. So write the answer first in english and then in german.
Okay,...i'm not sure if i understand it right.
What you meant is to get the Job id in the what-part of job submit. Until now i thought this could not work. 
Very good idea, it works fine with following samplecode:
Miniprocedure starting the job:
declare
jobno binary_integer;
begin
dbms_job.submit(jobno,'job_test(job);');
myoutput.put_line('jobtest1','Erg:'||to_char(jobno));
commit;
end;
The minijobprocedure:
procedure job_test(job_id in binary_integer)
is
begin
myoutput.put_line('jobtest2',to_char(job_id));
end job_test;
But if you meant a other way than please tell it.
The same text in german:
Ich bin mir nicht Sicher ob ich sie richtig verstanden habe.
Sie meinen ich soll die Jobid im whatpart der submitprozedur einfach mitübergeben. Bis heute hab ich es für mich einfach ausgeschlossen, dachte das geht nicht(wie engstirnig von mir ).
Tolle idee, läuft mit dem oben genannten Code.
Falls sie aber was anderes meinten, dann interessiert mich das trotzdem.
Thank you, you rescued my day .
Das lass ich mal englisch stehen .
|
|
|
|
Re: get job_id in running job (dbms_job) [message #265837 is a reply to message #265794] |
Fri, 07 September 2007 09:32   |
cordess
Messages: 5 Registered: April 2005
|
Junior Member |
|
|
Oh, please dont missunderstand me, i wrote my post before i read yours.
I see that your suggestion is very similar to my new code(thanks to the other user).
The german text contains complete the same meanings like in the english text.
This is the reason why i wrote it first in english.
My english is not the best. I saw the other user was a german, so i thought it is a goog idea to avoid missunderstandings.
Thats all,...thanks to all.
Cordess
|
|
|
|
|
|