数据库

位置:IT落伍者 >> 数据库 >> 浏览文章

OracleSqlserver转化


发布日期:2023年12月21日
 
OracleSqlserver转化

Oracle SqlServer 比较

ORACLE * SQLSERVER 描述

ROWNUM ① select identity(int) rownum列名 into #temp from 表

select * from #temp where rownum> and rownum<=

牺牲性能

② select ROW_NUMBER() OVER (ORDER BY 列名 desc) AS rowNum* from 表名

ORDER BY 列名 desc

可以列出所有记录RowNUM不能用于条件

③ Select top N from 表

存储过程里面定义函数 不支持

TYPE work_table is TABLE of VARCHAR() INDEX BY BINARY_INTEGER; DECLARE @ltb_mailplan Table(ColName VARCHAR() null)

lv_startdate VARCHAR() DECLARE @lv_startdate VARCHAR()

MOD %

trunc(sysdate to_date(//yyyy/mm/dd)) SELECT datediff( day //getdate() )

TO_CHAR(sysdateDY) set language NKorean

select datename(weekday getdate())

星期几

select INSTR(sdsqs) value from dual select CHARINDEX(ssdsq) value

TO_CHAR(sysdateDD) DatePart(GetdateDD

select trunc(sysdate) value from dual

select to_char(sysdateyyyymmdd) value from dual

select convert(char()getdate()) value

TO_CHAR(sysdateYYYY/MM/DD) SELECT LTRIM(RTRIM(CONVERT(varchar() GETDATE() )))

TO_CHAR(sysdateHH:MI:SS) SELECT LTRIM(RTRIM(CONVERT(varchar() GETDATE() ))) ::

TO_CHAR(sysdateYYYY/MM/DD HH:MI:SS) CONVERT(varchar() GETDATE() )

PRAGMA AUTONOMOUS_TRANSACTION; BEGIN TRANSACTION

|| +

RAISE_APPLICATION_ERROR( lv_msg); ①

EXEC sp_addmessage @msgnum = @severity =

@msgtext = %s login failed!@lang = us_english

EXEC sp_addmessage @msgnum = @severity =

@msgtext = %!登陆失败!

RAISERROR( Xing)

错误信息处理

② RAISERROR(Xingaixin) >个人定制信息

CURSOR lcur_mailplan (daid AvGomacSettingsDataAreaId%TYPE) IS :

SELECT DISTINCT avMailplan FROM avtimeperiod

WHERE DataAreaId = daid AND TRUNC(avTpdate) = TRUNC(sysdate);

DECLARE lcur_mailplan CURSOR FOR

SELECT DISTINCT avMailplan FROM avtimeperiod

WHERE DataAreaId = @lv_dataareaid AND CONVERT(varchar()avTpdate) =CONVERT(varchar()GetDate());

>个人定制信息

FOR tp_rec IN lcur_mailplan (@lv_dataareaid)

LOOP

@ltb_mailplan(@lbi_index) = tp_recAvMailplan;

@lbi_index = @lbi_index + ;

END LOOP;

OPEN lcur_mailplan

FETCH lcur_mailplan INTO @ltb_mailplan_Value

WHILE(@@FETCH_STATUS=)

BEGIN

BEGIN

INSERT INTO @ltb_mailplan(ColName)

VALUES (@ltb_mailplan_Value)

END

FETCH lcur_mailplan INTO @ltb_mailplan_Value

END

close lcur_mailplan

deallocate lcur_mailplan

LOOP END LOOP While 条件 BEGIN END

CHR() CHAR()

ELSIF ELSE IF

SUBSTR SUBSTRING

NLS_LOWER select lower(dAcB)

NLS_UPPER select upper(dAa)

IF 条件 Then ELSIF 条件 THEN END IF IF 条件 Begin END Else IF Begin END

TRUNC(SYSDATE) SELECT CONVERT(varchar() GETDATE() )

ISNULL(COLNAME) nvl(COLNAME)

TO_NUMBER(TO_CHAR(SYSDATE SSSSS)); select datediff(ssConvert(datetimeCONVERT(varchar() GETDATE() ))getdate()) 从点以来渐失秒数

EXECUTE IMMEDIATE @lv_updatesql USING @lv_status @an_code @lv_user @ld_date @ln_time

@lv_dataareaid @lv_salesid;

上一篇:多个Oracle数据库创建一个Excel报表

下一篇:如何设置OracleEvents以跟蹤数据库