在DBeaver中创建运行Oracle存储过程遇ORA-00900错误求助
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 confirmp_testis 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 thetestmessage unless DBMS_OUTPUT is turned on in DBeaver:- Click the "DBMS Output" button in the SQL editor toolbar (it looks like a small terminal icon).
- In the panel that opens, click "Enable".
- Execute the PL/SQL block again, and you'll see your message pop up in the DBMS Output panel.
内容的提问来源于stack exchange,提问作者maria7023




