Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2002
    Posts
    1

    Unanswered: Execute an update query in a stored procedure

    I am trying to execute an update query in a stored procedure. The problem is that the name of the column to be set is not settled but defined by a variable.


    UPDATE TBL_TEST SET variable = value

    I generate the query dynamically and put it in a string but now I do not know how to execute it.

    All ideas is welcome.


    Thanks is advance.

    Manue

  2. #2
    Join Date
    Jul 2001
    Location
    Germany
    Posts
    189
    Hello,

    if you have saved your build update statement ind a variable use :

    EXECUTE IMMEDIATE variable;

    where variable is the name of your variable ...

    if you want to use bind vars instead use

    EXECUTE IMMEDIATE 'UPDATE tab set :var = ':con'
    USING var, con;


    Hope that helps ?

    Regards
    Manfred Peter
    (Alligator Company GmbH)
    http://www.alligatorsql.de

  3. #3
    Join Date
    Feb 2002
    Posts
    2,232
    Which database are you using ?

Posting Permissions

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