Skip to Main Content

SQL & PL/SQL

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!

Passing a TABLE TYPE to en EXECUTE IMMEDIATE statement

Samuel RabiniJun 15 2016 — edited Jun 28 2016

Hi,

I'm working on an Oracle Database 11g Enterprise Edition Release 11.2.0.3.0.

I'm writing a PL/SQL function that should execute another function via EXECUTE IMMEDIATE receiving as a parameter a TYPE TABLE and should return a number.

All the code is into the pk_dashboard package.

Here is the TYPE declaration:

  TYPE rec_dashboard_values IS RECORD (i_parameter NUMBER, parameter_name VARCHAR2(60),parameter_value NUMBER, parameter_lower_limit NUMBER,parameter_limit_1 NUMBER,parameter_limit_2 NUMBER,parameter_upper_limit VARCHAR2(2000), parameter_active NUMBER, parameter_incidence NUMBER, parameter_group NUMBER, parameter_order NUMBER, score NUMBER);

  TYPE tab_dashboard_values IS TABLE OF rec_dashboard_values;

and here is the function:

  FUNCTION get_dashboard_score (

    it_data         pk_dashboard.tab_dashboard_values

  ) RETURN NUMBER

  IS

    score_   NUMBER;

  BEGIN

      

    EXECUTE IMMEDIATE 'SELECT get_score(it_data => :it_data) FROM dual' INTO score_

          USING it_data;

         

    RETURN score_;

  END;

I'm getting the PLS-00457: expressions have to be of SQL types

for the USING clause.

It seems the syntax is working fine under a 12c instance.

Is it something doable under a 11g instance? if not, how can I achieve the same goal?

Thanks in advance,

Samuel

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 26 2016
Added on Jun 15 2016
6 comments
1,808 views