Oracle SQLʵÀý
1¡£select * from a where a.rowid=(select min(b.rowid) from b where a.id=b.id);
create test1(
nflowid number primary key,
ndocid number,
drecvdate date);
insert into test1 values (1, 12301, sysdate) ;
insert into test1 values (2, 12301, sysdate);
select * from test1 order by drecvdate:
result:
nflowid ndocid drecvdate
1 12301 2010-2-1
2 12301 2010-2-2
ÒªÇó: ¸ù¾ÝNDOCIDΪ²éѯÌõ¼þ, DRECVDATEÅÅÐò,ÏÔʾÖظ´Êý¾ÝÖÐ×îСµÄÄÇÌõ¼Ç¼
String sql1 = "select * from test1 where ndocid=12301 order by decvdate";
String sql2 = "select * from (" + sql1 + ") a where a.rowid=" +
"(select min(b.rowid) from (" + sql1 + ") b " +
"where a.ndocid=b.ndocid)";
Òªµã: 1. nflowid ÊÇPK, Èç¹û²»ÊÇPK, ÔòÓпÉÄܻᱨ¸æORA-1445 ´íÎó
2. ´ËÓï¾ä,²»¹ÜNFLOWID=1µÄDRECVDAGTE±ÈNFLOWID=2µÄDRECVDATEÔ绹ÊÇÍí,¶¼·µ»Ø:
1, 12301 2010-2-1. ÔÒòÎÒ¾õµÃ:Õâ¸öROWIDòËƾÍÊÇNFLOWIDµÄÖµ
String agentSql = "select u.*, e.ndeputyentityid, e.nentityid " +
"from tbuser u, tbuser_role ur, doc_dept_deputy e " +
"where u.userid = ur.userid " +
"and u.currententityid = e.ndeputyentityid " +
"and ur.roleid=" + roleId;
String aSql = "select * from(" + agentSql + ") a where " +
"a.userpriority=(select min(b.userpriority) from(" + agentSql + ") b " +
"where a.ndeputyentityid = b.ndeputyentityid) " +
"and a.userid=(select min(b.userid) from(" + agentSql + ") b " +
"where a.ndeputyentityid = b.ndeputyentityid and a.userpriority = b.userpriority)";
Òªµã£º
1£© Èç¹ûuserpriorityûÓÐÖظ´Öµ£¬Ôò½á¹û·µ»Øuserpriority×îСֵµÄ¼Ç¼
2£© Èç¹ûuserpriorityÓÐÖظ´Öµ£¬Ôò½á¹û·µ»Øuserid×îСֵµÄ¼Ç¼
Ïà¹ØÎĵµ£º
oracle±í¿Õ¼ä²Ù×÷Ïê½â
1
2
3×÷Õߣº À´Ô´£º ¸üÐÂÈÕÆÚ£º2006-01-04
5
6
7½¨Á¢±í¿Õ¼ä
8
9CREATE TABLESPACE data01
10DATAFILE '/ora ......
/**
* ¸üмǼ£¬Ô×Ó²Ù×÷£¬²»»ácommit
* @param sql_id
* @param condition
* @return
* @throws SQLException
*/
&nbs ......
Checkpoint
ºÜ¶àÈ˶¼°ÑcheckpointµÄ¸ÅÄî¸ø¸´ÔÓ»¯ÁË£¬ÆäʵcheckpointÕâ¸öÊý¾Ý¿â¸ÅÄîÒýÈëµÄÕæÕýÒâÒå¾ÍÊÇÓÃÀ´¼õÉÙÔÚÊý¾Ý¿â
»Ö¸´¹ý³ÌÖÐËù»¨µÄʱ¼ä(instance recovery),ÄÇôcheckpointÊÇÓÉËÀ´×öµÄÄØ?ÎÒÃǶ¼ÖªµÀÊý¾Ý¿âÖÐÓиöCKPT½ø³Ì£¬ÕâÊǸö
¿ÉÑ¡½ø³Ì£¬µ«ÊÇÕæÕýÖ´Ðмì²éµãµÄÈÎÎ ......
http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96524/c21cnsis.htm#2937
Types of Locks
Oracle automatically uses different types of locks to control concurrent access to data and to prevent destructive interaction between users. Oracle automatically locks a resource on behalf of a tran ......
¶ÔÓÚÎÒÃÇÕâ¸öÏîÄ¿À´Ëµ£¬Êý¾Ý¿âµÄ´æÈ¡µÄÐÔÄܾö¶¨ÁËÊý¾ÝÌṩµÄÐÔÄÜ¡£ÓÅ»¯µÄ´óÖµÄÔÀíÖ»ÓÐÁ½¸ö£ºÒ»ÊÇÊý¾Ý·Ö¿é´æ·Å£¬±ãÓÚÊý¾ÝµÄת´¢ºÍ¹ÜÀí£»¶þÊÇÖм䴦Àí£¬Ìá¸ßÊý¾ÝÌṩµÄËٶȡ£
»ùÓÚÉÏÃæÁ½¸ö¸ù±¾µÄÔÀí£¬½èÖúÓÚÊý¾Ý²Ö¿âµÄ¸ÅÄÁоÙÊý¾Ý¿âµÄÓÅ»¯·½Ê½£º
1£® ·ÖÇø
ÔÚÊý¾Ý²Ö¿âÖУ¬ÊÂʵ±í£¬Ë÷Òý±í£¬Î¬¶È±í·Ö´¦ÓÚÈý¸ö²»Í ......