I recently came over to Sybase ASE SQL from Microsoft SQL Server. In SQL Server I would often create stored procedures with a nested cursor in which the SELECT statement for the inner cursor contains a WHERE clause with a variable fetched by the outer cursor. I know that in Sybase the DECLARE CURSOR statement needs to be in a separate batch, so I’m not sure how this can be done. Any ideas? Thanks.
P. S. I know that cursors aren't ideal but in some situations they're a good solution.