ORACLE ·ÖÒ³ - Java / Web ¿ª·¢
´ó¼ÒÓöµ½ORACLE·ÖÒ³¶¼ÊÇÔõô´¦ÀíµÄ£¿
ÊÇÓÃSQLÓï¾ä·ÖÒ³£¿»¹ÊÇÓÿɹö¶¯µÄ½á¹û¼¯·ÖÒ³£¿
Ï£Íû´ó¼ÒÄÜ°Ñ´úÂëÌù³öÀ´¡£
×îºó´ó¼Ò¸Ð¾õÄÄÖÖЧÂʸߣ¿ÎªÊ²Ã´£¿
ÒªÊÇÓÃhibernateµÄ»°£¬¾Í²»ÓùÜÊDz»ÊÇoracleÁË¡£
ÎÒÖ»ÖªµÀoracle¿ÉÒÔÓÃrownumÀ´ÏÞÖÆÐÐÊý¡£
°ÑÄãµÄsql·ÅÔÚÄڲ㡣Íâ²ãÓÃrownumÀ´¿ØÖÆÐÐÊý¡£
×î³£ÓõľÍÊÇͨ¹ýrownumÀ´·ÖÒ³£¬ÕâÖÖ·½Ê½±È½ÏÈÝÒ×Àí½â£¬Ð§ÂÊÊÊÖУ¬Àý£º²é³öemp±íÀïµÚ5Ðе½µÚ10ÐеÄÊý¾Ý£º
select * from (select a.*,rownum rn from (select * from emp) a where rownum<=10) where rn>=5;
¢Ù×îÀï²ãµÄ×÷ÓÃÊǸù¾ÝÌõ¼þµÃ³ö½á¹û¼¯£»
¢ÚÖмä²ãµÄ×÷ÓÃʽ¸ù¾ÝÐеÄÉÏÏ޵õ½°üº¬Õâ¸ö±íµÄÈ«²¿ÐÅÏ¢£¬ºÍÐкŵÄÊÓͼ¡£´Ëʱ°ÑαÁÐrownum±ä³ÉÁËÒ»¸öʵ¼ÊµÄÁУ¬²¢¸øËüÆðÁËÒ»¸ö±ðÃû½Ðrn£»
¢Û×îÍâ²ã¸ù¾ÝrnÁнøÐÐ×îºóµÄɸѡ¡£
Èç¹û³ýÁË¡°È¡Ä³¼¸ÐС±Ö®ÍâÔÙ¼ÓÆäËûµÄÌõ¼þ£¬¾ÍÔÚ×îÀïÃæÒ»²ã×Ó²éѯÀïɸѡ¼´¿É¡£
Oracle·ÖÒ³Óï¾ä£¬ÔÚ Oracle ÖзÖÒ³ÓÐÁ½ÖÖ SQL Óï¾ä
Ò»¡¢Ê¹Óà ROWNUM Õâ¸öαÁнøÐзÖÒ³£¬ÐèҪǶÌ×Á½¸ö×Ó²éѯ£º
SQL code:
SELECT * from (
SELECT t.*, rownum AS rn from (
SELECT * from t_news m ORDER BY m.id
) t
) x
WHERE x.rn >= 6 AND x.rn <= 10;
¶þ¡¢Ê¹Óà row_number() ·ÖÎöº¯Êý£¬ÐèҪǶÌ×Ò»¸ö×Ó²éѯ£º
SQL code:
SELECT * from (
SELECT t.*, row_number
Ïà¹ØÎÊ´ð£º
µ±ÖªµÀÒ»¸öÈÕÆÚ£¬ÈçºÎ°ÑÕâ¸öÈÕÆÚËùÔÚÑ®µÄÇ°ºóÁ½¸öÈÕÆÚÈ¡³ö
±ÈÈçÊäÈë20090905£¬¾ÍÊäÈë20090901 20090910
Êä³ö20090901 20090910
È¡µÃÌìÊýºó×÷Ò»ÏÂÅжÏÔÙ°ÑÕâ¸ö·½·¨ÓÃÏÂvoid set(int field, int value)
......
ÎÒÏÖÔÚÓÃstruts2¿ò¼Ü,ÐèҪʹÓÃajaxʵÏÖ¾Ö²¿Ë¢Ð£¬µ«ÊÇ´ÓÈÝÆ÷Àï·µ»ØµÄÖµ²»ÖªµÀÔõô´Óstruts.xmlÅäÖÃÎļþÀïÓ³Éäµ½jspÒ³ÃæÀÒÔÇ°servletÀïдout.orint("xxxxx")¾Í¿ÉÒԵõ½~£¬µ«ÊÇÏÖÔÚÓÃstruts¾Í²»ÖªµÀÔõôР......
private static final String URL = "jdbc:oracle:thin:@localhost:1521:orcl";
private static final String USERNAME = "sys";
private static final String PASSWORD = "s ......
<html><head><title>[@title]</title>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<script language='javascript'>
function diyCheck ......
ÎÒÓÐÒ»¸ö±í£¬½á¹¹ÊÇÕâÑù¡£
ת³ö µ¥Î» תÈ뵥λ ±ÊÊý ½ð¶î
date(Ö÷) outid(Ö÷) inid(Ö÷) num amt
2009 1 2 1 500 Ϊ 1 µ¥Î» ÔÚ2009Ä ......