oracle±Ê¼Ç
--oralceÖдӱíÖÐËæ»úÈ¡³önÌõ¼Ç¼
select * from (select t.*,dbms_random.random num from fms_branch_info t order by num)
where rownum <= 5;
--È¡Ç°Ê®ÐÐ
SELECT t.* from fms_branch_info t
WHERE ROWNUM != 10
--WHERE ROWNUM between 1 and 10
ORDER BY branch_code;
--È¡µÚ¶þ¸öÊ®ÐÐ
select *
from (SELECT t.*,ROWNUM AS rn from fms_branch_info t)
where rn BETWEEN 11 AND 20;
--È¡×îºóÊ®ÐÐ
select st.*
from (SELECT t.*,ROWNUM AS rn from fms_branch_info t) st
where rn >
(
SELECT MAX(st.rn -10)
from (SELECT t.*,ROWNUM AS rn from fms_branch_info t) st
);
--È¡ËùÓÐÆæÊý£¨Å¼Êý£©ÐÐ
select st.*
from (SELECT t.*,ROWNUM AS rn from fms_branch_info t) st
where mod(rn,2) != 0
ORDER BY branch_code;
--OracleÖÐdecodeº¯ÊýÓ÷¨
º¬Òå½âÊÍ£º
decode(Ìõ¼þ,Öµ1,·µ»ØÖµ1,Öµ2,·µ»ØÖµ2,...Öµn,·µ»ØÖµn,ȱʡֵ)
decode(×ֶλò×ֶεÄÔËË㣬ֵ1£¬Öµ2£¬Öµ3£©
SELECT DECODE (value, <if this value>, <return this value>) from table
Õâ¸öº¯ÊýÔËÐеĽá¹ûÊÇ£¬µ±×ֶλò×ֶεÄÔËËãµÄÖµµÈÓÚÖµ1ʱ£¬¸Ãº¯Êý·µ»ØÖµ2£¬·ñÔò·µ»ØÖµ3
µ±È»Öµ1£¬Öµ2£¬Öµ3Ò²¿ÉÒÔÊDZí´ïʽ£¬Õâ¸öº¯ÊýʹµÃijЩsqlÓï¾ä¼òµ¥ÁËÐí¶à
¸Ãº¯ÊýµÄº¬ÒåÈçÏ£º
IF Ìõ¼þ=Öµ1 THEN
¡¡¡¡¡¡¡¡RETURN(·µ»ØÖµ1)
ELSIF Ìõ¼þ=Öµ2 THEN
¡¡¡¡¡¡¡¡RETURN(·µ»ØÖµ2)
¡¡¡¡¡¡¡¡......
ELSIF Ìõ¼þ=Öµn THEN
¡¡¡¡¡¡¡¡RETURN(·µ»ØÖµn)
ELSE
¡¡¡¡¡¡¡¡RETURN(ȱʡֵ)
END IF
ʹÓ÷½·¨£º
1¡¢±È½Ï´óС
select decode(sign(±äÁ¿1-±äÁ¿2),-1,±äÁ¿1,±äÁ¿2) from dual; --È¡½ÏСֵ
sign()º¯Êý¸ù¾Ýij¸öÖµÊÇ0¡¢ÕýÊý»¹ÊǸºÊý£¬·Ö±ð·µ»Ø0¡¢1¡¢-1
ÀýÈ磺
±äÁ¿1=10£¬±äÁ¿2=20
Ôòsign(±äÁ¿1-±äÁ¿2)·µ»Ø-1£¬decode½âÂë½á¹ûΪ“±äÁ¿1”£¬´ïµ½ÁËÈ¡½ÏСֵµÄÄ¿µÄ¡£
2¡¢´Ëº¯ÊýÓÃÔÚSQLÓï¾äÖÐ
Ïà¹ØÎĵµ£º
Ò»¡¢Á˽ⱸ·ÝµÄÖØÒªÐÔ
¡¡¡¡¿ÉÒÔ˵£¬´Ó¼ÆËã»úϵͳ³öÊÀµÄÄÇÌìÆ𣬾ÍÓÐÁ˱¸·ÝÕâ¸ö¸ÅÄ¼ÆËã»úÒÔÆäÇ¿´óµÄËٶȴ¦ÀíÄÜÁ¦£¬È¡´úÁ˺ܶàÈËΪµÄ¹¤×÷£¬µ«ÊÇ£¬ÍùÍùºÜ¶àʱºò£¬ËüÓÖÊÇÄÇôÈõ²»½û·ç£¬Ö÷°åÉϵÄоƬ¡¢Ö÷°åµç·¡¢ÄÚ´æ¡¢µçÔ´µÈÈκÎÒ»Ïî²»ÄÜÕý³£¹¤×÷£¬¶¼»áµ¼Ö¼ÆËã»úϵͳ²»ÄÜÕý³£¹¤×÷¡£µ±È»£¬ÕâЩË𻵿ÉÒÔÐÞ¸´£¬²»»áµ¼ÖÂÓ¦Óú ......
Ò»¸öÓû§¿ÉÒÔʹÓÃÒ»¸ö»ò¶à¸ö±í¿Õ¼ä£¬Ò»¸ö±í¿Õ¼äÒ²¿ÉÒÔ¹©¶à¸öÓû§Ê¹Óá£Óû§ºÍ±í¿Õ¼äûÓÐÁ¥Êô¹Øϵ£¬±í¿ÕÊÇÒ»¸öÓÃÀ´¹ÜÀíÊý¾Ý´æ´¢Âß¼¸ÅÄ±í¿Õ¼äÖ»ÊǺÍÊý¾ÝÎļþ·¢Éú¹Øϵ£¬Êý¾ÝÎļþÊÇÎïÀíµÄ£¬Ò»¸ö±í¿Õ¼ä¿ÉÒÔ°üº¬¶à¸öÊý¾ÝÎļþ£¬¶øÒ»¸öÊý¾ÝÎļþÖ»ÄÜÁ¥ÊôÒ»¸ö±í¿Õ¼ä¡£
Óû§ÊôÓÚÊý¾Ý¿âʵÀýµ ......
OS :RHEL AS 4 oracle 10g
0±¸·Ý½Å±¾
#!/bin/bash
# incremental level 0 backup script
source /home/oracle/.bash_profile
current_day=`date +%Y%m%d`
mkdir /home/ora ......
package com.svse.dao;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class UserDAO {
/*
* javaµ÷Óô洢¹ý³Ì
*/
public int addUser(String username,int userage)
{
Connection conn = null;
int useri ......