Chuyển đến nội dung
Skillpedia
API và máy chủ (backend)40k · #7295

migrating-oracle-to-postgres-stored-procedures

Skill này làm gì

Công cụ này giúp chuyển đổi mã của các thủ tục (gọi là 'stored procedures') từ cơ sở dữ liệu Oracle sang PostgreSQL. Nó chuyển đổi ngôn ngữ và quy tắc riêng của Oracle để chúng hoạt động trong PostgreSQL.

Khi nào nên dùng

  • ✓Khi bạn chuyển một hệ thống từ Oracle sang PostgreSQL.
  • ✓Khi bạn cần viết lại các thủ tục cũ cho cơ sở dữ liệu mới.
  • ✓Khi bạn muốn đảm bảo logic mã vẫn đúng sau khi đổi cơ sở dữ liệu.

Liên kết skill

https://github.com/github/awesome-copilot/blob/main/skills/migrating-oracle-to-postgres-stored-procedures/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/github/awesome-copilot/blob/main/skills/migrating-oracle-to-postgres-stored-procedures/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Chuyển thủ tục Oracle này sang PostgreSQL: [dán mã thủ tục vào đây]”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ đọc mã Oracle gốc, áp dụng các quy tắc để chuyển ngôn ngữ và cấu trúc sang định dạng PostgreSQL, rồi lưu mã mới vào một file.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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.

Câu hỏi thường gặp

“Stored procedures” là gì?

Đó là các tập lệnh cơ sở dữ liệu được lưu sẵn trong chính cơ sở dữ liệu, để thực thi khi được gọi. Giống như các “hàm” nhỏ nằm trong cơ sở dữ liệu.

Vì sao tôi cần chuyển đổi mã?

Mỗi cơ sở dữ liệu (như Oracle và PostgreSQL) có ngôn ngữ và quy tắc riêng. Mã viết cho cái này sẽ không chạy trực tiếp trên cái kia.

Công cụ có sao chép y nguyên mọi thứ không?

Công cụ cố gắng giữ nguyên chức năng và cấu trúc mã gốc, nhưng thực hiện các điều chỉnh cần thiết cho PostgreSQL, chẳng hạn như kiểu dữ liệu và quy tắc sắp xếp văn bản.

Chi tiết

Mô tả gốc của tác giả

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

Độ phổ biến

Sao GitHub
40k
Vị trí xếp hạng
#7295
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự