How to merge (combine) 2 columns into 1 in oracle? How to merge (combine) 2 columns into 1 in oracle? oracle oracle

How to merge (combine) 2 columns into 1 in oracle?


concatenate?

select col1 || ' ' || col2 from tablex


This is a very vague requirement. Concatenate the values maybe?

insert into sometable( Column1 )values ( Column1 || Column2 );

If you need to specify the table name to INSERT into, then you will need to use dynamic SQL to achieve this. Would you need to specify the target column name as well? This example assumes you would use PL/SQL, which may not be appropriate in your case.

sql_stmt := 'INSERT INTO '|| specified_table || '(' || merge_column || ') VALUES ( :1 )';EXECUTE IMMEDIATE sql_stmt USING column1 || column2;

http://docs.oracle.com/cd/B13789_01/appdev.101/b10807/13_elems017.htm


You could make another column (an auxiliary column ) and replace the other 2 columns with this one.