How to concatenate two SELECT results

Hi there,

Is there anyway to concatenate two string results without using variables?

I want to concatenate query results like these two in the Code Box.

The result from the first is '08OUT14' and from the second one is 'JOCO', so the result that i want would be '08OUT14JOCO'.

Any help?
SELECT TO_CHAR(data_inicio,'YYMONDD') FROM registo_eventos WHERE customer_id = 28704000002662 
	  
SELECT SUBSTR(p.display_name,1,3) FROM ev_produtos ev, product p WHERE p.product_id = ev.product_id AND customer_id = 28704000002662

Open in new window

vmorais_Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Raja Jegan RSQL Server DBA & Architect, EE Solution GuideCommented:
Hope this helps
SELECT (SELECT TO_CHAR(data_inicio,'YYMONDD') FROM registo_eventos WHERE customer_id = 28704000002662 ) || (SELECT SUBSTR(p.display_name,1,3) FROM ev_produtos ev, product p WHERE p.product_id = ev.product_id AND customer_id = 28704000002662) FROM dual

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
johnsoneSenior Oracle DBACommented:
rrjegan17's post assumes only 1 record could ever be returned by the queries.

If that is not the case, this would work.  You need to substitute either ev or p for ?? on the last line, I don't know which table CUSTOMER_ID is in.
SELECT TO_CHAR(a.data_inicio,'YYMONDD') || SUBSTR(p.display_name,1,3)
  FROM registo_eventos a, ev_produtos ev, product p
 WHERE a.customer_id = 28704000002662 and
       p.product_id = ev.product_id and
       a.customer_id = ??.customer_id;

Open in new window

0
awking00Information Technology SpecialistCommented:
Can you post the relevant table structures with some sample data and what you expect the output to be?
0
vmorais_Author Commented:
I have done it like this..

I will put this script in a WINDOWS schedule task, having in log all the update statements.

Thanks.
	SELECT 'UPDATE CUSTOMER SET NAME = ''' || TO_CHAR(re.data_inicio,'YYMONDD', 'NLS_DATE_LANGUAGE =AMERICAN') || SUBSTR(p.display_name,1,3) || SUBSTR(emp.first_name,1,2) || SUBSTR(emp.last_name,1,2)
	  		|| '-' || re.ev_obj_accao || ''' WHERE CUSTOMER_ID = ' || c.CUSTOMER_ID || ';' 
	  		|| CHR(10)
	  		|| 'COMMIT;'
	  		|| CHR(10)
	  		|| 'UPDATE MEETING_VENUE SET NAME = ''' || TO_CHAR(re.data_inicio,'YYMONDD', 'NLS_DATE_LANGUAGE =AMERICAN') || SUBSTR(p.display_name,1,3) || SUBSTR(emp.first_name,1,2) || SUBSTR(emp.last_name,1,2)
	  		|| '-' || re.ev_obj_accao || ''' WHERE CUSTOMER_ID = ' || c.CUSTOMER_ID || ';' 
	  		|| CHR(10)
	  		|| 'COMMIT;'	
	FROM registo_eventos re, ev_produtos ev, product p, employee emp, customer c, meeting_venue mv
	  	WHERE p.product_id = ev.product_id
	  	AND re.creator_employee_id = emp.employee_id
	  	AND mv.customer_id = ev.customer_id
	  	AND ev.customer_id = c.customer_id
	  	AND c.customer_id = re.customer_id
	  	--AND c.name <> mv.name
	  	--AND re.data_inicio > TO_DATE('30-06-2009', 'DD-MM-YYYY')
	  	AND c.name = 'Evento'

Open in new window

0
johnsoneSenior Oracle DBACommented:
Interesting.  The posted solution most resembles my suggestion, however I got no points.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.