Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 Other Topics
 Oracle Question

Author  Topic 

mprolli
Starting Member

24 Posts

Posted - 2005-01-03 : 13:41:22
I need to create a package in oracle that copies a file from one network location to another, the location names need to be variables, I did this in SQL using xp_cmdshell. Any help would be much appreciated...Thanks

Let us rise up and be thankful, for if we didn't learn a lot today, at least we learned a little, and if we didn't learn a little, at least we didn't get sick, and if we got sick, at least we didn't die; so, let us all be thankful.
--Buddha

X002548
Not Just a Number

15586 Posts

Posted - 2005-01-03 : 13:57:05
Well..this should probably be in the Other forum...

I'd probably look up the DBMS Oracle supplied packages...

Also try here

http://www.dbforums.com/f4



Brett

8-)
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2005-01-03 : 15:17:23
[code]
SELECT name, value, isses_modifiable, issys_modifiable
FROM v$parameter
WHERE name = 'utl_file_dir'
[/code]

Brett

8-)
Go to Top of Page

mprolli
Starting Member

24 Posts

Posted - 2005-01-03 : 16:24:27
Brett, what is that (SELECT name, value, isses_modifiable, issys_modifiable
FROM v$parameter
WHERE name = 'utl_file_dir') suppose to tell me? Result set below
utl_file_dir, null, false, false. I've been doing some research, and it looks like everyone is pointing me towards Java.


Let us rise up and be thankful, for if we didn't learn a lot today, at least we learned a little, and if we didn't learn a little, at least we didn't get sick, and if we got sick, at least we didn't die; so, let us all be thankful.
--Buddha
Go to Top of Page

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2005-01-03 : 19:09:28
this is not as easily accomplished in Oracle as it is in SQL Server.

Usually, when I have a requirement like this I create a perl or shell script that wraps some sqlplus code in order to make this work. This is usually pretty straightforward.

However, there are other methods. You can use the DBMS_PIPE package (see metalink article 14082.1) or you can use external procedures in Oracle (metalink note 99136.1). A really good technote that covers all your options is metalink note 199223.1.

The orafaq site has an example of using the external procedure method here: http://www.orafaq.com/scripts/c_src/extproc.txt

www.dbforums.com is probably the best place to ask these kinds of questions, SQl Team is SQL Server specific for the most part. Good luck.



-ec
Go to Top of Page

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2005-01-03 : 19:12:48
quote:
Originally posted by X002548


SELECT name, value, isses_modifiable, issys_modifiable
FROM v$parameter
WHERE name = 'utl_file_dir'




I am not sure what you are getting at here Brett. Your query just lists the parameters that are in use for this session. the issess_modifiable just lets you know if you can modify the value with a ALTER SESSION statement, issys_modifiable is the same for ALTER SYSTEM.

Did I miss something?


-ec
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2005-01-18 : 14:02:31
I don't have an environement set up anymore, but my ref guide say that will produce a directory listing...at least that's what the example shows...

Osbourne Press 2438-9 PL/SQL Tips and Techniques



Brett

8-)
Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2005-01-18 : 15:04:57
mprolli, have you really researched the UTL_FILE options? I don't have my references handy, but I have used UTL_FILE to open and read files with statements like:

V_FILE_HANDLE := UTL_FILE.FOPEN(V_FILEDIR, V_FILENAME, 'r');
UTL_FILE.GET_LINE (V_FILE_HANDLE, V_LINE_BUFFER);


I'd be surprised if there isn't an option to write or copy the file in there also.

---------------------------------------------------------------------------------
Infoneering: Information Technology solutions engineered to professional standards.
Go to Top of Page
   

- Advertisement -