Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PL/SQL statement returning a query

CocoaFeb 27 2017 — edited Mar 1 2017

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.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 29 2017
Added on Feb 27 2017
9 comments
1,067 views