Calling Pro*C programs from Stored Procedures
443104Mar 18 2008 — edited Mar 23 2008Hi Experts,
Again i am in need of your expertise.
I am working on a small project which requires interacting with OS from within Oracle database. I wrote couple of small C programs which can be called directly from within Oracle database say for example to return free OS memory using VMSTAT. I wrote this using External Procedures. They are working perfectly.
I also wrote a Pro*C program to which runs couple of OS commands and inserts data into Oracle tables. Even this is working perfectly.
Coming to the problem, I am unable to call this Pro*C program from PL/SQL as stored procedure.
This Pro*C program
Step 1:
proc iname=working.pc oname=working.c
Step 2:
xlc -q64 -I$ORACLE_HOME/precomp/public -L$ORACLE_HOME/lib working.c -o working.so -lclntsh -lsql10
Step 3:
sample user99/user99@testdb
Following are the steps I am performing in SQL*Plus:
SQL> create or replace library sample_lib as '/u3cms/c/working.so';
2 /
Library created.
SQL> create or replace procedure working
2 as language C
3 library sample_lib
4 name "main";
5 /
Procedure created.
SQL> exec working
BEGIN working; END;
*
ERROR at line 1:
ORA-06521: PL/SQL: Error mapping function
ORA-06522: Function not implemented (main)
ORA-06512: at "USER99.WORKING", line 1
ORA-06512: at line 1
Any help in this direction would be helpful.
Regards