I am creating a view that requires rows from a table. The rows in the table need to correspond to columns in the view.
Table Items:
Result: (3 rows found in table, items)
isr_no badge_nbr model serial_nbr manu_cd
MTR-10 1234 RRT 98743QT INVENSYS
MTR-10 8986 RRT 082345X INVENSYS
MTR-10 2233 QSV 129Z45B LAND/G
++++++++++++++++++++++++++++++++++++++++++++
View being created:
I want to assign the first row returned to oi_badge_1 (and corresponding other columns),
The second row to oi_badge_2, and the third to oi_badge_3
accordingly. (the acutual order of the result set is not important. Just the first one retreived goes to the first assignment in the view.)
I know, as written, this will give an error that the number of columns do not match. After many atempts to make the assignmets, it just escapes me.
Your suggestions are appreciated.
Thanks in advance.
Table Items:
Code:
Select isr_no, badge_nbr, model, serial_nbr, manu_cd
from items
where isr_no = 'mtr-10';
Result: (3 rows found in table, items)
isr_no badge_nbr model serial_nbr manu_cd
MTR-10 1234 RRT 98743QT INVENSYS
MTR-10 8986 RRT 082345X INVENSYS
MTR-10 2233 QSV 129Z45B LAND/G
++++++++++++++++++++++++++++++++++++++++++++
View being created:
Code:
Create or replace view j_items_v
(
oi_badge_1
,oi_model_1
,oi_serial_nbr_1
,oi_manu_cd_1
,oi_badge_2
,oi_model_2
,oi_serial_nbr_2
,oi_manu_cd_2
,oi_badge_3
,oi_model_3
,oi_serial_nbr_3
,oi_manu_cd_3
)
AS
SELECT
badge_nbr
,model
,serial_nbr
,manu_cd
from items
where isr_no = 'mtr-10';
I want to assign the first row returned to oi_badge_1 (and corresponding other columns),
The second row to oi_badge_2, and the third to oi_badge_3
accordingly. (the acutual order of the result set is not important. Just the first one retreived goes to the first assignment in the view.)
I know, as written, this will give an error that the number of columns do not match. After many atempts to make the assignmets, it just escapes me.
Your suggestions are appreciated.
Thanks in advance.