在存储过程中有如下语句:
select 姓名 from 水费 where 编号= 'A001 ';
假设这个表:水费 是我传递进来的参数,要返回姓名这个字段值,请问在存储过程中如何写?
sTableName in varchar,
------解决方案--------------------
create or replace procedure getName
( sTableName in varchar2,
name out varchar2)
is
sqlstr varchar2(1000);
begin
sqlstr:= 'select cname from '||sTableName;
execute immediate sqlstr into name;
exception
when others then
name:=null;
end;
------解决方案--------------------
up