SQL ServerºÍOracleµÄ³£Óú¯Êý¶Ô±È
---------Êýѧº¯Êý
1.¾ø¶ÔÖµ
S:select abs(-1) value
O:select abs(-1) value from dual
2.È¡Õû(´ó)
S:select ceiling(-1.001) value
O:select ceil(-1.001) value from dual
3.È¡Õû£¨Ð¡£©
S:select floor(-1.001) value
O:select floor(-1.001) value from dual
4.È¡Õû£¨½ØÈ¡£©
S:select cast(-1.002 as int) value
O:select trunc(-1.002) value from dual
5.ËÄÉáÎåÈë
S:select round(1.23456,4) value 1.23460
O:select round(1.23456,4) value from dual 1.2346
6.eΪµ×µÄÃÝ
S:select Exp(1) value 2.7182818284590451
O:select Exp(1) value from dual 2.71828182
7.È¡eΪµ×µÄ¶ÔÊý
S:select log(2.7182818284590451) value 1
O:select ln(2.7182818284590451) value from dual; 1
8.È¡10Ϊµ×¶ÔÊý
S:select log10(10) value 1
O:select log(10,10) value from dual; 1
9.ȡƽ·½
S:select SQUARE(4) value 16
O:select power(4,2) value from dual 16
10.ȡƽ·½¸ù
S:select SQRT(4) value 2
O:select SQRT(4) value from dual 2
11.ÇóÈÎÒâÊýΪµ×µÄÃÝ
S:select power(3,4) value 81
O:select power(3,4) value from dual 81
12.È¡Ëæ»úÊý
S:select rand() value
O:select sys.dbms_random.value(0,1) value from dual;
13.È¡·ûºÅ
S:select sign(-8) value -1
O:select sign(-8) value from dual -1
----------Èý½Çº¯ÊýÏà¹Ø
14.Ô²ÖÜÂÊ
S:SELECT PI() value 3.1415926535897931
O:²»ÖªµÀ
15.sin,cos,tan ²ÎÊý¶¼ÒÔ»¡¶ÈΪµ¥Î»
ÀýÈ磺select sin(PI()/2) value µÃµ½1£¨SQLServer£©
16.Asin,Acos,Atan,Atan2 ·µ»Ø»¡¶È
17.»¡¶È½Ç¶È»¥»»(SQLServer£¬Oracle²»ÖªµÀ)
DEGREES£º»¡¶È-¡µ½Ç¶È
RADIANS£º½Ç¶È-¡µ»¡¶È
---------ÊýÖµ¼ä±È½Ï
18. Ç󼯺Ï×î´óÖµ
S:select max(value) value from
(select 1 value
union
select -2 value
union
select 4 value
union
select 3 value)a
O:select greatest(1,-2,4,3) value from dual
19. Ç󼯺Ï×îСֵ
S:select min(value) value from
(select 1 value
union
select -2 value
union
select 4 value
union
select 3 value)a
O:select least(1,-2,4,3) value from dual
20.ÈçºÎ´¦ÀínullÖµ(F2ÖеÄnullÒÔ10´úÌæ)
S:select F1,IsNull(F2,10) value from Tbl
O:select F1,nvl(F2,10) value from Tbl
--------×Ö·û´®º¯Êý
21.Çó×Ö·ûÐòºÅ
S:select asci
Ïà¹ØÎĵµ£º
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ
......
OracleÊý¾Ý×ֵ䳣Óòéѯ
--²é¿´µ±Ç°Óû§ËùÓÐ±í¼°ÃèÊö
select o.object_name,c.comments
from user_objects o
left outer join user_tab_comments c
on o.object_name=c.table_name
where object_type='TABLE'
and c.comments like '%ÏîÄ¿%'
--²é¿´µ±Ç°Óû§ËùÓÐ×Ö¶ÎÐÅÏ¢¼°ÃèÊö
select c.table ......
ÎÊÌâ
£¨1£©±íemployeesºÍdepartment´æÔÚ²ÎÕÕÍêÕûÐÔÔ¼Êø£¬ÔÚ±íemployeesÖвåÈë¼Ç¼£¨‘70’£¬‘999’£©department_idΪ‘999’ʱ£¬department±íÖл¹²»´æÔÚdepartment_idΪ‘999’µÄ¼Ç¼£¬ËùÒÔÎ¥±³Á˲ÎÕÕÍêÕûÐÔÔ¼Êø,³öÏÖ“Integrity constraint violation error”ÌáʾÐÅÏ ......
ºÃ¼¸´ÎÏëÓõ½ÍâÁ¬½ÓµÄʱºò¶¼ÍüÁ˾ßÌåµÄÓ÷¨ÊÇÔõÑùµÄ£¬±ÈÈç˵£¨+£©¸Ã¼ÓÔڵȺŵÄÄÄÒ»¶Ë£¬»òÕßLFET OUTER JOIN¸ÃÓÃÔÚÕûÌõÓï¾äÖеÄÄĸö²¿·Ö¡£½ñÌìÕýºÃÓÖÅöµ½Ò»¸öÏà¹ØµÄÎÊÌ⣬½è´Ë»ú»á×ܽáһϣ¬ÒÔºóÒ²·½±ã²éѯ£¬²»ÓÃÿ´Î¶¼È¥°Ù¶ÈÁË¡£
//table1ºÍtable2ΪÁ½¸ö²âÊÔ±í Ëæ±ã²åÈ뼸ÌõÊý¾Ý
SQL> select * from table1;
......
Oracle JOB Ó÷¨Ð¡½á
Ò»¡¢ÉèÖóõʼ»¯²ÎÊý job_queue_processes
¡¡¡¡sql> alter system set job_queue_processes=n;£¨n>0£©
¡¡¡¡job_queue_processes×î´óֵΪ1000
¡¡¡¡
¡¡¡¡²é¿´job queue ºǫ́½ø³Ì
¡¡¡¡sql>select name,description from v$bgprocess;
¡¡¡¡
¡¡¡¡¶þ£¬dbms_job package Ó÷¨½éÉÜ
¡¡¡¡ ......