跳到正文
Skillpedia
API 与服务器(后端)40k · #7295

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/github/awesome-copilot/blob/main/skills/migrating-oracle-to-postgres-stored-procedures/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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 COMMENT or GRANT statements.
  • 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 ALL as 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 orafce extension 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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能