Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2007
    Posts
    16

    Question Unanswered: A variable table for a cursor

    Hi,

    I use ASE 12.5.0.2

    I need to make a procedure with a cursor with a variable table.

    like this:
    DECLARE cur_TABLE CURSOR
    FOR
    select FIELD,VALUE FROM @TABLE

    When I put the declaration the cursor in a exec('...'), I can't use it in the body of the procedure.

    Did someone has an idea?

    thks

  2. #2
    Join Date
    Jul 2006
    Posts
    115
    yes, i cant too. so i create temp table to hold the content and "loop" by cursor it.
    e.g
    create table #t1 (FIELD char(10),VALUE char(10)
    exec ("insert #t1 (FIELD,VALUE) select FIELD,VALUE from " + @TABLE )
    DECLARE cur_TABLE CURSOR
    FOR
    select FIELD,VALUE FROM #t1

Posting Permissions

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