Hi. I'm learning PL/SQL so I've tried a few solutions to this with no success. I need to get the following query into a PL/SQL returning a SQL query for a chart that I am doing.
select null link,
to_char(rpt_dt,'MON') mydate,
pct_out "Year Selected"
from port_dist_t
where metric = :P1_METRIC
and rpt_dt between (to_date(:P1_MONTH)+1 -to_yminterval('01-00')) and (trunc((to_date(:P1_MONTH)),'dd'))
and metric_name = :P1_MET_CHART
My problem is the tick marks in the query. I can't seem to get them right because the entire SQL statement has to go inside of tick marks, am I right? The reason I am doing this is because I want the labels in my legend to reflect : P1_YEAR and not "Year Selected" (you can see that is the only way I can label the series and make the query work). So, I thought a way to make it work would be a PL/SQL function. But, the first step is to get the tick marks correct. Thank you.