Home » SQL & PL/SQL » SQL & PL/SQL » Concatenation query
Concatenation query [message #382752] Sat, 24 January 2009 04:44 Go to next message
raopapa
Messages: 10
Registered: January 2009
Junior Member
How to concentate the two column values into one.

Create table test
(
id number(1)
name varchar2(3)
)

insert into test values (1,'abc');
insert into test values (1,'xyz');

how to get the output in the follwoing way
Excected result:=
-----------------

1 abcxyz


Paparao
Re: Concatenation query [message #382758 is a reply to message #382752] Sat, 24 January 2009 06:42 Go to previous messageGo to next message
Barbara Boehmer
Messages: 8635
Registered: November 2002
Location: California, USA
Senior Member
There are a few methods demonstrated in the following thread:

http://www.orafaq.com/forum/m/345288/43710/?srch=wm_concat+stragg#msg_345288

and more examples and methods here:

http://www.williamrobertson.net/documents/one-row.html

If you search this forum and the internet, you will find many more.
Re: Concatenation query [message #382766 is a reply to message #382752] Sat, 24 January 2009 08:59 Go to previous messageGo to next message
Michel Cadot
Messages: 64133
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
In addition, please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter), use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).
Use SQL*Plus and copy and paste your session.

Regards
Michel

[Updated on: Sat, 24 January 2009 09:05]

Report message to a moderator

Re: Concatenation query [message #382773 is a reply to message #382752] Sat, 24 January 2009 09:37 Go to previous message
dr.s.raghunathan
Messages: 540
Registered: February 2008
Senior Member
while using barbara suggested notes, there is a possiblity of getting report value as xyzabc instead of your required abcxyz. Hence you may require one more parameter to control on data behaviour. good luck
yours
dr.s.raghunathan
Previous Topic: ORA-06502: PL/SQL: numeric or value error
Next Topic: PLS-00049: bad bind variable (merged)
Goto Forum:
  


Current Time: Thu Dec 08 04:03:02 CST 2016

Total time taken to generate the page: 0.10113 seconds