I have a stored procedure
create or replace procedure GETFILE(TableName in VARCHAR2)
is
No_Rows Number :=0;
state varchar2(100);
begin
state :=' select count(*) into :p_id fro开发者_Go百科m ' || inTableName;
EXECUTE IMMEDIATE state using out NO_ROWS;
end;
end;
Stored procedure is getting created successfully. But when i am running it using:
declare
begin
GETFILE('TABLE_NAME');
end;
It showing "ORA-01006: bind variable does not exist" error. Any idea?
Will this work for your requirement ( you may want to remove the put_line )...:
create or replace procedure GETFILE(inTableName in VARCHAR2)
is
No_Rows Number :=0;
state varchar2(100);
begin
state :=' select count(*) from ' || inTableName;
dbms_output.put_line(state);
EXECUTE IMMEDIATE state into NO_ROWS;
dbms_output.put_line(no_rows);
end;
/
declare
begin
getfile('dual');
end;
/
I don't think there is any coding error here
so, I think you have to ensure that you are creating and executing your procedure
at the same data base or at the same schema
精彩评论