How to rename a default constraint on Oracle?
<p>I want to rename many constraints (PK, FK, ...etc. ) that have default names which start with 'SYS' to be able to insert the same data in other DB.  </p>

<p>I found the following script that I changed to get what I want:</p>

<pre><code>BEGIN
    FOR cn IN (
        SELECT constraint_name 
        FROM user_constraints 
        WHERE constraint_type = 'P'
        AND table_name = 'SPECIALITE'
    )
    LOOP
        EXECUTE IMMEDIATE 'ALTER TABLE ' || cn.table_name || ' RENAME CONSTRAINT ' || cn.constraint_name  || ' TO PK_' || 'SPECIALITE';
    END LOOP;
END;
</code></pre>

<p>This script works, but it seems a bit complicated for me, I wonder if it exists something like:</p>

<pre><code>ALTER TABLE 'SPECIALITE' RENAME CONSTRANT (....)
</code></pre>

<p>The problem is I don't know the name of constraints, they have a default name, I know only tables where they are.</p>

<p>Is it possible?</p>