sql - How to pipeline a function with a dynamic name of columns? -



sql - How to pipeline a function with a dynamic name of columns? -

i need create study retrieve expenses lastly 12 months. depends on day execute study name of columns of study alter (for illustration if execute study in jul, should retrieve twelve columns expenses in jun, may, apr, march. name of columns lastly 12 months).

the next pl/sql code creates view dinamic name columns depending on sysdate.

declare vsql varchar2(4000); begin vsql := 'create or replace view ifsapp.rldatetest select ip.part_no, ifsapp.rd_purch_demand_qty_issue_api.get_avr_usage_per_month(ip.contract,ip.part_no ,to_char(sysdate, ''mm'')-1) ' || **substr(add_months(sysdate, -1),4,3)** || ', ifsapp.rd_purch_demand_qty_issue_api.get_avr_usage_per_month(ip.contract,ip.part_no ,to_char(sysdate, ''mm'')-2) ' || **substr(add_months(sysdate, -2),4,3)** || ' ifsapp.inventory_part ip ip.contract = ''s03'' '; execute immediate vsql; end;

(|| substr(add_months(sysdate, -1),4,3) || alias of each colum)

the point 1 time execute report, should create view , show rows. had thought of using pipelined (to create type table consisting of result of view , allow me select * table(getview())) in report.

my problem name of columns of view not same can't create type table using pipelined.

any thought how or other solution allow me utilize view in select statment?

many thanks.

either have misunderstood requirements or design nonsense. it's rare situation have dynamically ddl. have create dynamically view suspicious.

however didn't name columns in select part implicit names , may makes tham "dynamic". when create look in select statements, name them:

create or replace view v1 select + b a_plus_b table t;

have no thought pipelining has @ all.

sql oracle plsql

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -