Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2011
    Posts
    10

    Unanswered: 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

  2. #2
    Join Date
    Mar 2011
    Posts
    10

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •