Re: File Operations & System Calls in OCI

From: Bob Hairgrove <rhairgroveNoSpam_at_Pleasebigfoot.com>
Date: Sun, 28 Oct 2001 14:34:24 GMT
Message-ID: <3bdbe459.7761490_at_news.webshuttle.ch>


On 12 Oct 2001 03:52:01 -0700, kasp_at_indiatimes.com (Aditya) wrote:

>Hi,
>
>I am unable to create directories and files through my program.
>What (if any) is the standard way to create and access files and
>directories through OCI?
>

Depends on who is creating the files: Oracle (i.e. a PL/SQL stored procedure) or the C code? If you want Oracle to do it, check out the documentation for the UTL_FILE package. You need to set the UTL_FILE_DIR parameter to an existing directory in the file system. This must appear in your init.ora file. Then you can perform the built-in operations (create files, do I/O, etc.). It exists on Oracle 8i, don't know about earlier versions, though.

If the external module is performing this, use the standard C runtime file I/O functions or the standard C++ library routines (#include <iostream>).

>Also, when a PL/SQL program calls an 'external' (C) procedure, what is
>the best way to debug and to print Error messages on console?
>
>Thanks in advance,
>Aditya.

I would try to handle all errors as they occur (i.e. use try ... catch ... finally blocks) and return appropriate error values to the PL/SQL calling procedure. Use standard C runtime functions to print output to STDOUT or STDERR or, if you're using C++, the standard C++ library routines (#include <iostream>).

Bob Hairgrove
rhairgroveNoSpam_at_Pleasebigfoot.com Received on Sun Oct 28 2001 - 15:34:24 CET

Original text of this message