Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : sql

SQLÓïÑԵIJ¼¾ÖºÍIllegalArgumentException

ºÍjava.lang.IllegalArgumentException: org.hibernate.QueryException: JPA-style positional param was not an integral ordinalÕ½¶·ÁË°ëÌ죬º¹°¡£¡
ʹÓÃjpa + strut+ hibernate ¾Í±¨org.hibernate.QueryException: JPA-style positional param was not an integral ordinal
Ò»°ã°ÑhqlÓï¾äдÔÚÒ»ÐУ¬»áºÜ³¤£¬ÔÚideÖÐÐèÒªÍ϶¯¹ö¶¯Ìõ²ÅÄܲ鿴¡£ÎªÁË·½±ãÔĶÁ£¬¹Ê¸Ä³É¼¸ÐУº
public List<Resource> getResourceByTag(Tag tag,int start) {
        Query query = entityManager.createQuery(
                "SELECT r from Resource r WHERE ?1" +
                "IN (SELECT t from r.res_tags t)" +
                "ORDER BY r.res_update_date DESC");
        query.setParameter(1, tag);
        query.setFirstResult(start);
     &n ......

access ·ÖÒ³Óà SQL²éѯÓï¾ä

select top ÿҳÏÔʾµÄ¼Ç¼Êý * from topic where id not in (select top £¨µ±Ç°µÄÒ³Êý-1£©×ÿҳÏÔʾµÄ¼Ç¼Êý id from topic order by id desc) order by id desc
select top ÿҳÏÔʾµÄ¼Ç¼Êý * from topic where id not in (select top £¨µ±Ç°µÄÒ³Êý-1£©×ÿҳÏÔʾµÄ¼Ç¼Êý id from topic order by id desc) order by id desc ......

access ·ÖÒ³Óà SQL²éѯÓï¾ä

select top ÿҳÏÔʾµÄ¼Ç¼Êý * from topic where id not in (select top £¨µ±Ç°µÄÒ³Êý-1£©×ÿҳÏÔʾµÄ¼Ç¼Êý id from topic order by id desc) order by id desc
select top ÿҳÏÔʾµÄ¼Ç¼Êý * from topic where id not in (select top £¨µ±Ç°µÄÒ³Êý-1£©×ÿҳÏÔʾµÄ¼Ç¼Êý id from topic order by id desc) order by id desc ......

ͬһ¸ö½»²æ±íµÄ¶¯Ì¬SQLʵÏÖ

DECLARE
 TYPE list IS TABLE OF t_stu.project%TYPE INDEX BY BINARY_INTEGER;
 project_list list;
 v_pro_num NUMBER;
 sql_str VARCHAR(255);
 
t_stu
SID SUBJECT SCORE
1        Êýѧ         99
1        Ó¢Óï         68
1        ·¨ÂÉ         79
2        Êýѧ         92
2        Ó¢Óï         72
2        ·¨ÂÉ         96
ʵÏÖ======
SID
Êýѧ
Ó¢Óï
·¨ÂÉ
1
99
68
79
2
92
72
96
 
DECLARE
 TYPE list IS TABLE OF t_stu.subject%TYPE INDEX BY BINARY_INTEGER;
 subject_list li ......

¾¡Á¿±ÜÃâÔÚSQLÓï¾äÖÐʹÓÃOR

----start
    ÔÚSQLÓï¾äÖÐÓ¦¸Ã¾¡Á¿±ÜÃâʹÓÃOR£¬ÒòΪÕâÑù×ö»áÓ°ÏìSQLÓï¾äµÄÐÔÄÜ¡£¿¼ÂÇÏÂÃæµÄÇé¿ö£º
CREATE TABLE USER
(
NAME VARCHAR(20) NOT NULL,---ÐÕÃû
BIRTHDAY DATE---ÉúÈÕ
); 
ÏÖÔÚÓÐÕâÑùÒ»¸öÎÊÌ⣺ÈÃÄã²éÕÒÒ»ÏÂÉúÈÕÊÇ1949-10-1£¨¹²ºÍ¹úͬÁäÈË£©»ò1978-12-18£¨Ê®Ò»½ìÈýÖÐÈ«»áÕÙ¿ªÊ±¼ä£©µÄÈË£¬Ôõô°ì£¿
ÎÒÃǺÜ×ÔÈ»¾Í»á°ÑÕâ¾ä»°·­Òë³ÉÈçÏÂSQLÓï¾ä£º
SELECT * from USER WHERE BIRTHDAY='1949-10-1' OR BIRTHDAY='1978-12-18' 
ÕâÑù×öÍêÈ«ÕýÈ·£¬¿ÉÊÇÐÔÄܲ»ºÃ£¬ÄãµÄ˼Ïë±»Õâ¸öÎÊÌâÊø¸¿ÁË£¬ÎÒÃÇ»¹¿ÉÒÔÕâôд£º
SELECT * from USER WHERE BIRTHDAY IN ('1949-10-1','1978-12-18'); 
ÓÐʱºò£¬ÎÒÃDz»Òª°Ñ×Ô¼ºÊø¸¿ÔÚÎÊÌâÀïÃæ¡£
---¸ü¶à²Î¼û£ºDB2 SQL ¾«Òª
----ÉùÃ÷£º×ªÔØÇë×¢Ã÷³ö´¦¡£
----last update at 2009.9.24
----write by wave at 2009.9.24
----end ......

¹ØÓÚSQL ServerËÀËø

transaction 1:
------------------------------------------------------
 begin transaction
  update table1 set cola = 'str1'
  Waitfor time '10:12:00'
  update table2 set colb = 'str2'
 rollback transaction
 
transaction 2:
------------------------------------------------------
 begin transaction
  update table2 set colb = 'str2'
  Waitfor time '10:12:00'
  update table1 set cola = 'str1'
 rollback transaction
 
ͬʱÔËÐÐÕâÁ½¸öÊÂÎñ£¬½«µ¼ÖÂËÀËø¡£(ÏÈ´´½¨table1ºÍtable2£¬²¢²åÈëһЩֵ£»waitfor time Êʵ±ÐÞ¸Ä)
SQL Server±¾Éí»á´¦ÀíËÀËø£¬Í¨¹ýÑ¡ÔñÒ»¸öËÀËøÎþÉüÆ·£¬»Ø¹öËÀËøÎþÉüÆ·µÄÊÂÎñ£¬À´±ÜÃâËÀËø¡£
SQL ServerÔÚÉÏÃæÕâÁ½¸öÊÂÎñÖÐ×Ô¶¯Ñ¡ÔñÒ»¸ö×÷ΪËÀËøÎþÉüÆ·£¬¸ÃÊÂÎñ½«ÊÕµ½ÈçÏÂÏûÏ¢£º
------------------------------------------------------
 Msg 1205, Level 13, State 56, Line 7
 ÊÂÎñ(½ø³Ì ID 52)ÓëÁíÒ»¸ö½ø³Ì±»ËÀËøÔÚ Ëø ×ÊÔ´ÉÏ£¬²¢ÇÒÒѱ»Ñ¡×÷ËÀËøÎþÉüÆ·¡£ÇëÖ ......

sqlÊý¾Ý¿â£ºÈçºÎÔÚÒ»¸ö±íÖÐÌî¼Ó»òÕßɾ³ýÒ»¸ö×ֶΣ¡


ÈçÒªÔÚÒ»¸öhwsp±íÖÐÌî¼Ó×ֶΣºylxs
alter table hwsp add column ylxs
ALTER TABLE ±í {ADD ADD{COLUMN ×Ö¶ÎÀàÐÍ [ (×Ö³¤)] [NOT NULL]     [CONSTRAINT Ë÷Òý ] |
     ALTER COLUMN ×Ö¶ÎÀàÐÍ [(×Ö³¤)] |
     CONSTRAINT ¶àÖØ×Ö¶ÎË÷Òý } |
     DROP DROP{COLUMN ×ֶΠI CONSTRAINT Ë÷ÒýÃû } }
ALTER TABLE Óï¾ä·ÖΪÒÔϼ¸¸ö²¿·Ö£º
²¿·Ö ˵Ã÷
table ÓûÐ޸ĵıíÖ®Ãû³Æ¡£
field ÓûÔÚ±íÄÚÔö¼Ó»òɾ³ýµÄ×ֶεÄÃû³Æ¡£»ò±íÄÚÓû±»Ìæ»»µÄ×Ö¶ÎÃû³Æ¡£
type ×ֶεÄÊý¾ÝÀàÐÍ¡£
size ×ֶεÄ×Ö·û³¤¶È (Îı¾¼°¶þ½øÖÆ×Ö¶Î)¡£
index ×Ö¶ÎË÷Òý¡£ÓûÁ˽â¸ü¶àÓйØÈçºÎ¹¹Ôì±¾Ë÷ÒýµÄÐÅÏ¢£¬Çë¿´ CONSTRAINT×Ӿ䡣  
multifieldindex ÓûÔö¼ÓÖÁ±í ÖеĶàÖØ×Ö¶ÎË÷ÒýµÄ¶¨Òå¡£ÓûÁ˽â¸ü¶àÓйØÈçºÎ¹¹Ôì±¾Ë÷ÒýµÄÐÅÏ¢£¬Çë¿´ CONSTRAINT×Ӿ䡣
indexname Óûɾ³ýµÄ¶àÖØ×Ö¶ÎË÷ÒýµÄÃû³Æ¡£
˵Ã÷
ʹÓà ALTER TABLE Óï¾ä£¬¿ÉÓöàÖÖ²»Í¬·½·¨¸ü¸Äµ±Ç°ÒÑ´æÔÚµÄ±í£ºÄã¿ÉÒÔ£º
ʹÓà ADD COLUMN ÔÚ±íÖÐÌí¼ÓеÄ×ֶΡ£ÐèÒªÖ¸¶¨×Ö¶ÎÃû¡¢Êý¾ÝÀàÐÍ¡¢»¹¿ÉÒÔ (¶ÔÎı¾ºÍ¶þ½øÖÆ×Ö¶Î)Ö¸¶¨³¤¶È¡£ÀýÈ磬ÏÂÁÐÓï¾äÔÚÔ ......
×ܼǼÊý:4346; ×ÜÒ³Êý:725; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [704] [705] [706] [707] 708 [709] [710] [711] [712] [713]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ