Home » SQL & PL/SQL » SQL & PL/SQL » how can we call java code in oracle procedure
how can we call java code in oracle procedure [message #231418] Tue, 17 April 2007 00:29 Go to next message
ammishra
Messages: 179
Registered: January 2007
Location: india
Senior Member
Hi,

I am trying to call java code in oracle procedure. I ran following code in procedure window.

 CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED Test AS

PUBLIC CLASS Test
{
	public static void main(String arg[])
	
	{

		test t = new test();	
	
	}

	
	int add(int i)
	
	{
	
		return i+1;	
	}
	
	}

But I am not able to see any class name in java tab in schema browser window.

Please let me now the step which require to call “add” method in procedure.


--Yash
Re: how can we call java code in oracle procedure [message #231420 is a reply to message #231418] Tue, 17 April 2007 00:34 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
This would not compile (there is no class test) plus it would not do anything, since your add method is not public.
See the Oracle docs for how to call java from pl/sql.
Re: how can we call java code in oracle procedure [message #231475 is a reply to message #231420] Tue, 17 April 2007 04:13 Go to previous messageGo to next message
ammishra
Messages: 179
Registered: January 2007
Location: india
Senior Member
Hi Frank,

i have created one java class in oracle. now i am able to see the
class name and source code in java tab in schema browser window.

but when i am clicking the source code it is displying the code ..but i am not getting in any thing when i am clicking the class


CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "Hello" AS
public class Hello {
      public static int hello(int i, int j) {
         return i+j;   } }
Done
 
 



CREATE OR REPLACE FUNCTION fDelete (
	   arg1 IN number,arg2 in number) 
	   RETURN NUMBER
	AS LANGUAGE JAVA NAME 'Hello.hello (
	            arg1,arg2) 
	             return int';

 


select fDelete(10,20) from dual


i am getting error ORA-29531: no method hello in class Hello


please sugegst some thing ...



--Yash
Re: how can we call java code in oracle procedure [message #231837 is a reply to message #231475] Wed, 18 April 2007 09:55 Go to previous messageGo to next message
ammishra
Messages: 179
Registered: January 2007
Location: india
Senior Member
any one can suggest some thing PLZ!!


--Yash
Re: how can we call java code in oracle procedure [message #231840 is a reply to message #231418] Wed, 18 April 2007 10:01 Go to previous messageGo to next message
BlackSwan
Messages: 25033
Registered: January 2009
Location: SoCal
Senior Member
Google is your friend, but only when you use it.
Results 1 - 10 of about 1,140,000 for oracle java stored procedures
Re: how can we call java code in oracle procedure [message #231845 is a reply to message #231840] Wed, 18 April 2007 10:11 Go to previous messageGo to next message
ammishra
Messages: 179
Registered: January 2007
Location: india
Senior Member
That is true..i assent you but where i am working they won't allow to use google ...they provide document and access of some site like
this site ...but some time we can not read each end every thing ...and other word some time we are not able to understand each and every thing ...i am novice in oracle ..so i am expecting the help who are master in oracle ..some times i feel meager to ask same kind of question many time..but it is ok bcz i want to become good programer in oracl with the help of others -:)

The important thing is never to stop questioning.
Albert Einstein


so i am asking i hope u can understand the pain of those people they can not do lot of thing own like me -:)


--Yash
Re: how can we call java code in oracle procedure [message #231847 is a reply to message #231418] Wed, 18 April 2007 10:18 Go to previous messageGo to next message
BlackSwan
Messages: 25033
Registered: January 2009
Location: SoCal
Senior Member
when all else fails you could always Read The Fine Manuals found at http://tahiti.oracle.com

or search for sample code at http://otn.oracle.com

[Updated on: Wed, 18 April 2007 10:20] by Moderator

Report message to a moderator

Re: how can we call java code in oracle procedure [message #231863 is a reply to message #231845] Wed, 18 April 2007 12:03 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
ammishra wrote on Wed, 18 April 2007 17:11
The important thing is never to stop questioning.
Albert Einstein



If this is really what Albert Einstein said, you should not ask us here how to do this (that would be "Never stop asking"), but ask your superiors why on earth they decided to take away the best source of information. (THAT is questioning)

[Edit: Typo]

[Updated on: Wed, 18 April 2007 12:04]

Report message to a moderator

Re: how can we call java code in oracle procedure [message #231977 is a reply to message #231863] Thu, 19 April 2007 00:17 Go to previous message
ammishra
Messages: 179
Registered: January 2007
Location: india
Senior Member
Thx Frank to explain me but I jusy past the quote nothing else …but tell me what is the moral of running this forum ....if i have doubt then i have posted if u know the answer the explain me ..I am not asking any individual person..i am asking to those people they are associated with this forum …
There is no point to saying like that search on Google and so one …every body know that all these
Things…. U can not compare with us those people which working in oracle just one month…u can understand and implement each and every thing in oracle because you have experience in oracle nothing else .i can do same thing in my core technology

Naturally novice people ask some times foolish questions also ..but u guys have more experience in oracle ..u guys are very talented ….then you guys have to given response of
Those question or just simply ignore…. Bcz no one asking to you directly I hope you guys are not running this forum …so you guys should be behave like mature oracle programmer ….i hope you don’t mind and please close this thread …but still i am not able to call the java code in oracle procedure ..So no point to discuss all these things in oracle forum …bcz I think this is technical discussion forum only..


Sorry to all of you for this junk mail……



--Yash
Previous Topic: File count UTL_FILE
Next Topic: NEAREST and DATE (yet again merged)
Goto Forum:
  


Current Time: Fri Dec 02 14:26:45 CST 2016

Total time taken to generate the page: 0.25862 seconds