2014-06-24 128 views
0

我試圖在用Java調用的Sybase數據庫中創建一個存儲過程,並獲取填充2個獨立表的輸入參數;一些爭論進入兩者,一些只進入其中一個表格。創建存儲過程錯誤Sybase

這裏是我的存儲過程的代碼:

Create procedure dbo.ps_bau_insert (in userID varChar(8), in busReason varChar(800), in weekID Integer, 
           in qScript varChar(800), in success BIT, in rowsAffected varChar(100)) 

      BEGIN 

      Insert into dbo.tbau_request_details 
      (weekID, userID, Date, qScript, BusReason, Success, Rows) 
      values (weekID, userID, getDate(), qScript, busReason, success, rowsAffected) 
      Insert into dbo.tbau_request_cm 
      (userID, Date, BusReason, Success, Rows) 
      values (userID, getDate(), busReason, success, rowsAffected); 
      End 

,我發現了錯誤:

Error report - 
Incorrect syntax near the keyword 'BEGIN'. 

至於我可以看到(通過查看Sybase文檔)語法是正確的;錯誤陳述另有說明。有人能幫我看看這裏有什麼不正確嗎?

謝謝!

回答

4

如果您使用的是Sybase ASE,則需要在BEGIN之前有一個AS。

http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc00801.1520/html/iqrefso/X315708.htm指的是這樣的:

Syntax

This subset of the Transact-SQL CREATE PROCEDURE statement is supported in Sybase IQ:

CREATE PROCEDURE [ owner.]procedure_name

… [ [ (] @parameter_name data-type [ = default ] [ OUTPUT ] [ , … ] [) ] ]

…[ WITH RECOMPILE ]

… AS

… statement-list