Java µ÷Óà Oracle ´æ´¢¹ý³Ì·µ»Ø½á¹û¼¯
Oracle ´æ´¢¹ý³Ì·µ»Ø½á¹û¼¯Óà ref cursor ʵÏÖ¡£
ÊÔÑé²½ÖèÈçÏ£º
1. ½¨Á¢ ref cursor ÀàÐͺ͹ý³Ì
CREATE OR REPLACE PACKAGE types
AS
TYPE ref_cursor IS REF CURSOR;
END;
/
CREATE TABLE STOCK_PRICES(
RIC VARCHAR(6) PRIMARY KEY,
PRICE NUMBER(7,2),
UPDATED DATE );
/
CREATE OR REPLACE FUNCTION sp_get_stocks(v_price IN NUMBER)
RETURN types.ref_cursor
AS
stock_cursor types.ref_cursor;
BEGIN
OPEN stock_cursor FOR
SELECT ric,price,updated from stock_prices WHERE price < v_price;
RETURN stock_cursor;
END;
2. Óà sqlplus ²âÊÔ¹ý³Ì
SQL> var results refcursor
SQL> exec :results := sp_get_stocks(20.0)
SQL> print results
3. ´Ó Java µ÷ÓÃ
import java.sql.*;
import java.io.*;
import oracle.jdbc.driver.*;
public class JDBCDemo {
/**
* Compile-time flag for deciding which query to use
*/
private boolean useOracleQuery = true;
/**
* Class name of Oracle JDBC driver
*/
private String driver = "oracle.jdbc.driver.OracleDriver";
/**
* Initial url fragment
*/
private String url = "jdbc:oracle:thin:@";
/**
* Standard Oracle listener port
*/
private String port = "1521";
/**
* Oracle style of calling a stored procedure
*/
private String oracleQuery = "begin ? := sp_get_stocks(?); end;";
/**
* JDBC style of calling a stored procedure
*/
private String genericQuery = "{ call ? := sp_get_stocks(?) }";
/
Ïà¹ØÎĵµ£º
Ôڴ󲿷Ö×ÔѧµÄÇé¿öÏ£¬Ñ§Ï°javaÒÑ¿ìÓÐÒ»ÄêÁË£¬×î½ü¿´ÁËÒ»ÏÂjdkÖÐdemoϵÄClockС³ÌÐò£¬ÔÚÎÂÏ°ÁËÒ»ÏÂAppletµÄͬʱ£¬Ò²Ñ§µ½Á˲»ÉÙж«Î÷¡£Ê×ÏÈ£¬AppletµÄ»ù±¾¹Ç¼ÜÊÇÓÉ£ºinit(),start(),stop(),destroy(),paint(Graphics g),repaint()ºÍupdate()Õ⼸¸ö·½·¨¹¹³ÉµÄ¡£
init()ÓÃÀ´³õʼ»¯ÊµÀý£¬start()ÓÃÀ´Æ𶯳ÌÐò ......
һЩÆóÒµÔÚÕÐƸ³ÌÐòÔ±µÄʱºò£¬×Ü»áÌØÒâÌá³öÒ»¸öÒªÇ󣬼´ÒªÇó¾ßÓÐÁ¼ºÃµÄ±àÂë¹æ·¶¡£È·ÊµÏÖÔÚ³ÌÐò¿ª·¢ÈËÔ±ÒѾ²»ÔÚÊǵ¥Ç¹Æ¥ÂíµÄµ¥¸É£¬¶øÊǽ²¾¿ÍÅÌå×÷Õ½¡£´Ëʱ¾ÍÒªÇóÍŶÓÄڵijËÔ±¶¼¿ÉÄܹ»ã¡ÊØ´úÂëµÄ±àд¹æ·¶£¬Õâ¶ÔÓÚ³ËÔ±Ö®¼ä¹²Ïí´úÂë¡¢ÅÅ´íµÈ×÷Òµ¶¼¾ßÓзdz£ÏÖʵµÄÒâÒå¡£ÕâÔÚJavaÓïÑÔÖе±È»Ò²²»ÀýÍâ¡£±ÊÕß½èÕâ´Î»ú»á£¬¾Í¸ú´ó¼Ò·Ö ......
À´Ô´£ºhttp://www.blogjava.net/lcs868/archive/2008/12/16/246644.html
ÓÃjavaʵÏÖ¶Ô´¿ÕæIPÊý¾Ý¿âµÄ²éѯ£¬Ê×Ïȵ½ÍøÉÏÏÂÔØQQwry.daÎļþ£¬¶ÁÈ¡´úÂëÈçÏ£º 1.IP¼Ç¼ʵÌåÀà package com.guess.tools; /** *
* Ò»ÌõIP·¶Î§¼Ç¼£¬²»½ö°üÀ¨¹ú¼ÒºÍÇøÓò£¬Ò²°üÀ¨ÆðʼIPºÍ½áÊøIP * *
* @author swal ......
Executive Overview
The Oracle Data Mining Option provides powerful data mining functionality within the Oracle Database. It enables you to discover new insights hidden in your data and to leverage your investment in Oracle Database technology. With Oracle Data Mining, you can build and apply ......
Navicat for xxx ÊÇÒ»¸öÓÅÐãµÄÊý¾Ý¿â¹ÜÀí¿Í»§¶Ë£¬ÓÐ MySQL¡¢Oracle µÈ°æ±¾¡£½¨Òé´ó¼Ò×îºÃÓà Enterprise °æ±¾£¬¹¦ÄÜÈ«ÃæһЩ£¬µ«½ÏÖ®ÓÚÃâ·ÑµÄ Lite °æ£¬ÆóÒµ°æ¿ÉÊÇÒª»¨Òø×ÓÂòµÄ¡£
°²×° Navicat for Oracle ºó£¬Ê×ÏÈÐèÒª½¨Ò»¸ö“Á¬½Ó”£¬×÷Ϊij¸ö¹ÜÀíÈÎÎñµÄ±êʶ£¬ÒòΪ×÷Ϊ¿ ......