Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    2

    Unhappy Unanswered: help me with the "declare cursor"

    my DBMS is sybase ase 12.5
    when I run the command,I get the wrong.
    --------------------------------------------------------
    create procedure test
    @table char(50)
    as
    exec('declare curA cursor for select * from '+@table)
    open curA
    close curA
    deallocate cursor curA
    --------------------------------------------------------
    exec test abc
    --------------------------------------------------------
    the error is " curA not be fount "
    but 'sybase ase' not support ''declare curA cursor global for select_statement"
    what can I do?
    please help me.

  2. #2
    Join Date
    Nov 2002
    Location
    Switzerland
    Posts
    524

    Re: help me with the "declare cursor"

    1) The variables used in an exec are not available in the called script (and vice-versa)
    2) your construct is not really a good idea (generic cursor). The use of a cursor must be minimized in SQL

  3. #3
    Join Date
    Feb 2004
    Posts
    2

    Smile

    Thinks.
    But I want to use the procedures which can control the cursor for a unknown table.
    How could I do it?
    Wait for reply.

Posting Permissions

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