欢迎来到福编程网,本站提供各种互联网专业知识!

在Oracle PL/SQL中游标声明中表名动态变化的方法

发布时间:2007-04-02 作者: 来源:转载
/*小弟刚刚接触ORACLE存储过程,有一个问题向各位同行求教,小弟写了一个存储过程,其目的是接收一个参数作为表名,然后查询该表中的全部记录的某一个字段的内容导入到另一个表中。(tabnameinvarchar)isv_servicesnametabname.服务类型%type;--这个变量就
/*
小弟刚刚接触ORACLE存储过程,有一个问题向各位同行求教,小弟写了一个存储过程,其目的是接收一个参数作为表名,然后查询该表中的全部记录的某一个字段的内容导入到另一个表中。
(
tabnameinvarchar
)
is
v_servicesnametabname.服务类型%type;--这个变量就是用来存放所要取得的字段内容,但不知该如何定义
cursorcurSort1isselect服务类型fromtabnameorderby编码;--此语句也不对提示找不到表名

begin
.....
endgetservicesname1;
Anexample:

createorreplaceprocedurecal(tbvarchar2)is
idpls_integer;
totalpls_integer:=0;
typeemp_curisrefcursor;
curemp_cur;
begin
opencurfor'selectemployee_idfrom'||tb;
loop
fetchcurintoid;
exitwhencur%notfound;

total:=total+id;
endloop;
closecur;

dbms_output.put_line(total)
end;*/

相关推荐