Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2009
    Posts
    4

    Question Unanswered: Nested Cursors in Stored Procedure?

    I'm writing a stored procedure in Sybase IQ. I have it working fine but I have to run it based on a beginning balance value, and there are a couple of hundred of these, so I don't want to run it by hand every time for each separate beginning balance.

    And, of course, I'll probably have to run it multiple times as the accountants work out the quirks.

    I need to read two tables.

    The first table has the Fund and it's associated Beginning Balance (BegBalLoad)
    The second table has numerous daily balances (can be more than one for each day) (Ledger)

    Here is my process:

    Read BegBalLoad table and snag Fund and BegBal
    Read Ledger table, select is based on values read from BegBalLoad, get daily balances, roll into one daily balance, write to temp table

    Read next BegBalLoad record for next Fund and BegBal
    Read next Ledger record, select based on values read from BegBalLoad, get daily balances, roll into one daily balance, write to temp table

    And so on. So I basically have to have nested cursors, I think. But when I tried it a bit ago I was getting an error.

    I've been reading the manuals about nested cursors but it's just been confusing me. Is it possible to run nested cursors? Is there a better way to do this?

    I hope I've explained okay... thanks!

  2. #2
    Join Date
    Apr 2009
    Posts
    6
    can u write a dummy code(if possible) that u tried , that helps to understand better
    thanks

Posting Permissions

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