Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursor as an OUTPUT parameter
Message
From
18/07/2003 04:05:37
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Title:
Cursor as an OUTPUT parameter
Miscellaneous
Thread ID:
00811406
Message ID:
00811406
Views:
46
Hello All
I have two procedures which communicate via a cursor.
I did by the book (Help sample), but i get the following error.
Server: Msg 16950, Level 16, State 2, Procedure PlaceByDep, Line 8
The variable '@PkList' does not currently have a cursor allocated to it.

Below are the procedures

CREATE PROCEDURE PlaceByDep @PK UniqueIdentifier
AS
Set NoCount ON
DECLARE @PkList CURSOR
EXEC DeepPk @PK, 'DepPkNodeList', @PkList OUTPUT
create table #PkList (PK uniqueidentifier)

FETCH NEXT FROM @PkList into @Pk
WHILE (@@FETCH_STATUS = 0)
BEGIN
Insert Into #PkList (PK) Values (@PK)
FETCH NEXT FROM @PkList into @Pk
END
CLOSE @PkList
DEALLOCATE @PkList
select * from #PkList
return
GO


CREATE PROCEDURE [DeepPk] @ParentPK uniqueidentifier
, @NodProc_Na char(64)
, @PkCursor CURSOR VARYING OUTPUT

AS
create table #PkList (PK uniqueidentifier)
Insert into #PkList (Pk) Values (@ParentPK)
execute @NodProc_Na @ParentPk

Set @PkCursor= Cursor Local Fast_Forward
For Select * from #PkList

Open @PkCursor

return
GO



Thank you.
Kamil
A moment of silence is our cosmic reset button.
Next
Reply
Map
View

Click here to load this message in the networking platform