Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> oracle external library problem
I have been trying to make an external call to a C program from within a trigger, so I thought I would create a function that would call the c program. The simple program I am trying to run is:
/* File: printhello.c */
#include <stdio.h>
int main (int argc, char *argv[])
{
FILE *fp;
if ((fp = fopen("/tmp/hellofile.txt", "w")) == NULL) {
exit (1);
}
else {
if (argc == 2) { printf("Your argument was %s\n", argv[1]); } else { fprintf(fp, "Hello, and in case we don't meet again, goodbye!\n"); fclose(fp); exit (0); }
I created a shared library using:
gcc -I$ORACLE_HOME/dbms/demo -I$ORACLE_HOME/rdbms/public
-I$ORACLE_HOME/plsql/public -I$ORACLE_HOME/network/public -c printhello.c
make -f demo_rdbms.mk extproc_callback SHARED_LIBNAME=my_lib.so OBJS=printhello.o
All that I am trying to do is write to a file.
I then created the Oracle library and defined my function:
create library MY_LIB as 'my_lib.so';
CREATE OR REPLACE FUNCTION myfunc
(uname IN VARCHAR2)
RETURN INTEGER
AS EXTERNAL LIBRARY MY_LIB
NAME printhello LANGUAGE c CALLING STANDARD c PARAMETERS (uname);
I tried using the function, but it gives an error:
SQL> select myfunc('WriteMe') from dual; select myfunc('WriteMe') from dual
*
ERROR at line 1:
ORA-06571: Function MYFUNC does not guarantee not to update database
I have checked with our DBA, and we have a listener dedicated to external procedure calls. What am I doing wrong?
Nivesh
-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Wed Feb 17 1999 - 15:20:35 CST