Professional Web Applications Themes

how to declare the CURSOR in mysql - MySQL

hi, all I am a green hand of mysql,and I want to declare a cursor in mysql. and I have used the standard SQL statement, but it seems not work. here is my output: mysql> select * from table1; +----------+------+ | name | age | +----------+------+ | the name | 44 | | zhongdai | 23 | | zhongdai | 23 | | zhongdai | 23 | | zhongdai | 23 | | zhongdai | 23 | | zhongdai | 23 | | zhongdai | 23 | +----------+------+ 8 rows in set (0.00 sec) mysql> DECLARE cur1 CURSOR FOR SELECT ...

  1. #1

    Default how to declare the CURSOR in mysql

    hi, all
    I am a green hand of mysql,and I want to declare a cursor in mysql. and I
    have used the standard SQL statement, but it seems not work. here is my
    output:

    mysql> select * from table1;
    +----------+------+
    | name | age |
    +----------+------+
    | the name | 44 |
    | zhongdai | 23 |
    | zhongdai | 23 |
    | zhongdai | 23 |
    | zhongdai | 23 |
    | zhongdai | 23 |
    | zhongdai | 23 |
    | zhongdai | 23 |
    +----------+------+
    8 rows in set (0.00 sec)

    mysql> DECLARE cur1 CURSOR FOR SELECT * FROM table1;
    ERROR 1064: You have an error in your SQL syntax near 'DECLARE cur1 CURSOR
    FOR SELECT * FROM table1' at line 1
    mysql>

    is there and syntax in my SQL statement?
    Thanks for your help.


    zhongdai Guest

  2. #2

    Default Re: how to declare the CURSOR in mysql

    "zhongdai" <bigapple2008> wrote in message
    news:du5foh$hrn$1news.yaako.com...
    > I want to declare a cursor in mysql.
    The usage and syntax of cursors in MySQL is doented here:
    [url]http://dev.mysql.com/doc/refman/5.0/en/cursors.html[/url]

    Note that cursors are supported in MySQL version 5.0 and later, and only in
    the context of stored procedures and functions. There does not seem to be
    any support for declaring cursors in the mysql command-line tool.

    Regards,
    Bill K.


    Bill Karwin Guest

Similar Threads

  1. Replies: 1
    Last Post: August 24th, 03:45 PM
  2. cursor 200-problem on mac but not pc? how to swap cursor image?
    By nickelsock webforumsuser@macromedia.com in forum Macromedia Director Lingo
    Replies: 5
    Last Post: August 2nd, 10:58 AM
  3. Need an advice on 'declare cursor' statement
    By gene in forum Microsoft SQL / MS SQL Server
    Replies: 4
    Last Post: July 10th, 08:56 PM
  4. re-declare (re-use) a cursor in a stored procedure
    By Joe Celko in forum Microsoft SQL / MS SQL Server
    Replies: 0
    Last Post: July 10th, 08:37 PM
  5. Change the "web hand" cursor in normal arrow cursor?
    By FB1976 in forum Adobe Dreamweaver & Contribute
    Replies: 1
    Last Post: July 9th, 07:15 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139