DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    FrankA Guest

    Updating the fetched cursor record in a stored prodecure


    When looping through a cursor in a stored procedure, can the currently fetched
    record be updated or do I need to issue an update statement on the table?
    If the cursor can be updated how is it done? Thanks for any help provided!!


  2. #2
    David Satz Guest

    Re: Updating the fetched cursor record in a stored prodecure

    I have never wanted to / found a need to do this, but in BOL it says you
    would need to
    DECLARE cursor_name CURSOR
    FOR select_statement
    [ FOR UPDATE [ OF column_name [ ,...n ] ] ]

    and then update using

    UPDATE
    {
    table_name WITH ( < table_hint_limited > [ ...n ] )
    | view_name
    | rowset_function_limited
    }
    SET
    { column_name = { expression | DEFAULT | NULL }
    | @variable = expression
    | @variable = column = expression } [ ,...n ]

    { { [ FROM { < table_source > } [ ,...n ] ]

    [ WHERE
    < search_condition > ] }
    |
    [ WHERE CURRENT OF
    { { [ GLOBAL ] cursor_name } | cursor_variable_name }

    --
    HTH,
    David Satz
    Principal Web Engineer
    Hyperion Solutions

    "FrankA" <Frank.Ansanitis@bhs.org> wrote in message
    news:3ddbdddd$1@tnews.web.devx.com...
    >
    > When looping through a cursor in a stored procedure, can the currently

    fetched
    > record be updated or do I need to issue an update statement on the table?
    > If the cursor can be updated how is it done? Thanks for any help

    provided!!
    >




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
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links