T-SQL学习笔记2
存储过程中跳过错误:
if @@error<> 0 goto pass
……
pass:
pass:
ORACLE中可以用异常块
begin
......
begin
insert into ......
exception
when 需要继续向下执行的异常 then
null;
when others then
raise;
end;
....
exception
end;
......
begin
insert into ......
exception
when 需要继续向下执行的异常 then
null;
when others then
raise;
end;
....
exception
end;
查询重复记录
SELECT 字段名, COUNT(*) AS Expr1
FROM 表名
GROUP BY 字段名
HAVING (COUNT(*) >1)