GameWong 发表于 2013-1-29 14:57:10

ORACLE sql 写法

ORACLE 格式转换
to_char
to_num

2.ORACLE 实现 SQL中的if exists方法
 
 
SQL :
if exists(select * from baseinfobak m where m.codeinfo='圣马丁岛' )
    update baseinfobak  set codevalue='asdf' where codeinfo='圣马丁岛';
else
      insert into baseinfobak values('98989','avnc','tutut','圣马丁岛');
 
ORACLE :
declare cou number;
begin
        select count(*) into cou from dual where exists(select * from baseinfobak m where m.codeinfo='圣马丁岛' );
        if cou = 0 then
           update baseinfobak  set codevalue='asdf' where codeinfo='圣马丁岛';
        else
           insert into baseinfobak values('98989','avnc','tutut','圣马丁岛');
        end if;
end;
 
 
3.MSSQLSERVER  中 select * into TA2 from TA1 语句在 ORACLE 中的写法
——
select * into table1 from table2
create table table1 as select * from table2
页: [1]
查看完整版本: ORACLE sql 写法