Oracool,
Thought I'd try a different tack to do the same thing but still no luck, Can you see what's wrong eith this?
1 PROCEDURE cnt_tbl (var1 IN VARCHAR2) AS
2 cid INTEGER;
3 BEGIN
4 cid := DBMS_SQL.OPEN_CURSOR;
5 DBMS_SQL.PARSE(cid,'SELECT COUNT(*) FROM...
Oracool,
My cutting & pasting is lacking - the '/' is there. The buffer definitely contains:
DECLARE
var1 char(20):= 'ng1.users';
sql_stmt varchar2(500):= null;
BEGIN
select 'select count(*) from '||var1 into sql_stmt
from dual;
EXECUTE IMMEDIATE sql_stmt;
end;
/
but still getting the last 2...
OraCool
Thanks for the response. Still having a problem tho'.
Now running:
1 DECLARE
2 var1 char(20):= 'ng1.users';
3 sql_stmt varchar2(500):= null;
4 BEGIN
5 select 'select count(*) from '||var1 into sql_stmt
6 from dual;
7 EXECUTE IMMEDIATE sql_stmt;
8* end;
which gives
ERROR at line...
Hi,
I am trying to write a generic bit of SQL (Oracle 8i) to run against more than one table - the table being unknown until runtime. I am therfore trying to pass the table name as a variable to the Select statement as follows:
1 DECLARE
2 var1 char(20):= 'ng1.users';
3 sql_stmt varchar2(500):=...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.