动态sql和静态sql 10
createorreplacefunctionget_counts(v_namevarchar2)returnnumberasv_countnumber;beginexe...
create or replace function get_counts(v_name varchar2)
return number
as
v_count number;
begin
execute immediate
'select count(*) from '||v_name
into v_count;
return v_count;
end;
如果不用动态SQL应该怎么写
create or replace function get_counts(v_name varchar2)
return number
as
v_count number;
begin
select count(*) into v_count from v_name;
return v_count;
end;
这样写的话v_name不能作为变量,该怎么写? 展开
return number
as
v_count number;
begin
execute immediate
'select count(*) from '||v_name
into v_count;
return v_count;
end;
如果不用动态SQL应该怎么写
create or replace function get_counts(v_name varchar2)
return number
as
v_count number;
begin
select count(*) into v_count from v_name;
return v_count;
end;
这样写的话v_name不能作为变量,该怎么写? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询