oracle 存储过程编译有问题
本帖最后由 wanglianxi2008IT 于 2012-11-21 10:11:01 编辑
CREATE OR REPLACE PROCEDURE test_proc
(
tablename IN varchar2
) IS
filed_test varchar2(30):='';
VN_Field_Str varchar2(4000):= '';
BEGIN
declare CURSOR Cur_fieldsd IS
select column_name
from user_tab_columns
where upper(table_name) = upper(tablename);
OPEN Cur_fieldsd;
LOOP
FETCH Cur_fieldsd
INTO filed_test;
EXIT WHEN Cur_fieldsd%NOTFOUND;
VN_Field_Str := VN_Field_Str || filed_test || ',';
end loop;
CLOSE Cur_fieldsd;
dbms_output.put_line(VN_Field_Str);
END test_proc;
call test_proc('T_BC_OtherExpenseBill');
PROCEDURE EASUSER4.TEST_PROC 编译错误
错误:PLS-00103: 出现符号 "FETCH"在需要下列之一时:
constant exception
<an identifier> <a double-quoted delimited-identifier> table
LONG_ double ref char time timestamp interval date binary
national character nchar
行:19
文本:FETCH Cur_fieldsd
错误:PLS-00103: 出现符号 "CLOSE"在需要下列之一时:
end not pragma final
instantiable order overriding static member constructor map
行:24
文本:CLOSE Cur_fieldsd;
------最佳解决方案--------------------CREATE OR REPLACE PROCEDURE test_proc
(
tablename IN varchar2
) IS
filed_test varchar2(30):='';
VN_Field_Str varchar2(4000):= '';
CURSOR Cur_fieldsd IS
select column_name
&