| Execute an external application from PL/SQL [message #432316] |
Mon, 23 November 2009 09:49  |
serfraile
Messages: 18 Registered: November 2009
|
Junior Member |
|
|
Hello,
I need some help to know if this is possible.
I want to know if you can call an external application from a PL/SQL procedure.
I've seen that command HOST allows to execute any external application, but from SQL Plus, not from a PL/SQL editor like TOAD. I want to create a procedure that makes that call and executes an external application.
Do you know if it is possible?
Thanks in advance.
Sergio.
|
|
|
|
| Re: Execute an external application from PL/SQL [message #432317 is a reply to message #432316] |
Mon, 23 November 2009 09:53   |
ThomasG
Messages: 3212 Registered: April 2005 Location: Heilbronn, Germany
|
Senior Member |
|
|
Basically: Yes.
Big but:
PL/SQL runs on the server. So you can only execute an external application on the server, not on the client, which is what the "host" command of SQL*Plus does.
There are a couple of ways, for example using dbms_scheduler, or a Java stored procedure, depending on what kind of application for what purpose.
|
|
|
|
|
|
|
|
| Re: Execute an external application from PL/SQL [message #432354 is a reply to message #432324] |
Mon, 23 November 2009 16:04   |
wakula
Messages: 150 Registered: February 2008 Location: Poland
|
Senior Member |
|
|
EXECUTE IMMEDIATE might be used to do this.
You might call anonymous blocks from external application (ex. JAVA, perl, sqlplus).
There are many other ways to make it working.
Things that you should be aware:
- The query/plsql might need to be re-compiled on every execution and it takes time.
- Oracle is (can be) using pre-compiled statements... but only if it can.
- Oracle is keeping the dependencies. Without knowing the statement it cannot keep them. It won't know if everything is OK. It would need to check this on the execution. Expect significant(?) performance issue.
|
|
|
|
|
|
| Re: Execute an external application from PL/SQL [message #432360 is a reply to message #432319] |
Mon, 23 November 2009 17:30   |
JRowbottom
Messages: 5933 Registered: June 2006 Location: Sunny North Yorkshire, ho...
|
Senior Member |
|
|
It's not always a bad idea - I've never found a way to interface with the QAS address mapping software other than writing a set of java wrappers for their library, and if you've ever found a way to interface with Experian's credit checking system in the uk that didn't involve writing the interface in C and then calling that via Extproc then I'd love to know how you did it.
Sometimes there are things that your application needs to talk to that Oracle's set of utilities just won't handle.
|
|
|
|
| Re: Execute an external application from PL/SQL [message #432394 is a reply to message #432360] |
Mon, 23 November 2009 23:29  |
 |
Michel Cadot
Messages: 68776 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
OK, I should add to my signatures:
- ALWAYS = always unless you have a good reason to not to so
- NEVER = never unless you have a good reason to do so.
But writing so in a forum that is read by beginners will "always" be read at "so we cannot (or can) do it".
Regards
Michel
|
|
|
|