Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

interleaving? table rows in oracle

Posted on 2007-11-21
2
Medium Priority
?
641 Views
Last Modified: 2013-12-19
hi, i have an oracle 9i table (called Vehicles).

it has 3 columns (vehicle_id, measurement_1, measurement_2)

i'd like to create a view from this table that "interleaves" the values of measurement_1 and measurement_2.  not sure if "interleave" is the right verb and google hasn't helped.

e.g. the vehicles table's rows might look like this (values separated by commas):

1, 55.2, 58
2, 80, null
3, 40, 42
4, null, 18

i'd like the resulting view to display

1, 55.2
1, 58
2, 80
2, null
3, 40
3, 42
4, null
4, 18


which essentially "merges" the 2 columns called "measurement_1" and "measurement_2"

i feel like this is going to be a head-slapper when I finally figure it out, but right now i'm stumped as to how to merge these 2 columns into 1.

any ideas?
thanks!
0
Comment
Question by:pdanese
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 74

Accepted Solution

by:
sdstuber earned 800 total points
ID: 20331004
select id, decode(n,1, measure1,2,measure2) measure
from vehicles,(select 1 n from dual union all select 2 n from dual)
order by id,n
0
 

Author Closing Comment

by:pdanese
ID: 31410471
thank you very much!  awesome.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question