← 返回 Skills 市场
ivangdavila

Oracle DB

作者 Iván · GitHub ↗ · v1.0.0
linuxdarwinwin32 ✓ 安全检测通过
1246
总下载
2
收藏
10
当前安装
1
版本数
在 OpenClaw 中安装
/install oracle-db
功能描述
Write Oracle SQL and PL/SQL with proper syntax, hints, and performance patterns.
使用说明 (SKILL.md)

Syntax Differences

  • ROWNUM for limiting rows—WHERE ROWNUM \x3C= 10; 12c+ supports FETCH FIRST 10 ROWS ONLY
  • DUAL table for expressions—SELECT sysdate FROM dual
  • VARCHAR2 not VARCHAR—VARCHAR is reserved, VARCHAR2 is the standard
  • String concatenation with ||—not CONCAT for multiple values
  • Empty string equals NULL—'' IS NULL is true; breaks logic from other databases

Pagination

  • ROWNUM assigned before ORDER BY—wrap in subquery: SELECT * FROM (SELECT ... ORDER BY x) WHERE ROWNUM \x3C= 10
  • Offset requires nested subquery: SELECT * FROM (SELECT a.*, ROWNUM rn FROM (...) a WHERE ROWNUM \x3C= 20) WHERE rn > 10
  • 12c+: OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY—cleaner, use when available

NULL Handling

  • NVL(col, default) for null replacement—faster than COALESCE for two args
  • NVL2(col, if_not_null, if_null) for conditional—common Oracle pattern
  • Empty string is NULL—LENGTH('') returns NULL, not 0
  • NULLIF(a, b) returns NULL if equal—useful for avoiding division by zero

Dates

  • SYSDATE for current datetime—no parentheses
  • TO_DATE('2024-01-15', 'YYYY-MM-DD') for string to date—format required
  • TO_CHAR(date, 'YYYY-MM-DD HH24:MI:SS') for date to string
  • Date arithmetic in days—SYSDATE + 1 is tomorrow, SYSDATE + 1/24 is one hour

Sequences

  • Create: CREATE SEQUENCE seq_name START WITH 1 INCREMENT BY 1
  • Get next: seq_name.NEXTVALSELECT seq_name.NEXTVAL FROM dual
  • Current value: seq_name.CURRVAL—only after NEXTVAL in same session
  • 12c+: identity columns—GENERATED ALWAYS AS IDENTITY

Hierarchical Queries

  • CONNECT BY PRIOR child = parent for tree traversal
  • START WITH parent IS NULL for root nodes
  • LEVEL pseudo-column shows depth—WHERE LEVEL \x3C= 3 limits depth
  • SYS_CONNECT_BY_PATH(col, '/') builds path string

Bind Variables

  • Always use bind variables—literals cause hard parse every time
  • PL/SQL: :variable_name syntax
  • Performance critical—literal values fill shared pool, cause contention
  • CURSOR_SHARING=FORCE as workaround but not recommended long-term

Hints

  • /*+ INDEX(table idx_name) */ forces index use
  • /*+ FULL(table) */ forces full table scan
  • /*+ PARALLEL(table, 4) */ enables parallel query
  • Hints inside SELECT /*+ hint */—common placement after SELECT keyword

PL/SQL Blocks

  • Anonymous block: BEGIN ... END; with / on new line to execute
  • DBMS_OUTPUT.PUT_LINE() for debug output—SET SERVEROUTPUT ON first
  • Exception handling: EXCEPTION WHEN OTHERS THEN—always handle or log
  • EXECUTE IMMEDIATE 'sql string' for dynamic SQL—beware injection

Transactions

  • No auto-commit by default—must COMMIT explicitly
  • SAVEPOINT name then ROLLBACK TO name for partial rollback
  • DDL auto-commits—CREATE TABLE commits any pending transaction
  • SELECT FOR UPDATE WAIT 5 waits 5 seconds for lock—avoids indefinite hang

Performance

  • EXPLAIN PLAN FOR sql; SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY)—shows plan
  • V$SQL and V$SESSION for monitoring—requires privileges
  • Avoid SELECT *—fetches all columns including LOBs
  • Index hint when optimizer chooses wrong—/*+ INDEX(t idx) */

Common Traps

  • MINUS instead of EXCEPT—Oracle uses MINUS for set difference
  • DECODE is Oracle-specific—use CASE for portability
  • Implicit type conversion—WHERE num_col = '123' works but prevents index use
  • ROWID is physical—don't store or rely on across transactions
安全使用建议
This skill is an instruction-only reference for Oracle SQL and PL/SQL and appears internally consistent. It does not install code or ask for credentials by itself. Practical cautions: if you (or the agent using this skill) run sqlplus/sql against a real database, you will need to supply database connection credentials — only provide those to trusted agents/environments. Review any prompts or actions that would cause the agent to execute commands against your DB, and avoid sharing DB credentials unless necessary. If you need guarantees about provenance or maintenance, ask the publisher for a homepage, source repo, or change log before using in sensitive environments.
功能分析
Type: OpenClaw Skill Name: oracle-db Version: 1.0.0 The skill bundle provides comprehensive documentation for interacting with Oracle DB, detailing syntax, performance patterns, and common traps. The `_meta.json` is standard, and `SKILL.md` serves as an informational guide for the AI agent on Oracle SQL and PL/SQL. It correctly identifies `sqlplus` or `sql` as required binaries, aligning with its stated purpose. There are no instructions for the AI agent to perform malicious actions, exfiltrate data, establish persistence, or engage in prompt injection to subvert its operation. The mention of 'beware injection' for `EXECUTE IMMEDIATE` is a warning about a vulnerability, not an instruction to exploit it.
能力评估
Purpose & Capability
Name/description match the SKILL.md content. The declared required binaries (sqlplus or sql) are appropriate for an Oracle-guidance skill and are listed as 'anyBins' in the metadata.
Instruction Scope
SKILL.md contains only Oracle syntax, performance, and usage guidance. It does not instruct the agent to read system files, environment variables, or transmit data to external endpoints, nor does it include open-ended instructions that would grant broad discretion.
Install Mechanism
No install spec and no code files — instruction-only. Nothing is downloaded or written to disk by the skill itself.
Credentials
The skill declares no required environment variables or credentials. The content mentions Oracle monitoring views (V$SQL/V$SESSION) which legitimately require DB privileges, but the skill itself does not request any secrets.
Persistence & Privilege
always is false and the skill is user-invocable; it does not request persistent presence or attempt to modify other skill/system configurations.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install oracle-db
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /oracle-db 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release
元数据
Slug oracle-db
版本 1.0.0
许可证
累计安装 10
当前安装数 10
历史版本数 1
常见问题

Oracle DB 是什么?

Write Oracle SQL and PL/SQL with proper syntax, hints, and performance patterns. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 1246 次。

如何安装 Oracle DB?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install oracle-db」即可一键安装,无需额外配置。

Oracle DB 是免费的吗?

是的,Oracle DB 完全免费(开源免费),可自由下载、安装和使用。

Oracle DB 支持哪些平台?

Oracle DB 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(linux, darwin, win32)。

谁开发了 Oracle DB?

由 Iván(@ivangdavila)开发并维护,当前版本 v1.0.0。

💬 留言讨论