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

Recommended Answers

All 3 Replies

what about passing more info .

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.