我的源码:procedure acnt_add_nocmt_base(
money IN VARCHAR2,
userId IN VARCHAR2,
inId IN VARCHAR2,
inType IN VARCHAR2,
inRe IN VARCHAR2,
operId IN VARCHAR2,
tableAccount IN VARCHAR2,--变量,表名
tableAccount_his IN VARCHAR2,
outCode OUT INT,
errMsg OUT VARCHAR2
)
-- 帐户余额增加,非自动提交
-- create by lyf 08.09.16
AS
errCode number ;
newId VARCHAR2(20);
imoney_all number ;
before_m number;
after_m number;
tableAccount_a VARCHAR2(20); begin
errCode := 1;
tableAccount_a :=tableAccount;
begin
select nvl(money_all,0) into imoney_all from tableAccount --在这里当表名用
where user_id=userId and status=0 and rownum<2;
exception when no_data_found then
outCode := 2;
errMsg := '未找到对应帐户信息';
return ;
end;
before_m := imoney_all;
--修改余额
imoney_all := imoney_all + Money;
update tableAccount set money_all=imoney_all where user_id=userId and status=0;
after_m := imoney_all ;
--日志
insert into log_account select * from tableAccount where user_id=userId and status=0; --记录
select seq_normal.NEXTVAL into newId from dual;
insert into tableAccount_his(id,user_id,create_time,money,types,ext_id,ext_type,Re,oper_id,pre_money
,before_money,after_money)
values(newId,userId,sysdate,money,'余额增加',inId,inType,inRe,operId,imoney_all,before_m,after_m);
errCode := 0;
outCode := errCode;
exception when others then
errCode := 13;
outCode := errCode;
errMsg := sqlerrm;
end;
报错:
Line: 28 Column: 50 Error: PLS-00201: 必须说明标识符 'TABLEACCOUNT'
Line: 28 Column: 5 Error: PL/SQL: SQL Statement ignored
Line: 39 Column: 10 Error: PLS-00201: 必须说明标识符 'TABLEACCOUNT'
Line: 39 Column: 3 Error: PL/SQL: SQL Statement ignored
Line: 43 Column: 41 Error: PLS-00201: 必须说明标识符 'TABLEACCOUNT'
Line: 43 Column: 3 Error: PL/SQL: SQL Statement ignored
Line: 47 Column: 15 Error: PLS-00201: 必须说明标识符 'TABLEACCOUNT_HIS'
Line: 47 Column: 3 Error: PL/SQL: SQL Statement ignored我主要是想:把变量tableAccount 当作参数在下面使用;但是不对,大家看看!
money IN VARCHAR2,
userId IN VARCHAR2,
inId IN VARCHAR2,
inType IN VARCHAR2,
inRe IN VARCHAR2,
operId IN VARCHAR2,
tableAccount IN VARCHAR2,--变量,表名
tableAccount_his IN VARCHAR2,
outCode OUT INT,
errMsg OUT VARCHAR2
)
-- 帐户余额增加,非自动提交
-- create by lyf 08.09.16
AS
errCode number ;
newId VARCHAR2(20);
imoney_all number ;
before_m number;
after_m number;
tableAccount_a VARCHAR2(20); begin
errCode := 1;
tableAccount_a :=tableAccount;
begin
select nvl(money_all,0) into imoney_all from tableAccount --在这里当表名用
where user_id=userId and status=0 and rownum<2;
exception when no_data_found then
outCode := 2;
errMsg := '未找到对应帐户信息';
return ;
end;
before_m := imoney_all;
--修改余额
imoney_all := imoney_all + Money;
update tableAccount set money_all=imoney_all where user_id=userId and status=0;
after_m := imoney_all ;
--日志
insert into log_account select * from tableAccount where user_id=userId and status=0; --记录
select seq_normal.NEXTVAL into newId from dual;
insert into tableAccount_his(id,user_id,create_time,money,types,ext_id,ext_type,Re,oper_id,pre_money
,before_money,after_money)
values(newId,userId,sysdate,money,'余额增加',inId,inType,inRe,operId,imoney_all,before_m,after_m);
errCode := 0;
outCode := errCode;
exception when others then
errCode := 13;
outCode := errCode;
errMsg := sqlerrm;
end;
报错:
Line: 28 Column: 50 Error: PLS-00201: 必须说明标识符 'TABLEACCOUNT'
Line: 28 Column: 5 Error: PL/SQL: SQL Statement ignored
Line: 39 Column: 10 Error: PLS-00201: 必须说明标识符 'TABLEACCOUNT'
Line: 39 Column: 3 Error: PL/SQL: SQL Statement ignored
Line: 43 Column: 41 Error: PLS-00201: 必须说明标识符 'TABLEACCOUNT'
Line: 43 Column: 3 Error: PL/SQL: SQL Statement ignored
Line: 47 Column: 15 Error: PLS-00201: 必须说明标识符 'TABLEACCOUNT_HIS'
Line: 47 Column: 3 Error: PL/SQL: SQL Statement ignored我主要是想:把变量tableAccount 当作参数在下面使用;但是不对,大家看看!
解决方案 »
- 关于sqlplus的一个登录问题?
- toad
- oracle dblink问题 请高手指点 急!!!!
- 200分提问:如何给视图建立索引?
- 想在ORACLE另一个用户下建个触发器,触发我本地的用户中的表进行insert的,怎么做?
- Oracle 如何插入 Byte
- PL/SQL 中使用 delete truncate
- Oracle 9.0 建库时提示ORA-19502,无法创建REDO01.LOG文件!
- 请高手解答
- 请问ORACLE 9i支持ADO.NET吗?!
- 请教 关于Oracle存储过程的问题
- Oracle 数据导入问题!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
用动态SQL就行了。
is
tblname nvarchar2(30);
s nvarchar2(30);
ssql varchar2(1000);
begin
s := v_in;
while instr(s,',') > 0
loop
tblname := substr(s,1,instr(s,',')-1);
s := substr(s,instr(s,',')+1,length(s)-instr(s,','));
ssql := 'delete from '||tblname;
execute immediate ssql;
end loop;
ssql := ' delete from '||s;
execute immediate ssql;
end;
/
execute immediate ssql;[[/code]这种样式的吧!
改起来实在烦人呀