易截截图软件、单文件、免安装、纯绿色、仅160KB

an example to insert data into Oracle Clob

 Step1. Insert empty_clob() into the Clob column of Oracle
Step2. Set autocommit to false
Step3. Select Clob as oracle.sql.CLOB from database
Step4. Insert String into Clob
Step5. Commit
Example:
import java.sql.*;
import java.io.*;
import oracle.jdbc.driver.OracleResultSet;
import oracle.sql.CLOB;
public class TestOracleClob implements Serializable{
public static void main(String[] args)
{

//create table test (id integer,content clob);
System.out.println("-------------------insert -----------------");
try{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection con = DriverManager.getConnection ("oracle server",
"loginid", "loginpassword");
//Class.forName("oracle.jdbc.driver.OracleDriver");

con.setAutoCommit(false);
//Ok 1
String sql="insert into test values(1,empty_clob())";
Statement stmt=con.createStatement();
ResultSet
rs=stmt.executeQuery(sql);
System.out.println("-------------------insert -----------------");
String sqll="select content from test where id=1 for update";
ResultSet
rss=stmt.executeQuery(sqll);

if(rss.next()){
//CLOB clob = ((OracleResultSet)rss).getCLOB(1);
oracle.sql.CLOB clob= (oracle.sql.CLOB)rss.getClob("content");
clob.putString(1,"here is a string which contains more than 4000 character");
sql="update test set content=? where id=1";
PreparedStatement
pstmt=con.prepareStatement(sql);
pstmt.setClob(1,clob);
pstmt.executeUpdate();
pstmt.close();
}
con.commit();

//Ok 2
//String sql1="insert into test values(2,empty_clob())";
//ResultSet rs3=stmt.executeQuery(sql1);
String sql12="insert into test values(?,?)";
PreparedStatement
pstmt1=con.prepareStatement(sql12);
pstmt1.setInt(1,2);
pstmt


相关文档:

oracle 表信息

 因为项目某些模块的数据结构设计没有严格按照某规范设计,所以只能从数据库中查询数据结构,需要查询的信息如下:字段名称、数据类型、是否为空、默认值、主键、外键等等。
在网上搜索了查询上述信息的方法,总结如下:
一,查询表基本信息
select
    utc.column_name,utc.data_type,utc.data_le ......

ORACLE parent latch和children latch

         About parent vs child latches. There is no fundamental low level difference between parent and child latches, they are all small regions of memory modified with atomic test-and-set style opcodes.
You see parent (and solitary) latches from x$ksll ......

尚学堂oracle笔记

 第一课:客户端
        1. Sql Plus(客户端),命令行直接输入:sqlplus,然后按提示输入用户名,密码。
        2. 从开始程序运行:sqlplus,是图形版的sqlplus.
        3. http://localhost:5560/ ......

转载oracle rollup和cube函数使用心得

 转自:http://blog.csdn.net/wangdongzjk/archive/2005/11/18/532424.aspx
事关CUBE ROLLUP GROUPING SETS(1)
原文引自:
聚合是数据仓库的基础。为了提高聚合的性能。Oracle提供了Group By 条款的扩展。
1. CUBE, ROLLUP扩展
2. 3个grouping函数
 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号