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!

select table function with a dynamic parameter input ?

Norbert.HeinJun 15 2017 — edited Jun 16 2017

select table function with a dynamic parameter input ?

I have a ok running 'select Table function'

and want to substitute the function parameter

by another sql select:

select * from TABLE ( MY_DB_PACK.f_get_table_values( param => 'have_an_input_parameter_here_from_sql' ));

to show it in exsamples:

#1

the singe select is like this:

sql>

select param_1 ,  val_1,  val_2

from TABLE ( MY_DB_PACK.f_get_data_from_large_table( p_param_1 => 'ABC' ) );

;

'ABC', 12345, 23456

'ABC', 34567, 56789

.....

this is running well

#2

i can substitute the function parameter

sql>

var p_param_1 := 'ABC' ;

select param_1,  val_1,  val_2

from TABLE ( MY_DB_PACK.f_get_data_from_large_table( p_param_1 => :p_param_1 ));

'ABC', 12345, 23456

'ABC', 34567, 56789

.....

this is running well

#3

for using this select table in a view and connect it with other tables

i have to change the function and the select to work in this matter

select t.param_1,  t.val_1,  t.val_2 , o.param_o

from TABLE ( MY_DB_PACK.f_get_data_from_large_table( ) ) t, other_table o

where t.param_1 = o.param_o

and   o.param_o = 'ABC' ;

'ABC', 12345, 23456 , 'ABC'

'ABC', 34567, 56789 , 'ABC'

.....

is running well BUT slow

this needs  lot of more time,

because

the param select is not longer inside the table-function

how to do in #3  to substitute / put_in the parameter directly

as in #2  but from another sql/select  ?

regards

Norbert

This post has been answered by AndrewSayer on Jun 16 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 14 2017
Added on Jun 15 2017
11 comments
5,807 views