Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2004
    Posts
    13

    Unanswered: 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

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    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.

  3. #3
    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

  4. #4
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    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
    Last edited by sathyaram_s; 09-03-04 at 12:50.
    Visit the new-look IDUG Website , register to gain access to the excellent content.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •