1.write c code 2.Compile the C program 3.load the compiled object module into a dynamic load library 4.Move the generated dynamic load library to some appropriate directory of your choosing 5.Within Oracle (eg. using SQL*Plus), declare the library you have created: CREATE OR REPLACE LIBRARY MY_WORDCAT_LIB IS '/local0/oracle/c_libraries/wordcatlib.so'; 6.define a PL/SQL function or procedure to call the external routine CREATE OR REPLACE PROCEDURE wordcat ( word1 IN VARCHAR2, word2 IN VARCHAR2, both_words OUT VARCHAR2) IS EXTERNAL NAME "wordcat" LIBRARY "MY_WORDCAT_LIB" PARAMETERS ( word1 string, word1 INDICATOR short, word1 LENGTH short, word2 string, word2 INDICATOR short, word2 LENGTH short, both_words string, both_words INDICATOR short, both_words LENGTH short, both_words MAXLEN short); 7.Create a public synonym and public execution rights to the routine grant execute on system.wordcat to public; create public synonym wordcat on system.wordcat;
2.Compile the C program
3.load the compiled object module into a dynamic load library
4.Move the generated dynamic load library to some appropriate directory of your choosing
5.Within Oracle (eg. using SQL*Plus), declare the library you have created: CREATE OR REPLACE LIBRARY MY_WORDCAT_LIB IS
'/local0/oracle/c_libraries/wordcatlib.so';
6.define a PL/SQL function or procedure to call the external routine
CREATE OR REPLACE PROCEDURE wordcat (
word1 IN VARCHAR2,
word2 IN VARCHAR2,
both_words OUT VARCHAR2) IS EXTERNAL NAME "wordcat"
LIBRARY "MY_WORDCAT_LIB"
PARAMETERS ( word1 string,
word1 INDICATOR short,
word1 LENGTH short,
word2 string,
word2 INDICATOR short,
word2 LENGTH short,
both_words string,
both_words INDICATOR short,
both_words LENGTH short,
both_words MAXLEN short);
7.Create a public synonym and public execution rights to the routine grant execute on system.wordcat to public; create public synonym wordcat on system.wordcat;
DECLARE test_word1 varchar2(20) := 'hello';
test_word2 varchar2(20) := 'world';
both_words varchar2(50); BEGIN wordcat(test_word1, test_word2, both_words); dbms_output.put_line('word1 ="' || test_word1 || '"');
dbms_output.put_line('word2 ="' || test_word2 || '"');
dbms_output.put_line('both_words="' || both_words || '"'); END;
在执行第6步的时候,我的dll没有参数,所以我是这样写的
CREATE OR REPLACE PROCEDURE aa is
EXTERNAL NAME "OutputStr"
LIBRARY "ttt_lib"
PARAMETERS();可是编译不通,哪里出了问题?
“ORA-28575: 无法打开与外部过程代理程序的RPC连接”
是不是要设置监听程序?如何设置急等,希望今天能结贴了。
是ORA-06521:P:?SQL:映射函数时出错
ora-06522:unable to load symbol from dll
是不是COM组件的问题呢?