SqlServer 저장 프로 세 스 를 Oracle 저장 프로 세 스 문법 으로 변환 하 는 흔 한 문제

1. top orderby 를 rownum orderby 로 변환 하 는 문제 (하위 조회 실현)
            :
    sqlserver:  order by  top
    oracle:     rownum   order by

2. 기 존 데이터 의 필드 형식 이 일치 하지 않 습 니 다. 다음 문 구 를 통 해 수정 합 니 다.
 alter table css_sed rename column action to myaction;

 alter table css_sed add (action varchar2(20));

 update css_sed set action = myaction;

 alter table css_sed drop column myaction;

3. 여러 캐 스 트 문제
 isnull(cast(cast(GR_WT as int) as varchar),'') sqlserver

 nvl(cast(trunc(cntr_row.GR_WT) as varchar2),'') plsql

4. 문제 가 있 는 경우
   oracle       
       :               
   begin
    select count(*) into V_CNT from all_tables where table_name = 'CUST_BC_ONLINE';
    if(V_CNT > 0)
    then
      execute immediate 'truncate table CUST_BC_ONLINE';
    end if; 
   end;

5. SqlServer: with index () 문법 문제
Oracle:   index hints    eg: select /*+ index(t i_t) */ * from t where username='EYGLE';

질문
   isnull(MCS_SHPT_INFO.LAST_MOD_DT,0) < b.LAST_MOD_DT

   nvl(MCS_SHPT_INFO.LAST_MOD_DT,to_date('1900-01-01','yyyy-mm-dd'))) < b.LAST_MOD_DT

질문
 select top(5) @param = column from table
 sqlserver                    ,oracle   ,            。

8. declare 의 변 수 는 뒤에 있 는 begin end 구문 블록 만 사용 할 수 있 습 니 다.
질문
     oracle: null      ,  null        
     sqlserver: null      ,              

10. Oracle 이상 정보 인쇄
     dbms_output.put_line(dbms_utility.format_error_stack());
     dbms_output.put_line('----------------------------------------------------------------');
     dbms_output.put_line(dbms_utility.format_call_stack());
     dbms_output.put_line('----------------------------------------------------------------');
     dbms_output.put_line(dbms_utility.format_error_backtrace());
     dbms_output.put_line('----------------------------------------------------------------');
     dbms_output.put_line(sqlcode);
     dbms_output.put_line(sqlerrm);

11. SqlServer: select into 문법 문제
     SqlServer:
         select into table2 from table1 
           :table2     
     Oracle:
         insert into table2 select * from table1 
           :  table2    

좋은 웹페이지 즐겨찾기