Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > Sybase > Ignore output of stored procedure

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-29-07, 14:03
lehphyro lehphyro is offline
Registered User
 
Join Date: Nov 2007
Posts: 2
Ignore output of stored procedure

Hi,

I have a stored procedure that must return the result of execution of a single query, but I have to call another procedure multiple times during execution of my procedure.
The problem is the result of the second procedure is being returned in addition to mine.

Here is my proc:

WHILE (@@sqlstatus = 0)
BEGIN

exec ANOTHER_PROC 'param', @result output

UPDATE #TMP SET param = @result WHERE CD = @cd

FETCH data_cursor INTO @cd
END

CLOSE data_cursor
DEALLOCATE CURSOR data_cursor

SELECT * FROM #TMP

Here is the called proc:

CREATE PROCEDURE ANOTHER_PROC (@param char(5), @result Numeric(5,2) = 0 output) As
Begin
Select @PcILM = cilm.PcILM
From VW cilm,

Select PcILM = @PcILM
End

Do you know how to get only the @result value without getting the result of the last SELECT?

Thank you
Reply With Quote
  #2 (permalink)  
Old 11-29-07, 20:08
trvishi trvishi is offline
Registered User
 
Join Date: Sep 2003
Location: Switzerland
Posts: 371
Quote:
<code>
CREATE PROCEDURE ANOTHER_PROC (@param char(5), @result Numeric(5,2) = 0 output) As
Begin
Select @PcILM = cilm.PcILM
From VW cilm,

Select PcILM = @PcILM
End
</code>
Do you know how to get only the @result value without getting the result of the last SELECT?

Thank you

I dont see you using @result anywhere in the body... Thats your problem, I think or am I missing anything?!!...
Reply With Quote
  #3 (permalink)  
Old 11-30-07, 09:30
lehphyro lehphyro is offline
Registered User
 
Join Date: Nov 2007
Posts: 2
Quote:
I dont see you using @result anywhere in the body... Thats your problem, I think or am I missing anything?!!...
Actually @PcILM should be @result

We solved adding a flag to the procedure to indicate whether we want the last select statement to be executed, like as follows:

CREATE PROCEDURE ANOTHER_PROC (@param char(5), @result Numeric(5,2) = 0 output, @flag char(1) = 'Y') As
Begin
Select @result = cilm.PcILM From VW cilm

if (@flag = 'Y')
Select PcILM = @PcILM
End

We didn't find a way to ignore the result of the last SELECT statement though.

Thank you
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On