473,394 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Oracle Query - column group

I have a query to retrieve few columns from different tables.

select distinct sso.sales_order_nb, sso.shipment_id, ssh.tracking_nb, sta_container.box_number, ste.sales_organization_code, ssd.compaq_part_nb, md.product_marketing_description
from sta_shipment_order sso, sta_shipment_err ste, sta_container, sta_shipment_header ssh, sta_shipment_detail ssd, material_description md .................


In this query when all the columns are same except ssd.compaq_part_nb, md.product_marketing_description , obviously I will be getting multiple rows .

But I want to make it in one row when only product_marketing_description is different by separating the descriptions with some '/ '

Please help me to get it done.

Thanks in advance
Oct 19 '07 #1
4 2562
amitpatel66
2,367 Expert 2GB
I have a query to retrieve few columns from different tables.

select distinct sso.sales_order_nb, sso.shipment_id, ssh.tracking_nb, sta_container.box_number, ste.sales_organization_code, ssd.compaq_part_nb, md.product_marketing_description
from sta_shipment_order sso, sta_shipment_err ste, sta_container, sta_shipment_header ssh, sta_shipment_detail ssd, material_description md .................


In this query when all the columns are same except ssd.compaq_part_nb, md.product_marketing_description , obviously I will be getting multiple rows .

But I want to make it in one row when only product_marketing_description is different by separating the descriptions with some '/ '

Please help me to get it done.

Thanks in advance
You can achieve this by using a PLSQL Block.
Write a function which combines the product_marketing_description with a "\" and return that value.

Call this function from the SELECT statement
Oct 19 '07 #2
You can achieve this by using a PLSQL Block.
Write a function which combines the product_marketing_description with a "\" and return that value.

Call this function from the SELECT statement
Hi Amit,

This is already a PL/SQL block. The query part I have mentioned is actaually in the cursor .Is it possible to do something in PL/SQl block itself without going for another fuction/Procedure

The result should be send as a report

Thanks
Oct 19 '07 #3
amitpatel66
2,367 Expert 2GB
Hi Amit,

This is already a PL/SQL block. The query part I have mentioned is actaually in the cursor .Is it possible to do something in PL/SQl block itself without going for another fuction/Procedure

The result should be send as a report

Thanks
Can you please POST your plsql block for my reference so that we could give you different options of achieving the functionality.
What kind of report is required? a flat file?
Oct 19 '07 #4
amitpatel66
2,367 Expert 2GB
Check out if you could use one more cursor passing ID to that and selecting the market products.

Call that cursor by pasing the ID, get all the products, and have a variable that stores the product values with delimited "\".Use that variable in your report.
Oct 19 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Michael | last post by:
Hello, I need to search in a number column for particular "subnumbers". For example I have a column with 3453454 in it an I like to searh for the number "53" in it. I know I could use select...
0
by: JWM | last post by:
I am trying to implement Oracle connection pooling for the following code, which was written by someone else. Here is my main question -- this java file creates code that is executed every hour,...
7
by: vnl | last post by:
I'm trying to run a SQL query but can't find any records when trying to select a certain date. Here's the sql: SELECT field 1, field2, date_and_time, FROM table1 WHERE date_and_time =...
3
by: Neil Zanella | last post by:
Hello, I would like to ask the about the following... PostgreSQL allows tables resulting from subselects to be renamed with an optional AS keyword whereas Oracle 9 will report an error...
13
by: Chris Botha | last post by:
The machine is running XP Pro with all the latest service packs, etc. I must access an Oracle database so I installed the Oracle client stuff. I can query Oracle from a Windows app, no problem....
14
by: peteh | last post by:
Hi All; We have many production jobs that "load from cursor" to a UDB/AIX 8.2 (with dpf) data warehouse from source tables residing Oracle 9i. Since Oracle dates are (roughly) equivalent to DB2...
3
by: RLN | last post by:
Re: Access 2003/Oracle 9i I have an Access app that connects to an Oracle DB via OLEDB/VBA code (no DSN or ODBC) Queries against straight Oracle tables run fine. For this query, however,...
1
by: 28490 | last post by:
Hi, In 10.2 when a query is run with GROUP BY it does not order the output by the grouped columns. In earlier versions the output was always sorted by the the grouped columns even though there...
7
by: =?Utf-8?B?QVRT?= | last post by:
HOWTO Run multiple SQL statements from ASP/ADO to an Oracle 10g. Please help, I'm trying to write an ASP page to use ADO to run a long query against an Oracle 10g database, to create tables,...
2
by: Vinod Sadanandan | last post by:
All, Below listed are the new features in Oracle 11g ,please join me in this discussion to generate a testcase and analyze each of the listed features . Precompilers:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.