Toad World® Forums

Naming convention rules for sequences

I’m converting a model from SQL 2014 to Oracle 12c. When I generate DDL the sequence names for primary keys are created as Seq_tablename_pk_ID. I’d like to change the prefix and suffix.

I looked in the Naming Convention Properties – Naming Convention Rules. I don’t see sequences as an object type that I can alter. Is this managed somewhere else?

Hello,

in naming convention are available only objects with caption at this moment. The main workflow for Naming convention is that user write caption and automatically is generated right name for object.

If you need rename a lot of sequences by some sample you can use macro functionality. I attached example package with macro for replace prefix and postfix on sequences in Oracle Models. Macro is wrote in Jscript, you can modify it for your purpose.

For importing user package you need switch on expert mode from menu Settings-Options-General. After it select from Menu “Expert Mode-Customization-Import Custom Package”. For see code from macro, open “Expert Mode - Customization - Package Explorer”. In Package Explorer find package RenameSequences. In this package is macro “RenameSequences”. You can right click on this macro and choose “Edit Source Code”.

Macro is available from Main Menu - Macros - Rename Sequences (Only for Oracle Models).

Daril
RenameSequences.zip (1.58 KB)

Thank you very much for the reply and the detailed instructions on using the package.

I’ve used it to renamed the sequences and also used it as an intro to exploring macros in TDM.

Thanks again.

Ken