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 > Equivalent of Oracle's %ROWTYPE in DB2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-03-04, 02:11
sw_flintstone sw_flintstone is offline
Registered User
 
Join Date: Jun 2004
Posts: 13
Equivalent of Oracle's %ROWTYPE in DB2

Hi

I am presently converting a Oracle database to DB2. I have converted almost everything and wrote a Java program for converting %TYPE format too.

Now My problem is that I am confused about TABLENAME%ROWTYPE. As its very hard for me to find the DB2 equivalent for the same. For me the most suitable replacement would be defining a cursor for the same.

Please enlighten me for the same.

regards
sw_flintstone
Reply With Quote
  #2 (permalink)  
Old 09-03-04, 03:26
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
I think you are right ...

Here is an example from Dev Domain article

PL/SQL
DECLARE
rowtype1 table1%ROWTYPE;
[columns a,b,c];
Variable9 datatype9 := value9;
BEGIN
SELECT * INTO rowtype1 FROM table1
WHERE c = xxxx;
END;

SQL PL (DB2)
BEGIN
DECLARE variablea datatype1;
DECLARE variableb datatype2;
DECLARE variablec datatype3;
DECLARE variable9 datatype9
DEFAULT value9;
SELECT a, b, c INTO variablea, variableb,
variablec
FROM table1 WHERE c = xxxx;
END;

cheers
Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 09-03-04, 08:31
sw_flintstone sw_flintstone is offline
Registered User
 
Join Date: Jun 2004
Posts: 13
Thanks for the help Sathyaram.

However one more person told me to use GLOBAL TEMPORARY TABLE. Which may be also helpful for the same. (just felt like sharing the info)

Thanks again.
sw_flintstone
Reply With Quote
  #4 (permalink)  
Old 09-03-04, 11:45
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Thanks for the feedback ...

That other person sits next to me

When you are successful in your attempt, it will be useful for others if you post a sample code here ....


Thanks

Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.

Last edited by sathyaram_s; 09-03-04 at 11:50.
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