Sunday, May 19, 2013

Menyalin data dalam table yg sama (copy record)

    Table  tbl0,tlb1;
    Numberx  id;
    ;

        /** #1.Filter data yg akan di-copy **/

        select * from tbl0
        where tbl0.id == '12345';

        tbl1 = tbl0;

        ttsbegin;

            tbl1.data(tbl0);

        /** #2.Lakukan update field yg diperlukan **/
       
            tbl1.duplicated = Noyes::Yes;
            tbl1.CreatedDateTimex = DateTimeUtil::getSystemDateTime();


            if (!tbl1.validateWrite())
            {
                throw Exception::Error;
            }

        /** #3. Simpan **/   
            tbl1.insert();

        ttscommit;

No comments:

Post a Comment