I have a table (ABC) that has:
pro varchar2(12) not null (primary key)
pat varchar2(12) not null (primary key)
ic1 varchar2(1)
ic2 varchar2(1)
ic3 varchar2(1)
ic4 varchar2(1)
If I want to create a view that will return a row for each ic type i could specify:
create or replace view as
select pro,pat,ic1 as 'ictype',ic1 as 'icvalue'
union
select pro,pat,ic2 as 'ictype',ic2 as 'icvalue'
union
select pro,pat,ic3 as 'ictype',ic3 as 'icvalue'
union
select pro,pat,ic4 as 'ictype',ic4 as 'icvalue'
;
and this would return rows for each ic value. My question is, is there a more efficent way to do this via a view. With my example, worst case I am making 4 passes thru the data. Unfortunately I need to implement this via a view rather than a stored procedure since the product the programmers use doesn't support stored procedures (how neanderthal is that!)
Thanks!
pro varchar2(12) not null (primary key)
pat varchar2(12) not null (primary key)
ic1 varchar2(1)
ic2 varchar2(1)
ic3 varchar2(1)
ic4 varchar2(1)
If I want to create a view that will return a row for each ic type i could specify:
create or replace view as
select pro,pat,ic1 as 'ictype',ic1 as 'icvalue'
union
select pro,pat,ic2 as 'ictype',ic2 as 'icvalue'
union
select pro,pat,ic3 as 'ictype',ic3 as 'icvalue'
union
select pro,pat,ic4 as 'ictype',ic4 as 'icvalue'
;
and this would return rows for each ic value. My question is, is there a more efficent way to do this via a view. With my example, worst case I am making 4 passes thru the data. Unfortunately I need to implement this via a view rather than a stored procedure since the product the programmers use doesn't support stored procedures (how neanderthal is that!)
Thanks!