Home » SQL & PL/SQL » SQL & PL/SQL » Calling Procedure from External DLL
Calling Procedure from External DLL [message #249050] Tue, 03 July 2007 03:05 Go to next message
rajesh_bhadu
Messages: 48
Registered: June 2007
Member
Hi All,

I am trying to call procedures from external DLL.

I am using Oracle10g and Oracle SQL Devloper with WindowXP to do this.


here what i have done till now

create or replace library libc_l as 'c:\windows\system32\crtdll.dll';




create or replace package random_utl
as
  function rand return pls_integer;
  pragma restrict_references (rand, WNDS, RNDS, WNPS, RNPS);
 
  procedure srand (seed in pls_integer);
  pragma restrict_references (srand, WNDS, RNDS, WNPS, RNPS);
end random_utl;
 
create or replace package body random_utl
as
  function rand return pls_integer
    is
      external
      library libc_l
      name "rand"
      language c;

  procedure srand (seed in pls_integer)
    is
      external
      library libc_l
      name "srand"
      language c
      parameters (seed ub4);

end random_utl;




changes that i have done in listener.ora
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = C:\oraclexe\app\oracle\product\10.2.0\server)
      (ENV = "EXTPROC_DLLS=ANY")
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:\oraclexe\app\oracle\product\10.2.0\server) 
      (PROGRAM = extproc)
      (ENV = "EXTPROC_DLLS=ANY")
    )
  )





environment variable that i have defined for window is as below

EXTPROC_DLLS=C:\windows\system32\crtdll.dll


I m calling all the stuff in below procedure


create or replace procedure external_dll_sp
as
  rnd_value pls_integer;
  seed pls_integer;
begin
  select to_char(sysdate, 'SSSSS') into seed from dual;
  random_utl.srand (seed);
  for v_cnt in 1 .. 10 loop
    rnd_value := random_utl.rand;
    dbms_output.put_line ('rand() call #' || v_cnt || ' returns ' ||
rnd_value);
  end loop;
end;



After restarting of both oracle and Oracle SQL developer.


When I execute external_dll_sp , I m getting below error....
Connecting to the database new_test.
ORA-28595: Extproc agent : Invalid DLL Path
ORA-06512: at "NEW_TEST.RANDOM_UTL", line 10
ORA-06512: at "NEW_TEST.EXTERNAL_DLL_SP", line 7
ORA-06512: at line 2
Process exited.
Disconnecting from the database new_test.


Please help me where i did wrong.

Thanx in advance. Embarassed
Re: Calling Procedure from External DLL [message #249412 is a reply to message #249050] Wed, 04 July 2007 06:50 Go to previous messageGo to next message
rajesh_bhadu
Messages: 48
Registered: June 2007
Member
Hi All,

Noting is wrong with my code.

After restarting my machine it's working fine.

So I think it is helpfull for other friends .


Thanx

Rajesh Laughing Razz

[Updated on: Wed, 04 July 2007 06:51]

Report message to a moderator

Re: Calling Procedure from External DLL [message #249413 is a reply to message #249412] Wed, 04 July 2007 07:05 Go to previous messageGo to next message
Michel Cadot
Messages: 68722
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Quote:
So I think it is helpfull for other friends .

Yes, thank you for the feedback.

Regards
Michel
Re: Calling Procedure from External DLL [message #251702 is a reply to message #249413] Mon, 16 July 2007 02:37 Go to previous message
rajesh_bhadu
Messages: 48
Registered: June 2007
Member
Hi All,

I know why my call to external dll is working after restarting my machine. because

1. To call an external dll i have specified 'ENV = "EXTPROC_DLLS=ANY"' in my listener.ora
2. these changes will reflect after restart of listener service.


Thanx Laughing

[Updated on: Mon, 16 July 2007 02:37]

Report message to a moderator

Previous Topic: Regrading bulk upload(FOR ALL)
Next Topic: Refresh the current working Cursor
Goto Forum:
  


Current Time: Thu Dec 12 08:12:48 CST 2024