---
title: "主键重复"
author: "xvm03"
date: "2010-11-02T13:05:40Z"
tags: []
categories: ["数据库"]
slug: "untitled"
draft: false
lastmod: "2010-11-02T13:05:40Z"
id: 800517
url: "https://xvm03.iteye.com/blog/800517"
---

如何根据oracle异常判断主键重复

 

exception   
      when others then   
               err\_num := SQLCODE;  
               if err\_num = 1 then  
                 dbms\_output.putline(SQLERRM(err\_num);  
              end if;  
...