Migrating Oracle To Postgres Stored Procedures
GitHubOfficialFirst committed by PrimedPaulDistributed by GitHub
- Skill
- Workflow
- Data and AI
- MIT
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a systematic approach to translating Oracle stored procedures and functions into PostgreSQL-compatible PL/pgSQL. It focuses on maintaining functional parity, preserving method signatures, and handling complex database-specific requirements like collation mapping and type resolution. The process ensures that logic remains consistent while adapting to PostgreSQL syntax and leveraging the orafce extension for improved fidelity.
What it does
- Translates Oracle-specific PL/SQL syntax to PostgreSQL PL/pgSQL.
- Preserves original method signatures and control flow logic.
- Handles type-anchored parameters and maps them to appropriate PostgreSQL types.
- Applies intentional collation mapping based on Oracle NLS settings.
- Organizes migrated code into a structured directory format.
- Integrates with existing Oracle and PostgreSQL DDL definitions for context.
When to use it
- When performing a database migration from Oracle to PostgreSQL.
- When you need to convert legacy stored procedures while maintaining existing business logic.
- When ensuring that database sorting and collation behaviors remain consistent post-migration.
- When you need to standardize the output of migrated procedures into a specific project structure.
Advantages
- Reduces manual effort in syntax translation and type mapping.
- Ensures consistent handling of collation and linguistic sorting.
- Maintains project structure for easier integration into migration pipelines.
- Leverages orafce for higher compatibility with Oracle-style functions.
Usage examples
- “Migrate the Oracle stored procedure located in the DDL/Oracle/Procedures folder to PostgreSQL.”
- The agent reads the source file, applies the translation rules for syntax and collation, and saves the resulting PL/pgSQL code into the designated PostgreSQL output directory.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/github/migrating-oracle-to-postgres-stored-procedures/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip migrating-oracle-to-postgres-stored-procedures.zip -d .agents/skills
Documentation by PrimedPaul
Migrating Stored Procedures from Oracle to PostgreSQL
Translate Oracle PL/SQL stored procedures and functions to PostgreSQL PL/pgSQL equivalents.
Workflow
Progress:
- [ ] Step 1: Read the Oracle source procedure
- [ ] Step 2: Translate to PostgreSQL PL/pgSQL
- [ ] Step 3: Write the migrated procedure to Postgres output directoryStep 1: Read the Oracle source procedure
Read the Oracle stored procedure from .github/oracle-to-postgres-migration/DDL/Oracle/Procedures and Functions/. Consult the Oracle table/view definitions at .github/oracle-to-postgres-migration/DDL/Oracle/Tables and Views/ for type resolution.
Step 2: Translate to PostgreSQL PL/pgSQL
Apply these translation rules:
Translate all Oracle-specific syntax to PostgreSQL equivalents.
Preserve original functionality and control flow logic.
Keep type-anchored input parameters (e.g.,
PARAM_NAME IN table_name.column_name%TYPE).Use explicit types (
NUMERIC,VARCHAR,INTEGER) for output parameters passed to other procedures — do not type-anchor these.Do not alter method signatures.
Do not prefix object names with schema names unless already present in the Oracle source.
Leave exception handling and rollback logic unchanged.
Do not generate
COMMENTorGRANTstatements.Apply collation intentionally when ordering text:
Use
COLLATE "C"only when Oracle-compatible binary ordering is required and no other sort order is specified.If Oracle used explicit linguistic sorting (for example
NLS_SORT = French), map to an explicit PostgreSQL locale collation instead of"C".Use
SELECT collname, collprovider, collcollate, collctype FROM pg_collation ORDER BY collname;to discover collations in the target environment.
Treat
UNION ALLas a review checkpoint. Validate plan quality per branch and restructure if combined-branch planning causes regressions (for example, unexpected sequential scans on large tables).Leverage the
orafceextension when it improves clarity or fidelity.
Consult the PostgreSQL table/view definitions at .github/oracle-to-postgres-migration/DDL/Postgres/{ProjectName}/Tables and Views/ for target schema details.
Step 3: Write the migrated procedure to Postgres output directory
Place each migrated procedure in its own file under .github/oracle-to-postgres-migration/DDL/Postgres/{ProjectName}/Procedures and Functions/{PACKAGE_NAME_IF_APPLICABLE}/. One procedure per file.
{ProjectName}is the project's assembly/folder name with spaces normalized to-(e.g.MyApp.DataAccess). This matches the path used by the agent and other migration skills.
Files
- ATTRIBUTION.mdAdded by AutoGineer929 B
- LICENSELicence file added by AutoGineer1.0 KiB
- SKILL.md3.1 KiB
Requirements and compatibility
Written for: GitHub Copilot
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- First committed by
PrimedPaul
- Publisher
- GitHub (Official)
- Distributed by
- GitHub
- Source
- github/awesome-copilot · skills/migrating-oracle-to-postgres-stored-procedures · commit 797337f
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
- Contributors
- PrimedPaul
AutoGineer is not affiliated with or endorsed by PrimedPaul or GitHub.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download migrating-oracle-to-postgres-stored-procedures.zip