This Repo contains a project about Dynamic SQL Sequences and Triggers in PL/SQL
This repository showcases a PL/SQL project This project is a deliverable for the Advanced PL/SQL course as part of the Data Visualization track at the Information Technology Institute (ITI). It demonstrates the practical application of advanced PL/SQL concepts, including dynamic SQL, triggers, and database automation.
- Dynamic SQL: Automatically creates sequences and triggers for numeric primary key columns.
- Automation: Eliminates the need for manual sequence and trigger creation.
- Error-Free Execution: Uses robust dynamic SQL with proper validation.
- Reusability: Can be used across multiple schemas with numeric primary keys.
scripts/: Contains the main PL/SQL script and supporting setup scripts.docs/: Documentation and usage guides for the project.examples/: Sample input/output and test cases for reference.
-
Identify Tables:
- Scans all tables in the schema for numeric primary keys with constraints.
-
Drop Old Sequences:
- Drops all existing sequences in the schema for cleanup.
-
Create New Sequences:
- Dynamically generates new sequences for primary key columns starting from the current maximum value in the table.
-
Create Triggers:
- Adds a
BEFORE INSERTtrigger to auto-generate primary key values using the newly created sequence.
- Adds a
- Oracle Database: Version 11g or later.
- PL/SQL Developer or SQL*Plus: To execute the scripts.
- Clone the repository:
git clone https://github.com/your-username/PLSQL_PROJECT.git cd PLSQL_PROJECT