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 > Database Server Software > DB2 > @declare in stored procedure

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-12-07, 19:41
wishlister wishlister is offline
Registered User
 
Join Date: Feb 2007
Posts: 42
@declare in stored procedure

db2 ESE
i just want to get a hint.. because whenever i create stored procedure, i don't know when will to declare variables or not. it also confused me when i see examples with or without variable declaration, but both works! tnx..
Reply With Quote
  #2 (permalink)  
Old 03-13-07, 09:00
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
I am not sure if I understand your question properly, but we only declare variables if they are needed int the stored procedure.

Andy
Reply With Quote
  #3 (permalink)  
Old 03-13-07, 13:23
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Declaring variables in SP is straight forward:
Code:
CREATE PROCEDURE ...
   BEGIN
      DECLARE var1 INT;
      SET var1 = ( SELECT ... );
   END@
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
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