You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

在DBeaver中创建运行Oracle存储过程遇ORA-00900错误求助

Fixing ORA-00900 Error When Executing Oracle Stored Procedure in DBeaver

Hey there! Let's break down why your p_test procedure is throwing the ORA-00900 "invalid SQL statement" error and how to fix it.

Most Likely Cause: EXEC is a SQL*Plus Shortcut (Not Supported in DBeaver's Standard Editor)

The exec p_test; command is a handy shorthand used in SQL*Plus, but DBeaver's SQL editor expects standard PL/SQL syntax for executing procedures. Here's the simple fix:

Replace your execution command with a full PL/SQL block:

BEGIN
  p_test;
END;
/

The trailing / tells the Oracle parser that the PL/SQL block is complete and ready to run.

Additional Checks to Ensure Everything Works Smoothly

  • Verify the Procedure Was Created Successfully:
    Sometimes even if you don't see an error during creation, the procedure might not have saved correctly. Navigate to your Oracle connection in DBeaver, expand the "Procedures" folder, and confirm p_test is listed there. If not, re-run your creation script—your current CREATE statement looks valid, but double-check for tiny typos like misspelled keywords or variable names just in case.

  • Enable DBMS_OUTPUT to See the Procedure's Output:
    Even if the procedure runs successfully, you won't see the test message unless DBMS_OUTPUT is turned on in DBeaver:

    1. Click the "DBMS Output" button in the SQL editor toolbar (it looks like a small terminal icon).
    2. In the panel that opens, click "Enable".
    3. Execute the PL/SQL block again, and you'll see your message pop up in the DBMS Output panel.

内容的提问来源于stack exchange,提问作者maria7023

火山引擎 最新活动