oracle cast() º¯ÊýÎÊÌâ
¹Ø¼ü×Ö: oracle cast() º¯ÊýÎÊÌâ
SQL> create table t1(a varchar(10));
Table created.
SQL> insert into t1 values ('12.3456');
1 row created.
SQL> select round(a) from t1;
ROUND(A)
----------
12
SQL> select round(a,3) from t1;
ROUND(A,3)
----------
12.346
SQL> select cast(a as int) from t1;
CAST(AASINT)
------------
12
SQL> select cast(a as number(8,4)) from t1;
CAST(AASNUMBER(8,4))
--------------------
12.3456
=========================================================
cast ÊǽøÐÐÀàÐÍת»»µÄ, ¿ÉÒÔÕë¶Ô¸÷ÖÖOracleÊý¾ÝÀàÐÍ. Ð޸ĵÄÊÇÓû§µÄÊý¾ÝÀàÐÍ.
roundÖ»ÊÇÐ޸ĵÄÊý¾ÝÏÔʾ¸ñʽ. ¶ÔÊý¾Ý×öËÄÉáÎåÈë. ÀàËƵĺ¯Êý»¹ÓÐceil(È¡´ËÊý¾ÝµÄ×îСÕûÊý). trunc( È¡Õûº¯Êý.)
¸´ÖÆÄÚÈݵ½¼ôÌù°å
´úÂë:
SQL> select round(12.45) round,trunc(12.45) trunc,ceil(12.45) ceil
2 from dual
3 /
ROUND TRUNC CEIL
---------- ---------- ----------
12 12 13
SQL> select round(12.54) round,trunc(12.54) trnc,ceil(12.54) ceil
2 from dual
3 /
ROUND TRNC CEIL
---------- ---------- ----------
13 12 13
SQL>
Ïà¹ØÎĵµ£º
ÔÚOracleÖÐʹÓÃGuid
ÔÚOracleÖпÉÒÔÓÃSYS_GUID()À´Éú³ÉÒ»¸öguid,Ï൱ÓÚmsSqlÖеÄnewid()¡£
ÔÚOracle9iºÍOracle 10g ÀïSYS_GUID²úÉúµÃµ½µÄÊý¾ÝÊÇ32 λµÄ£¬È磺234E45F0077881AAE0430AA3034681AA
µ«OracleÖеÄguidÓëmsSqlÖеÄguid¸ñʽ²»ÍêÈ«Ïàͬ¡£
½«OracleÖеÄguid·Ö¸î³ÉΪ Windowsϵͳ ObjectId µÄ¸ñʽ£º{8-4-4-4-12} £ ......
×ܽáÁËÒ»ÏÂɾ³ýÖظ´¼Ç¼µÄ·½·¨£¬ÒÔ¼°Ã¿ÖÖ·½·¨µÄÓÅȱµã¡£
¼ÙÉè±íÃûΪTbl£¬±íÖÐÓÐÈýÁÐcol1£¬col2£¬col3£¬ÆäÖÐcol1£¬col2ÊÇÖ÷¼ü£¬²¢ÇÒ£¬col1£¬col2ÉϼÓÁËË÷Òý¡£
1¡¢Í¨¹ý´´½¨ÁÙʱ±í
¿ÉÒÔ°ÑÊý¾ÝÏȵ¼Èëµ½Ò»¸öÁÙʱ±íÖУ¬È»ºóɾ³ýÔ±íµÄÊý¾Ý£¬ÔÙ°ÑÊý¾Ýµ¼»ØÔ±í£¬SQLÓï¾äÈçÏ£º
creat table tbl_tmp (select distinct* from tb ......
C#ÖвÙ×÷OracleʱµÄSQLÓï¾ä²ÎÊýµÄÓ÷¨
OracleTransaction myTrans ;
conn.Open();
myTrans =conn.BeginTransaction(IsolationLevel.ReadCommitted) ......
in/not inÔÚÅжÏNULLʱÓõÄÓë=/<>Ò»ÑùµÄ·½Ê½£¬¼´±ØÐëÓÃis nullÀ´Åжϣ¬·ñÔòʼÖÕΪʧ°Ü¡£
Óï¾ä
select 'true' from dual where (1,2) not in ((2,3),(2,null));
³É¹¦µÄÔÒòÔÚÓÚÅж϶þÔªÖµÊ±Ê ......
1.ÔÚɾ³ýÒ»¸ö±íÖеÄÈ«²¿Êý¾Ýʱ£¬ÐëʹÓÃTRUNCATE TABLE ±íÃû;ÒòΪÓÃDROP TABLE£¬DELETE * from ±íÃûʱ£¬TABLESPACE±í¿Õ¼ä¸Ã±íµÄÕ¼Óÿռ䲢δÊÍ·Å£¬·´¸´¼¸´ÎDROP£¬DELETE²Ù×÷ºó£¬¸ÃTABLESPACEÉÏ°ÙÕ׵Ŀռä¾Í±»ºÄ¹âÁË¡£
¡¡¡¡
¡¡¡¡2.having ×Ó¾äµÄÓ÷¨
¡¡¡¡
¡¡¡¡having ×Ó¾ä¶Ô group by ×Ó¾äËùÈ·¶¨µÄÐÐ×é½øÐпØÖÆ,having ×Ó ......