Discussions
Categories
- 17.9K All Categories
- 3.4K Industry Applications
- 3.3K Intelligent Advisor
- 62 Insurance
- 536K On-Premises Infrastructure
- 138.2K Analytics Software
- 38.6K Application Development Software
- 5.7K Cloud Platform
- 109.4K Database Software
- 17.5K Enterprise Manager
- 8.8K Hardware
- 71.1K Infrastructure Software
- 105.2K Integration
- 41.5K Security Software
Parameterised Views

I have query like this
SELECT
isin,
MAX(price_date) AS price_date,
MAX(price) KEEP (DENSE_RANK LAST ORDER BY price_date) AS price
FROM share_price
WHERE trunc(price_date,'DD') <= to_date('30.11.2014','DD.MM.YYYY')
GROUP BY isin;
and I need it every month, so I would like to put it in a view.
Selecting from that view using an ISIN in the where clause is no problem, but as the reporting date changes every month, it would be great to have a date parameter that I can pass to the view when calling it.
So instead of using a fixed date, I would declare:
CREATE VIEW share_price_date AS
SELECT
isin,
MAX(price_date) AS price_date,
MAX(price) KEEP (DENSE_RANK LAST ORDER BY price_date) AS price
FROM share_price
WHERE trunc(price_date,'DD') <= :reporting_date
GROUP BY isin;
A plain SELECT would then look like
SELECT isin, price_date, price
FROM share_price_date (to_date('30.11.2014','DD.MM.YYYY'))
WHERE isin = 'DE123456789022'
which would save me from inventing any workarounds.