Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Oracle equivalent to SQL Server's xp_cmdshell?
In article <tsk5u4ghlmda9f_at_corp.supernews.com>, "John says...
>
>Hello, Thomas!
>
>Thanks for the Java example! This looks like something that I'll be able to
>leverage! :-)
>
>Out of curiosity, how would you recommend modifying this (or can it be?) to
>return the output as a result set that can be "cursored" through?
>
>Thanks again!
>
>John Peterson
>
I'd probably do it in the manner I did this:
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:439619916584
for getting a directory listing (dumped it into a global temporary table). run the procedure, query the temp table or write a procedure that runs the procedure and returns a REF CURSOR that is the select * from the temp table (ala sqlserver technique) see http://osi.oracle.com/~tkyte/ResultSets/index.html for howto with ref cursors.
>"Thomas Kyte" <tkyte_at_us.oracle.com> wrote in message
>news:9qctum0439_at_drn.newsguy.com...
>> In article <tsj95r20o6rrcb_at_corp.supernews.com>, "John says...
>> >
>> >Thanks, Jim!
>> >
>> >I think I found the relevant link on Ask Tom:
>> >
>>
>>http://asktom.oracle.com/pls/ask/f?p=4950:8:184840::NO::F4950_P8_DISPLAYID,
>F
>> >4950_P8_B:150612348067,Y
>> >
>> >However, it doesn't appear as if the results from the execution are
>returned
>> >to the calling procedure. But I suppose this is a start. I wish Oracle
>had
>> >better native support for this type of thing...
>> >
>> >Thanks again, Jim! :-)
>> >
>>
>> use this one:
>>
>>
>http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:952229840
>241
>>
>> instead....
>>
>>
>>
>>
>> >"Jim Kennedy" <kennedy-family_at_home.com> wrote in message
>> >news:Cr9y7.24510$JN.89963_at_news1.sttls1.wa.home.com...
>> >> This has been addressed a bunch of times in the ng. You can do it a
>> >couple
>> >> of ways. dbms_pipe with an external program reading the pipe and doing
>> >what
>> >> you want, use a Java stored procedure, an external program called from
>a
>> >> stored procedure. See MetalLink or Thomas Kyte's site (Ask Tom).
>> >> Jim
>> >> "John Peterson" <johnp_at_azstarnet.com> wrote in message
>> >> news:tsi88teg6qqh82_at_corp.supernews.com...
>> >> > (Oracle 8.1.7.2.1 on Windows 2000)
>> >> >
>> >> > Hello, all!
>> >> >
>> >> > I'm eager to learn if Oracle has an equivalent to SQL Server's
>> >xp_cmdshell
>> >> > extended stored procedure. The xp_cmdshell function essentially
>shells
>> >> out
>> >> > to the OS and executes the provided string. One of the nice features
>of
>> >> > xp_cmdshell is that it will return the output as rows of text and can
>> >thus
>> >> > be handled as a result set you can cursor through.
>> >> >
>> >> > I'm having a tough time figuring out how to execute an OS command
>from
>> >> > Oracle, in general. Would DBMS_PIPE be something that can be
>leveraged?
>> >> Is
>> >> > there something like xp_cmdshell?
>> >> >
>> >> > Thanks for your help! :-)
>> >> >
>> >> > John Peterson
>> >> >
>> >> >
>> >>
>> >>
>> >
>>
>> --
>> Thomas Kyte (tkyte@us.oracle.com) http://asktom.oracle.com/
>> Expert one on one Oracle, programming techniques and solutions for Oracle.
>> http://www.amazon.com/exec/obidos/ASIN/1861004826/
>> Opinions are mine and do not necessarily reflect those of Oracle Corp
>>
>
-- Thomas Kyte (tkyte@us.oracle.com) http://asktom.oracle.com/ Expert one on one Oracle, programming techniques and solutions for Oracle. http://www.amazon.com/exec/obidos/ASIN/1861004826/ Opinions are mine and do not necessarily reflect those of Oracle CorpReceived on Sun Oct 14 2001 - 18:36:37 CDT
![]() |
![]() |