Home » Developer & Programmer » JDeveloper, Java & XML » Java external procedure parameters
Java external procedure parameters [message #273515] Wed, 10 October 2007 14:21 Go to next message
Agus211
Messages: 39
Registered: September 2007
Member
Hi, I'm calling a Java External Procedure like this:

CREATE FUNCTION HAS_GROUP (STRGROUP IN VARCHAR2)
RETURN VARCHAR2
AS LANGUAGE JAVA
NAME 'PKGPORTAL.GROUPS.HAS_GROUP
(java.lang.String) return java.lang.String';
/

The thing is that I need also to send it the CLIENT_IDENTIFIER, but I saw in every example that the parameters that the PLSQL function recieves are the same that you send to Java. Am I able to send an extra parameter to Java?. I need it to recieve the CLIENT_IDENTIFIER. Thank you.
Re: Java external procedure parameters [message #273528 is a reply to message #273515] Wed, 10 October 2007 14:46 Go to previous messageGo to next message
Michel Cadot
Messages: 64120
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
So why not create a PL/SQL procedure above the one that call java and add the client_identifier?

Regards
Michel
Re: Java external procedure parameters [message #273534 is a reply to message #273515] Wed, 10 October 2007 14:55 Go to previous messageGo to next message
Agus211
Messages: 39
Registered: September 2007
Member
Hi,
I'm sorry, but I don't understand. Could you explain me?. Should I create a function that returns the client_identifier and from Java make a callback to it?.

Aren't I able to do something like this?.
v_client_id VARCHAR2 (256):= UPPER (TRIM (SYS_CONTEXT ('userenv', 'client_identifier')));

And send it to Java as a parameter in the calling statement(NAME 'PKGPORTAL.GROUPS.HAS_GROUP(java.lang.String) return java.lang.String')?.

Thanks for answering so fast.
Re: Java external procedure parameters [message #273536 is a reply to message #273534] Wed, 10 October 2007 15:03 Go to previous messageGo to next message
Michel Cadot
Messages: 64120
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator


CREATE FUNCTION HAS_GROUP (STRGROUP IN VARCHAR2, clid in varchar2)
RETURN VARCHAR2
AS LANGUAGE JAVA
NAME 'PKGPORTAL.GROUPS.HAS_GROUP
(java.lang.String, java.lang.String) return java.lang.String';
/

create or replace function wrapper (strgroup in varchar2)
is
v_client_id VARCHAR2 (256):= UPPER (TRIM (SYS_CONTEXT ('userenv', 'client_identifier')));
begin
return HAS_GROUP (strgroup, v_client_id);
end;
/

Regards
Michel
Re: Java external procedure parameters [message #273769 is a reply to message #273515] Thu, 11 October 2007 11:02 Go to previous messageGo to next message
Agus211
Messages: 39
Registered: September 2007
Member
Thanks!, I'll try that way. One of my Java's returns a Vector, and I'm creating this type for it:

type role_type is table of varchar2(100) index by binary_integer;

And calling it this way:

FUNCTION get_role (client_id IN VARCHAR2)
RETURN role_type
AS
LANGUAGE JAVA
NAME 'PortalJava.Pkgfuncldap.Get_Role.Client_Roles(java.lang.String) return java.util.Vector';

But it doesn't compile. Am I stablishing a wrong match between Java vectors and the database table?.

Re: Java external procedure parameters [message #273775 is a reply to message #273769] Thu, 11 October 2007 11:37 Go to previous messageGo to next message
Michel Cadot
Messages: 64120
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I don't know, I move the topic to Java forum.

Regards
Michel
Re: Java external procedure parameters [message #273783 is a reply to message #273515] Thu, 11 October 2007 12:19 Go to previous messageGo to next message
Agus211
Messages: 39
Registered: September 2007
Member
Oks, Thanks Michel for your help!.
Re: Java external procedure parameters [message #282382 is a reply to message #273769] Wed, 21 November 2007 14:54 Go to previous message
psix666
Messages: 51
Registered: April 2007
Location: Azerbaijan
Member

CREATE FUNCTION HAS_GROUP (StrGroup IN STRING, CLID in STRING) RETURN varchar2 AS
LANGUAGE JAVA
NAME 'PKGPORTAL.GROUPS.HAS_GROUP (java.lang.String, java.lang.String) return String';


~updated

sorry i post only code.
Try this. May be in that way it can work.

[Updated on: Wed, 21 November 2007 14:55]

Report message to a moderator

Previous Topic: JavaMail inside Database
Next Topic: Blob retrieves documents from oracle database.
Goto Forum:
  


Current Time: Tue Dec 06 12:09:54 CST 2016

Total time taken to generate the page: 0.11756 seconds