JAVA to create Oracle stored procedure to achieve

2011-10-11  来源:本站原创  分类:Database  人气:68 

First look at how to use JAVA to write Oracle Stored procedures, we Oracle Written statement in the SQL Plus .
 I. start SQL PLUS
 ⅱ. preparation JAVA Classes definition JAVA The category name, this stored procedure is simply output squares of parameter value passed .

create or replace and compile java source named "PF" as
/**
*  Created by JAVA classes to implement Oracle Stored procedure
*/
package org.oraclejava.pro;

public class javaCreatePro {
public static String test(int num) {
    return num + " Square : " + num * num;
}
}

 ⅲ. JAVA Method in a class test are created as a Oracle Function method 

create or replace function PF_FUN(name integer) return varchar2 as language java name 'org.oraclejava.pro.javaCreatePro.test(java.lang.Integer) return

java.lang.String';

 IV. in the console direct calls Oracle Function 

select PF_FUN(10) from dual;

 ⅴ. output
10 Square :100
相关文章
  • JAVA to create Oracle stored procedure to achieve 2011-10-11

    First look at how to use JAVA to write Oracle Stored procedures, we Oracle Written statement in the SQL Plus . I. start SQL PLUS ⅱ. preparation JAVA Classes definition JAVA The category name, this stored procedure is simply output squares of paramete

  • java call the Oracle stored procedure 2010-03-30

    Time to start learning to write stored procedures, the main reason is because the work requires it, would have thought that simple, but after several setbacks, the heroic spirit vanished, but finally pass out, and in order to avoid later, few detours

  • java program called ORACLE stored procedure and returns data set (resultSet) 2010-11-25

    Divided into three steps: 1. Created corresponding to the stored procedure. create or replace procedure getemps (p_cursor out types.cursorType) as begin open p_cursor for select * from userinfo order by userinfo.u_id; - the name of the table end; 2.

  • 1-dimensional array in Java incoming call oracle stored procedure 2011-06-03

    Database components: In order to ensure are written to run, so every time you create tables, types, etc., are the first drop it. The first run of a friend, you may find the drop statement reported × × × does not exist, can be ignored. Quotation marks

  • Detailed oracle stored procedure - to achieve by the cursor. Delete. Change. Check function 2010-12-22

    Cursor (CURSOR) is the ORACLE system opened in memory of a work area, in which the stored query results returned by the SELECT statement. The query results can be either zero records, single records, multiple records can be. In the work area defined

  • Use of JAVA to write Oracle stored procedure (to) 2010-12-13

    create or replace and compile java source named "PF" as package org.oraclejava.pro; public class javaCreatePro { public static String test (int num) { return "" + num * num; } }; create or replace function PF_FUN (name number) return v

  • Use JAVA to write Oracle stored procedure (transfer) 2010-12-13

    create or replace and compile java source named "PF" as package org.oraclejava.pro; public class javaCreatePro { public static String test (int num) { return "" + num * num; } }; create or replace function PF_FUN (name number) return v

  • JAVA Oracle stored procedure input parameter in the LIST 2010-11-28

    Today, they want nothing to do over the weekend to try a combination of JAVA and ORACLE extent, the results reflect the combination of these two is really very powerful weapon, never been done before, or since. Hey ~ ~ JAVA for the weekend to help my

  • JAVA calling Oracle stored procedure (to) 2010-12-10

    In large database systems, there are two very important functions, that is, stored procedures and triggers. Whether in the database system stored procedure or trigger, is through SQL statements and control flow statements to complete the set. In cont

  • learning oracle stored procedure 2010-05-15

    Create the stored procedure syntax: create or replace procedure stored procedure name (param1 in type, param2 out type) as Variable 1 type (range); Variable 2 type (range); Begin Select count (*) into the variable 1 from table A where column name = p

  • C # How to call oracle stored procedure in the most simple example 2010-04-26

    C # calling oracle stored procedure example of the simplest Oracle side 1. Create Oracle stored procedure create or replace procedure proce_test (paramin in varchar2, paramout out varchar2, paraminout in out varchar2) as varparam varchar2 (28); begin

  • JAVA and ORACLE stored procedure 2010-07-19

    In large database systems, there are two very important functions, that is, stored procedures and triggers. Whether in the database system stored procedure or trigger, is through SQL statements and control flow statements to complete the set. In cont

  • Create a stored procedure (Oracle) 2010-07-21

    1, create a stored procedure create or replace procedure test (var_name_1 in type, var_name_2 out type) as - Declare variable (variable name the variable type) begin - Body of stored procedure execution end test; Print out the input of time informati

  • Calling oracle stored procedure with java Summary 2009-07-18

    1: no return value stored procedure Stored procedure as follows: CREATE OR REPLACE PROCEDURE TESTA (PARA1 IN VARCHAR2, PARA2 IN VARCHAR2) AS BEGIN INSERT INTO HYQ.B_ID (I_ID, I_NAME) VALUES (PARA1, PARA2); END TESTA; Then, when called inside the java

  • Call oracle stored procedure with java Summary (transfer) 2010-03-07

    A: No return value stored procedure Stored procedure is: CREATE OR REPLACE PROCEDURE TESTA(PARA1 IN VARCHAR2,PARA2 IN VARCHAR2) AS BEGIN INSERT INTO HYQ.B_ID (I_ID,I_NAME) VALUES (PARA1, PARA2); END TESTA; Then, when called in the java in the followi

  • Call oracle stored procedure with java Summary 2010-06-09

    1, what is stored procedure. Stored procedure is a section of the database server-side program, it has two types. A kind of similar to the SELECT query used to retrieve the data, the data can be retrieved in the form of a data set returned to the cus

  • JAVA ORACLE stored procedure call summary 2010-06-13

    1, no return value stored procedure Stored procedure is: (the process is to add the department dept) create or replace procedure adddept (deptno number, dname varchar2, loc varchar2) as begin if deptno is not null then insert into dept values (deptno

  • java call oracle stored procedure sample summary 2010-09-18

    oracle java stored procedure is called an example of a conclusion: no return value stored procedure Stored procedure is: create or replace procedure adddept (colno number, colname varchar2, colc varchar2) as begin insert into table values (colno, col

  • Common Errors in oracle stored procedure to create and debug methods + 2011-05-09

    create or replace procedure testoutput is begin dbms_output.put_line ('hello world! this is the first procedure'); end; / - Compile create or replace procedure a (no1 in number, name1 varchar2, loc varchar2) is dept_number number (2): = no1; dept_nam

  • Java ORACLE stored procedure call 2010-08-21

    1, what is stored procedure. Stored procedure is a database server-side program, it has two types. A similar SELECT query to retrieve the data, the data can be retrieved in the form of a data set returned to the customer. Another similar to the INSER