If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Execute an update query in a stored procedure

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-21-02, 05:07
Manue Manue is offline
Registered User
 
Join Date: Aug 2002
Posts: 1
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
Reply With Quote
  #2 (permalink)  
Old 08-21-02, 06:17
alligatorsql.com alligatorsql.com is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 08-21-02, 15:55
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
Which database are you using ?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On