Note that there are some explanatory texts on larger screens.

plurals
  1. POMerge multiple rows into one?
    primarykey
    data
    text
    <p>I have one stage table '<code>STAGE_TABLE</code>' which includes following values (columns are varchar2 except ids) -</p> <pre><code>+------------------------------------------------------------------------------------------------------------------------- ¦ STAGE_ID ¦ EMP_ID ¦ ATTR1_OLD_VAL ¦ ATTR1_NEW_VAL ¦ ATTR2_OLD_VAL ¦ ATTR2_NEW_VAL ¦ ATTR3_OLD_VAL ¦ ATTR3_NEW_VAL ¦ ¦-----------+------------+---------------+---------------+---------------+---------------+---------------+---------------¦ ¦ 1 ¦ E001 ¦ xyz ¦ pqr ¦ mmm ¦ nnn ¦ zzz ¦ aaa ¦ ¦ 2 ¦ E001 ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ 3 ¦ E001 ¦ pqr ¦ abc ¦ xxx ¦ yyy ¦ ¦ ¦ ¦ 4 ¦ E002 ¦ aaa ¦ ccc ¦ bbb ¦ ttt ¦ ¦ ¦ ¦ 5 ¦ E002 ¦ ¦ ¦ ¦ ¦ fff ¦ ppp ¦ ¦ 6 ¦ E002 ¦ ¦ ¦ kkk ¦ jjj ¦ ¦ ¦ +------------------------------------------------------------------------------------------------------------------------- </code></pre> <p>I want to merge multiple rows from above table belonging to same employee into one -</p> <pre><code>+------------------------------------------------------------------------------------------------------------- ¦ EMP_ID ¦ ATTR1_OLD_VAL ¦ ATTR1_NEW_VAL ¦ ATTR2_OLD_VAL ¦ ATTR2_NEW_VAL ¦ ATTR3_OLD_VAL ¦ ATTR3_NEW_VAL ¦ ¦------------+---------------+---------------+---------------+---------------+---------------+---------------¦ ¦ E001 ¦ pqr ¦ abc ¦ xxx ¦ yyy ¦ zzz ¦ aaa ¦ ¦ E002 ¦ aaa ¦ ccc ¦ kkk ¦ jjj ¦ fff ¦ ppp ¦ +------------------------------------------------------------------------------------------------------------- </code></pre> <p>I came to know about MERGE statement but not sure if it will work. I am new to oracle pl/sql.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload