0

Hi all,

I have a problem in creating a matrix table using a PL SQL select query.

The table should look like:

|---------------------------------------------------------|
|--|-1-|-2-|-3-|-4-|-5-|-6-...-----------------------|100 |
|---------------------------------------------------------|
|A |A1 | A2| A3| A4| A5| A6|.........................|A100|
|B |B1 | B2| B3| B4| B5| B6|.........................|B100|
|.........................................................|
|Z |Z1 | Z2| Z3| Z4|.................................|Z100|
|---------------------------------------------------------|

For every cell I have to check in a table if the element exists or not, so for example in the B5 cell I will B5 if it exists or null otherwise.


Thanks in advance,
Ender

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by debasisdas
0
SELECT DECODE(substr(location,2,3), '2', location, NULL) AS "2",
DECODE(substr(location,2,3), '3', location, NULL) AS "3",
DECODE(substr(location,2,3), '4', location, NULL) AS "4",
....
DECODE(subtsr(location,2,3), '100', location, NULL) AS "100",
from location_table

This is the first part, that I did. So I have the data sorted on columns from 2 to 100, but now I want to add a column in the first position with letters from A to Z and have the data corresponding to the letter. Because

substr(location, 1,1)

is a letter from A to Z.

0

Can i have your table structure and some sample data please, that will really help understand your question better.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.