answersLogoWhite

0

The simple answer to this is yes. You can either build your java class on the server side machine and then load it up into Oracle using the loadjava command, which can also compile it if you so desire, or load it direct from PL/SQL using: create or replace and compile java source named <class name> AS ...

and then the java code. e.g. ..... create or replace and compile java source named helloBob AS

public class HelloBob

{

public static String hello()

{

return "Hello Bob!";

} public static String hello(String name)

{

return "Hello " + name + "!";

}

} NOTE: There are performance improvements in loading it into Oracle as a compiled class. Once in Oracle, the the functions in this class can be called by defining it as a function or procedure... in the example featured two functions can be defeind as follows: CREATE OR REPLACE FUNCTION HelloBob RETURN VARCHAR2

IS LANGUAGE JAVA NAME 'HelloBob.hello() return String';

/

CREATE OR REPLACE FUNCTION Hello(name VARCHAR2) RETURN VARCHAR2

IS LANGUAGE JAVA NAME 'HelloBob.hello(java.lang.String) return String';

/ Note: Good programming practice is to put functions in a 'package' in Oracle... it makes them easier to roll out. You can now call these functions: e.g. select hellobob() AS "Greeting" FROM DUAL; should return a column "Greeting" with the value 'Hello Bob!' and... SELECT hello('Fred') AS "Greeting" FROM DUAL; should return a column "Greeting" with the value 'Hello Fred!' You can pass and return all types of Oracle variable, including collections.... see the oracle.sql package definition for more info. If you need to make database calls from the java function then use OracleDriver().defaultConnection() to get a connection (contained in the oracle.jdbc package).

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

Is it possible to call a stored procedure from java script function and populate an aspnet dropdown list HTML control using the value returned by the SP?

No, a stored procedure can not be called from Javascript. A dropdown list however can be populated using a stored procedure.


How do call stored procedure in jsp?

To call a stored procedure in JSP, you typically use JDBC (Java Database Connectivity). First, establish a connection to your database using DriverManager. Then, create a CallableStatement object with the stored procedure's SQL call (e.g., {call procedure_name(?, ?)}) and set any required parameters. Finally, execute the statement using execute() or executeUpdate() and process the results as needed.


What do you call a variable of a function that is active only within the procedure or its function?

local variable


How is a procedure identified as near or far?

The far procedure is used at the place where the function call is given in main program and function definition is given in sub program....


Where static variables stored?

they are stored in the memory.they obviously can't be stored in stack Bcoz there value won't be retained between function call.


How do you call oracle word in Telugu?

oracle only


What do we mean by Sub-routine calls in C language?

A subroutine is a procedure call. In other words, a function call.


What statements indicate the start and end of a procedure?

A procedure is started by calling the function that represents that procedure. The function call must include any and all required arguments.The procedure ends whenever a return statement is encountered anywhere within the function body, or execution falls off the end of the function (assuming no return value is expected from the procedure), or a non-return function is invoked by the function (such as the abort() function) or an unhandled exception is thrown by the function. Apart from a non-returning function call, execution always returns to the calling code (the caller). If an unhandled exception is thrown by a function, the call stack automatically "unwinds" until a suitable exception handler is found. If no handler is found on the call stack, the global main function will unwind, terminating the program with an unhandled exception error. Hence the reason all non-trivial programs should provide a "catch-all" exception handler in the global main function.


3 What is the difference between a function procedure and a subroutine procedure?

Both a function and a subroutine are examples of out-of-line execution calls to code. The main difference is that a function call can be part of an expression and returns a value, whereas the subroutine can be called standalone and does not return a value.


In how many ways a function call may effect a state change in the caller?

None. A properly designed function may only return a value, without having side-effects. Of course, you may intend there be side-effects, in which case your question has no definite answer, but also in that case you should call your "function" a "procedure" instead.


What function in Microsoft Excel 2003 to write the amount in word?

Such a function does not exist for English. A function call BAHTTEXT will do it for the Thai language.Such a function does not exist for English. A function call BAHTTEXT will do it for the Thai language.Such a function does not exist for English. A function call BAHTTEXT will do it for the Thai language.Such a function does not exist for English. A function call BAHTTEXT will do it for the Thai language.Such a function does not exist for English. A function call BAHTTEXT will do it for the Thai language.Such a function does not exist for English. A function call BAHTTEXT will do it for the Thai language.Such a function does not exist for English. A function call BAHTTEXT will do it for the Thai language.Such a function does not exist for English. A function call BAHTTEXT will do it for the Thai language.Such a function does not exist for English. A function call BAHTTEXT will do it for the Thai language.Such a function does not exist for English. A function call BAHTTEXT will do it for the Thai language.Such a function does not exist for English. A function call BAHTTEXT will do it for the Thai language.


What is the purpose of a function or procedure?

function is a set of statements that can be executed in the part of the program. ex: to add two nos. using function void main() { int a,b,c; printf("enter the two numbers"); scanf("%d%d",&amp;a,&amp;b); add(a,b); clear(); } void add(int a,int b) { c=a+b; printf("the sum is %d",c); }