Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Oracle ÏÞÖÆË÷Òý


 
 
ÏÞÖÆË÷ÒýÊÇһЩûÓо­ÑéµÄ¿ª·¢ÈËÔ±¾­³£·¸µÄ´íÎóÖ®Ò»¡£ÔÚSQLÖÐÓкܶàÏÝÚå»áʹһЩË÷ÒýÎÞ·¨Ê¹Óá£ÏÂÃæÌÖÂÛһЩ³£¼ûµÄÎÊÌ⣺ 
 
 
1 Ê¹Óò»µÈÓÚ²Ù×÷·û(<>¡¢!=)
 
 ÏÂÃæµÄ²éѯ¼´Ê¹ÔÚcust_ratingÁÐÓÐÒ»¸öË÷Òý£¬²éѯÓï¾äÈÔȻִÐÐÒ»´ÎÈ«±íɨÃè¡£
 
   select cust_Id,cust_name from  customers where  cust_rating <> 'aa';
 
  °ÑÉÏÃæµÄÓï¾ä¸Ä³ÉÈçϵIJéѯÓï¾ä£¬ÕâÑù£¬ÔÚ²ÉÓûùÓÚ¹æÔòµÄÓÅ»¯Æ÷¶ø²»ÊÇ»ùÓÚ´ú¼ÛµÄÓÅ»¯Æ÷£¨¸üÖÇÄÜ£©Ê±£¬½«»áʹÓÃË÷Òý¡£
 
select cust_Id,cust_name from customers where cust_rating < 'aa' or cust_rating > 'aa';
   Ìرð×¢Ò⣺ͨ¹ý°Ñ²»µÈÓÚ²Ù×÷·û¸Ä³ÉORÌõ¼þ£¬¾Í¿ÉÒÔʹÓÃË÷Òý£¬ÒÔ±ÜÃâÈ«±íɨÃè¡£
 
 
 
 
2 Ê¹ÓÃIS NULL »òIS NOT NULL
 
ʹÓÃIS NULL »òIS NOT NULLͬÑù»áÏÞÖÆË÷ÒýµÄʹÓá£ÒòΪNULLÖµ²¢Ã»ÓỶ¨Òå¡£ÔÚSQLÓï¾äÖÐʹÓÃNULL»áÓкܶàµÄÂé·³¡£Òò´Ë½¨Ò鿪·¢ÈËÔ±ÔÚ½¨±íʱ£¬°ÑÐèÒªË÷ÒýµÄÁÐÉè³ÉNOT NULL¡£Èç¹û±»Ë÷ÒýµÄÁÐÔÚijЩÐÐÖдæÔÚNULLÖµ£¬¾Í²»»áʹÓÃÕâ¸öË÷Òý£¨³ý·ÇË÷ÒýÊÇÒ»¸öλͼË÷Òý£¬¹ØÓÚλͼË÷ÒýÔÚÉÔºóÔÚÏêϸÌÖÂÛ£©¡£
 
 
 
 
3 Ê¹Óú¯Êý
 
Èç¹û²»Ê¹ÓûùÓÚº¯ÊýµÄË÷Òý£¬ÄÇôÔÚSQLÓï¾äµÄWHERE×Ó¾äÖжԴæÔÚË÷ÒýµÄÁÐʹÓú¯Êýʱ£¬»áʹÓÅ»¯Æ÷ºöÂÔµôÕâЩË÷Òý¡£ ÏÂÃæµÄ²éѯ²»»áʹÓÃË÷Òý£¨Ö»ÒªËü²»ÊÇ»ùÓÚº¯ÊýµÄË÷Òý£© 
 
 select empno,ename,deptno  from emp where  trunc(hiredate)='01-MAY-81';
°ÑÉÏÃæµÄÓï¾ä¸Ä³ÉÏÂÃæµÄÓï¾ä£¬ÕâÑù¾Í¿ÉÒÔͨ¹ýË÷Òý½øÐвéÕÒ¡£
select empno,ename,deptno from emp where hiredate<(to_date('01-MAY-81')+0.9999);
 
 
 
  4 ±È½Ï²»Æ¥ÅäµÄÊý¾ÝÀàÐÍ
 ±È½Ï²»Æ¥ÅäµÄÊý¾ÝÀàÐÍÒ²ÊDZȽÏÄÑÓÚ·¢ÏÖµÄÐÔÄÜÎÊÌâÖ®Ò»¡£
   ×¢ÒâÏÂÃæ²éѯµÄÀý×Ó£¬account_numberÊÇÒ»¸öVARCHAR2ÀàÐÍ£¬ÔÚaccount_number×Ö¶ÎÉÏÓÐË÷Òý¡£ÏÂÃæµÄÓï¾ä½«Ö´ÐÐÈ«±íɨÃè¡£
    &nb


Ïà¹ØÎĵµ£º

ÓÃjavaµ÷ÓÃoracle´æ´¢¹ý³Ì×ܽá

ÉùÃ÷£º
ÒÔϵÄÀý×Ó²»Ò»¶¨ÕýÈ·£¬Ö»ÊÇΪÁËÑÝʾ´ó¸ÅµÄÁ÷³Ì¡£
Ò»£ºÎÞ·µ»ØÖµµÄ´æ´¢¹ý³Ì
´æ´¢¹ý³ÌΪ£º
CREATE OR REPLACE PROCEDURE TESTA(PARA1 IN VARCHAR2,PARA2 IN VARCHAR2)  AS
BEGIN
   INSERT INTO HYQ.B_ID (I_ID,I_NAME) VALUES (PARA1, PARA2);
END TESTA;
È»ºóÄØ£¬ÔÚjavaÀïµ÷ÓÃʱ¾ÍÓÃÏÂÃæµÄ´ ......

java jdbc Á¬½ÓOracle9i

     ×Ô¼ºÔÚ×öÕâ¸ö³ÌÐòµÄʱºò¿´¹ýºÜ¶àµÄ×ÊÁÏ£¬ÉÏÍøÒ²²éÁ˲»ÉÙµÄ×ÊÁÏ£¬¿ÉÊǶà°ë˵µÄÊdzöÉñÈ뻯£¬ÔÆÀïÎíÀï...²»¹â¿´Á˲»Ã÷°×£¬¶øÇÒÊÇÓÐÃ÷°×Ò»µãµÄÈË£¬¿´ÁËÒ²±äµÄÓÐЩģºýÁË¡£
     ÕâÀïÎÒÑÚÊÎÒ»Ì×ÍêÕûµÄjava jdbc Á¬½ÓOracle9iµÄ·¶Àý¡£
package com.lxh.dbcon;//´ò°ü
import ......

ÔÚOracleÏ¿ª·¢Java³ÌÐòµÄ¾­µäÎÊÌâ½â´ð

 
ÎÊÌâÒ»£ºÈç±£¼ÓÔØJDBCÇý¶¯³ÌÐò£º
 
Õý³£ÎÒÃǼÓÔØÇý¶¯³ÌÐòÓÐÈý¸ö;¾¶£º
 
1.Class.forName(String)ÕâÏëµ±ÓÚclassLoaderÒ»¸öStringÖ¸¶¨µÄÀ࣬ÔÚ×°ÔØʱ°Ñ¸ÃÇý¶¯³ÌÐòµÄ¾²Ì¬ÄÚÈݶ¼³õʼ»¯£¬ÆäʵÕâʱÇý¶¯³ÌÐòÀàµ÷ÓÃÁËDriverManager.registerDriver(driver)·½·¨¡£
 
2.ʹÓÃϵͳÊôÐÔ£ºSystem.getPro ......

MySQLÓëOracleÊý¾ÝÀàÐÍת»»


MySQL Data Type
Oracle Data Type
BIGINT
NUMBER(19, 0)
BIT
RAW
BLOB
BLOB, RAW
CHAR
CHAR
DATE
DATE
DATETIME
DATE
DECIMAL
FLOAT (24)
DOUBLE
FLOAT (24)
DOUBLE PRECISION
FLOAT (24)
ENUM
VARCHAR2
FLOAT
FLOAT
INT
NUMBER(10, 0)
INTEGER
NUMBER(10, 0)
LONGBLOB
BLOB, RAW
LONGTEX ......

oracleÓësqlserverÖ´ÐÐcount(*)·µ»ØµÄ½á¹û¼æÈÝ

ÓÉÓÚÒÔÇ°¶¼ÊÇÔÚsqlserver 2005´¦Àí£¬ÏÖÔÚ¿Í»§ÒªÇóoracleÊý¾Ý¿â·þÎñÆ÷£¬
×î³õµÄ´úÂëΪ£º
allRecordSize = (Integer) rs1.getObject(1);    //Integer allRecordSize=0;
µ±Ö´ÐеÄʱºò±¨£ºBigDecimalÎÞ·¨×ª»¯ÎªIntegerÀàÐÍ
ΪÁ˼æÈÝÁ½ÕßÐ޸ĺóµÄ´úÂëΪ£º
  Object o = rs1.getObject(1);
 &nbs ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ