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 > how to increment an integer

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-29-04, 13:36
swaugh swaugh is offline
Registered User
 
Join Date: Dec 2004
Posts: 1
how to increment an integer

HI ALL
i am a newbie in SQL.tell me how to increment an integer variable, i dont want autoincrement.
Reply With Quote
  #2 (permalink)  
Old 12-29-04, 14:49
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,455
Thumbs down

Where is this integer? In a table in a variable, ...?
In a table: UPDATE MYTAB SET INT1=INT1+1 WHERE <some condition>;
In a variable: v_int:=v_int+1;
In a loop: FOR i1 IN 1..n LOOP...
In a query: SELECT INT1 + 1 INTO v_int from MYTAB...;

__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
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