0

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     from   ' || 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?

1
  • Beware of SQL injection! Commented Apr 19, 2011 at 7:01

2 Answers 2

2

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;
/
Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.