If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Sybase > Sybase Procedure Variable Problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-14-11, 05:27
mad_man12 mad_man12 is offline
Registered User
 
Join Date: Mar 2011
Posts: 6
Sybase Procedure Variable Problem

Hi Friends,

I'm facing a rather strange problem in sybase stored procedure

Code:
I have a 3 databases A , C and C_TEST 
and a stored proc in A named B 

The B stored proc is called from isql as 

use A 
go 
B 
go 

Now B is defined as 

create proc B @x=-1 ( x is a varaible here) 
select seq_num from C..table 


Now when I execute it, i get value from the same tablename in database C_TEST(and not C) of seq_num despite the C..table above(in bold) 

However when I insert a debugging line into the stored proc 

create proc B @x=-1 ( x is a varaible here) 
insert int temptable {@x} ( i inserted it as just a debugging statement) 
select seq_num from C..table 

It is giving me a correct value that is the value from database C.
Strangely this happening as i have tried it multiple times by removing the debug stmt and then inserting it and the result is same every time

I am not getting any ideas?
Please Advice
Reply With Quote
  #2 (permalink)  
Old 03-15-11, 07:17
mad_man12 mad_man12 is offline
Registered User
 
Join Date: Mar 2011
Posts: 6
Update on the problem

Hi All,

Alternatively i must update that if i have procedure

the proc is called as

Z = exec B

create proc B @x=-1 ( x is a varaible here)
select seq_num from database..table

I dont get the value of seq_num


However i insert a debugging stmt and re-compile the proc i get the value
create proc B @x=-1 ( x is a varaible here)
insert int temptable {@x} ( i inserted it as just a debugging statement)
select seq_num from database..table

is it something to do with recompiling the proc or any known sybase bug/issue
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

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