migrating-oracle-to-postgres-stored-procedures
它能做什么
这个工具可以把 Oracle 数据库中的存储过程(stored procedures)转换为 PostgreSQL 可用的代码。它会转换 Oracle 特有的语言和规则,使其能在 PostgreSQL 中运行。
适用场景
- ✓当你要把系统从 Oracle 迁移到 PostgreSQL 时。
- ✓当你需要为新数据库重写旧的存储过程时。
- ✓当你想确保代码迁移后逻辑仍然正确时。
技能链接
https://github.com/github/awesome-copilot/blob/main/skills/migrating-oracle-to-postgres-stored-procedures/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“把这个 Oracle 存储过程转换为 PostgreSQL:[在此粘贴过程代码]”
每周 5 个新技能,1 分钟读完。
工作原理
该工具会读取原始的 Oracle 代码,应用转换规则,把语言和结构改写为 PostgreSQL 的格式,然后将新代码保存到文件中。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
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 directory
Step 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.
- Use
- 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.
常见问题
什么是“存储过程”?
它们是存放在数据库内部的一组数据库命令,被调用时即可执行,有点像数据库里的小型“函数”。
为什么需要转换代码?
每种数据库(比如 Oracle 和 PostgreSQL)都有自己的语言和规则。为一种数据库编写的代码,无法直接在另一种数据库上运行。
这个工具会原样复制所有内容吗?
它会尽量保持原有功能和代码结构,但会针对 PostgreSQL 做必要的调整,比如适配数据类型和文本排序规则。
详情
作者的原始描述
Migrates Oracle PL/SQL stored procedures to PostgreSQL PL/pgSQL. Translates Oracle-specific syntax, preserves method signatures and type-anchored parameters, leverages orafce where appropriate, and applies explicit collation mapping (`COLLATE "C"` only when appropriate, locale collations when required). Use when converting Oracle stored procedures or functions to PostgreSQL equivalents during a da
repo: github/awesome-copilot
热度
- GitHub 星标
- 40k
- 排名
- #7295
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
acquire-codebase-knowledge
40k帮你的智能体理解并编写现有代码项目的文档。它有助于新成员快速上手,或者快速了解项目架构。
acreadiness-assess
40k让你的智能体评估一个项目对 AI 的准备程度,并生成报告。它有助于了解项目在使用 AI 工具方面的准备情况。
acreadiness-generate-instructions
40k帮你的智能体根据评估结果编写 AI 工具的指令文件。它有助于改善 AI 与代码的交互方式,并弥补已发现的不足。
acreadiness-policy
40k让你的智能体协助制定或应用 AI 项目评估的政策。它有助于规范项目的评估方式,并确保合规。