Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Write file to client side and invoke client side shell command

Status
Not open for further replies.

dynamicjourney

Programmer
May 15, 2003
5
US

hi,
1. Server is in Unix box, a procedure will be executed in clientside (windowsnt)and I would like to write and read file in my C drive in clientside.
Tried UTL_file but it only writes in Unix since server is there.
Currently, working on Spool - dbms_output...

2. How can I invoke Dos shell command when Server is Unix.
Tried Java source but it doesn't recognize the path (C:\winnt\sytem32\cmd.exe) when I execute it, it says 'File doesn't exists'.

ANy help will be greatly apprciated.

dynamic
 
Dynamic,

Yes, if you output using "dbms_output.put_line", it writes to the client side. Then, also from the client side, you can either execute the file as a SQL script by saying:
Code:
SQL> @script_name
...or execute the file as a Windows batch file from the SQL*Plus prompt by saying:
Code:
SQL> host script_name.bat
I hope this is what you are looking for. Let us know.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)

Do you use Oracle and live or work in Utah, USA?
Then click here to join Utah Oracle Users Group on Tek-Tips.
 
it looks like this is what I needed, It's a good point of reference in what I would like to do...

one more thing, how can I invoke DOS command in procedure.
 
If you are talking about executing a DOS command from within an Oracle PL/SQL user-defined procedure, then Oracle does not support operating-system exits/commands from within a PL/SQL block or procedure (but Java does).

If, however, instead of "procedure" you meant "...how can I invoke DOS command in an Oracle SQL*Plus script", then you can embed in the script the DOS command preceded by the "HOST" command. For example:
Code:
SPOOL temp.txt
SELECT * from my_table;
SPOOL OFF
HOST copy temp.txt another.txt
et cetera

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)

Do you use Oracle and live or work in Utah, USA?
Then click here to join Utah Oracle Users Group on Tek-Tips.
 
Hi,

I just post the answer to this on server side in the Oracle 8i Forum (under unix, you're lucky).

For the client side, Oracle can not do that from the server. If you use FORMS, it can do it via the HOST command. Else, you can create a shared directory on the server so that your users can access it from windows (possibly).

Hope that it helps...

Christian
 

Hey guys,

I really appreciate it, I already got the info I needed from you guys. It is a BIG help.
Keep it up!

Dynamic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top