Total Pageviews

2014/12/17

How to Run Stored Procedure in Oracle SQL Developer

Problem
Assume I created a stored procedure which named PROC_FMS406R_TAB5_RPT1_STEP1

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
create or replace PROCEDURE PROC_FMS406R_TAB5_RPT1_STEP1 
(
  INPUT_YYY_MM IN VARCHAR2 
, INPUT_LAST_YEAR IN VARCHAR2 
, INPUT_USER_ID IN VARCHAR2 
) AS 
BEGIN
  
  --1.5.2 計算『歲入估測分析表(含特別預算)』上一年度的一月到12月的實際數
 -- ignore execution detail

  
  
 --1.5.3 計算『歲入估測分析表(含特別預算)』上一年度的合計數
 -- ignore execution detail
  
END PROC_FMS406R_TAB5_RPT1_STEP1;


I tried to execute PROC_FMS406R_TAB5_RPT1_STEP1 in SQL worksheet


It will fail to execute and show this error message:

1
2
3
4
命令的第 2 行開始發生錯誤 -
PROC_FMS406R_TAB5_RPT1_STEP1(:INPUT_YYY_MM, :INPUT_LAST_YEAR, :INPUT_USER_ID)
錯誤報告 -
不明的命令

How to Fix This Problem
Add BEGIN before the stored procedure and add END; after the stored procedure.

1
2
3
BEGIN
PROC_FMS406R_TAB5_RPT1_STEP1(:INPUT_YYY_MM, :INPUT_LAST_YEAR, :INPUT_USER_ID);
END;


Reference
[1] http://dba.stackexchange.com/questions/57163/how-to-run-procedure-in-oracle-sql-developer

No comments: