Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Call a shell by a procedure
Mik schrieb:
> I try your function but the problem is the same.
>
> Perhaps if i find another function than "system" in the programm c,
> it's better ?
>
That is from my linux box:
scott_at_ORA92> create or replace library SHLIB
2 as '/home/oracle/lib/sh.so';
3 /
Library created.
scott_at_ORA92> create or replace function sh_func(
2 cmd in CHAR)
3 return binary_integer is external
4 name "sh"
5 library "SHLIB"
6 parameters (
7 cmd STRING,
8 return short);
9 /
Function created.
scott_at_ORA92> var r number
scott_at_ORA92> set time on timing on
16:19:13 scott_at_ORA92> exec :r := sh_func('for i in 1 2 3 4 5; do sleep
1; done')
PL/SQL procedure successfully completed.
Elapsed: 00:00:05.07
16:19:42 scott_at_ORA92> exec :r := sh_func('for i in 1 2 3 4 5; do sleep
2; done')
PL/SQL procedure successfully completed.
Elapsed: 00:00:10.06
16:20:07 scott_at_ORA92> exec :r := sh_func('for i in 1 2 3 4 5; do sleep
3; done')
PL/SQL procedure successfully completed.
Elapsed: 00:00:15.06
16:20:32 scott_at_ORA92>
As you can see, it takes exactly ( or approximately ;-) ) the same time as the executed command need. Ensure please, that your shell script is not called as background job.
Best regards
Maxim Received on Thu Sep 08 2005 - 09:28:46 CDT