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!

how to pass a table name contains forward slash as a parameter to a plsql function

VSN MoorNov 25 2021

I have a plsql function as below:

CREATE OR REPLACE FUNCTION test_function_f(p_view_name in varchar2 default null)
return varchar2 is
sql_qry varchar2(2000) := null;
emp_tot varchar2(500) := null;
begin
	sql_qry := 'select count(*) from '||p_view_name;
	execute immediate sql_qry into emp_tot;
	return emp_tot;
end;
/
show errors;

and I call above function in a procedure.

create or replace procedure test_proc_p(p_view_name in varchar2 default null) is
tab_count varchar2(50) := null;
begin
	tab_count := test_function_f(p_view_name);
	dbms_output.put_line('the count: '||tab_count);
end;
/
sho err;


My table/View name is like this: /BIC/CUSTOMER
How to pass this table to the above procedure/function??

This post has been answered by VSN Moor on Nov 25 2021
Jump to Answer
Comments
Post Details
Added on Nov 25 2021
6 comments
6,977 views