Java调用Oracle存储过程
第一种情况:无返回值.
create or replace procedure test_a(param1 in varchar2,param2 in varchar2) as
begin
insert into test value(param1,param2);
end;
Java调用代码:
package com.test;
import java.sql.*;
import java.io.*;
import java.sql.*;
public class TestProcA
{
public TestProcA(){
}
public static void main(String []args)
{
ResultSet rs = null;
Connection conn = null;
CallableStatement proc = null;
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:test", "test", "test");
proc = conn.prepareCall("{ call test_a(?,?) }");
proc.setString(1, "1001");
proc.setString(2, "TestA");
proc.execute();
}catch(Exception e){
e.printStackTrace();
}finally{
try{
if(null!=rs){
rs.close();
if(null!=proc){
 
相关文档:
oracle表空间操作详解
1
2
3作者: 来源: 更新日期:2006-01-04
5
6
7建立表空间
8
9CREATE TABLESPACE data01
10DATAFILE '/ora ......
oracle让id自动增长(insert时不用手动插入id)的办法,像Mysql中的auto_increment那样
创建序列
create sequence emp_seq
increment by 1
start with 1
nomaxvalue
nocycle
......
测试table
create table table1 (id int,name char)
insert into table1
select 1,'q'
union all select 2,'r'
union all select 3,'3'
union all select 4,'5'
要求按指定的id顺序(比如2,1,4,3)排列获取table1的数据
方法1:使用union all,但是有256条数据的限制
select id,name from table1 where id=2
union al ......
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class Temp {
public Temp() {
JFrame J = new JFrame("MENU");
Container C = J. ......