Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 returning cursors in transact-sql (problem)

Author  Topic 

dwlinley
Starting Member

2 Posts

Posted - 2003-05-28 : 13:17:45

I'm trying to return a cursor result from sybase using a transact sql stored procedure. I'm getting errors saying that the syntax for the output parameter is incorrect, but it is consistent with all examples I've seen. Can anyone tell me what might be wrong here?

Here is the stored procedure code:


CREATE PROCEDURE SP_HBS_LHP_ABF_GBRA
(@V_OUTPUT CURSOR VARYING OUTPUT,
@pBLIV_ID CHAR(12))
AS
/* removed code */

SET @V_OUTPUT = CURSOR FOR
SELECT BLIV_ID,
INID_BLEI_NAME,
INID_BLEI_ADDR1,
INID_BLEI_ADDR2,
INID_BLEI_ADDR3,
INID_BLEI_CITY,
INID_BLEI_STATE,
INID_BLEI_ZIP,
GRGR_ID,
SGSG_ID,
BLIV_CREATE_DTM,
BLBL_DUE_DT,
BLBL_END_DT,
INPA_PREV_NET_DUE,
ATCT_FIRST_NAME,
ATCT_LAST_NAME,
SUM_INPA_RCPT_AMT
FROM #tmp_abf_grp_bill

BEGIN

/* Removed code */

OPEN @V_OUPUT

END


here is the error:

Incorrect syntax near the keyword 'CURSOR'.

When I click the error it takes me to the parameter line.
Any help is appreciated.
Thanks,
Doug


mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2003-05-28 : 13:29:19
Have you tried putting the BEGIN tag of the sproc before the SET statement? And I dont know if you can "initialize" a cursor this way, never seen that one before...


CREATE PROCEDURE SP_HBS_LHP_ABF_GBRA
(@V_OUTPUT CURSOR VARYING OUTPUT,
@pBLIV_ID CHAR(12))
AS
BEGIN

/* removed code */

SET @V_OUTPUT = CURSOR FOR
SELECT BLIV_ID,
INID_BLEI_NAME,
INID_BLEI_ADDR1,
INID_BLEI_ADDR2,
INID_BLEI_ADDR3,
INID_BLEI_CITY,
INID_BLEI_STATE,
INID_BLEI_ZIP,
GRGR_ID,
SGSG_ID,
BLIV_CREATE_DTM,
BLBL_DUE_DT,
BLBL_END_DT,
INPA_PREV_NET_DUE,
ATCT_FIRST_NAME,
ATCT_LAST_NAME,
SUM_INPA_RCPT_AMT
FROM #tmp_abf_grp_bill

/* Removed code */

OPEN @V_OUPUT

END



OS

Go to Top of Page

dwlinley
Starting Member

2 Posts

Posted - 2003-05-28 : 13:33:40

Thanks for the reply. I just tried what you suggested and it didn't work. It seems the problem is in the parameter declaration, but that declaration looks correct to me. Of course, I am a complete t-sql newb.

Doug


Go to Top of Page
   

- Advertisement -