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 > change to db2 code

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-18-06, 06:35
welyngj welyngj is offline
Registered User
 
Join Date: Feb 2004
Posts: 15
change to db2 code

How to change these oracle code to db2 code:
declare cnt int;
begin
SELECT COUNT(*) INTO cnt from PODTX03
WHERE TRNDATE < INT( TOCHAR( sdate, 'YYYYMMDD' ) ) ;
end;

thanks
Reply With Quote
  #2 (permalink)  
Old 09-18-06, 08:53
GertK GertK is offline
Registered User
 
Join Date: Nov 2003
Location: Netherlands
Posts: 96
Quote:
Originally Posted by welyngj
How to change these oracle code to db2 code:
declare cnt int;
begin
SELECT COUNT(*) INTO cnt from PODTX03
WHERE TRNDATE < INT( TOCHAR( sdate, 'YYYYMMDD' ) ) ;
end;

thanks
Check this website for a lot of valuable UDF's when migrating to DB2. Because they were created when V9 didn't exist some of them might be available allready as a builtin function.

Regards, Gert
Reply With Quote
  #3 (permalink)  
Old 09-18-06, 21:23
welyngj welyngj is offline
Registered User
 
Join Date: Feb 2004
Posts: 15
Thanks for your reply.
Except the user defined function,
I also want to know how to
change the 'select count(*) into cnt from tb1 '
into db2.
It cannot execute like 'begin atomic declare cnt int;
select count(*) into cnt from tb1; end'.
Reply With Quote
  #4 (permalink)  
Old 09-19-06, 05:12
rahul_s80 rahul_s80 is offline
Registered User
 
Join Date: Jul 2006
Location: Pune , India
Posts: 433
create table count (no integer)@

begin atomic
declare cnt int;
delete from count;
set cnt=(select count(*) from eone.tdb_patch_dtl);
insert into count values (cnt);
end@

--Rahul Singh
Reply With Quote
  #5 (permalink)  
Old 09-19-06, 21:12
welyngj welyngj is offline
Registered User
 
Join Date: Feb 2004
Posts: 15
Thanks.solved
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