Home » SQL & PL/SQL » SQL & PL/SQL » execute immediate issue - updated
execute immediate issue - updated [message #36026] Tue, 30 October 2001 12:33 Go to next message
kshathrya
Messages: 29
Registered: October 2001
Junior Member
can u tell me whats the issue here, please. The table name is not being picked by the execyte immediate

DECLARE
v NUMBER;
v_obj_name VARCHAR2 (40);
qry VARCHAR2 (100);
BEGIN
v_obj_name := 'MAN';
qry := 'SELECT COUNT(*) INTO '
|| v
|| ' FROM '
|| v_obj_name ;
EXECUTE IMMEDIATE qry;
DBMS_OUTPUT.put_line (v);
END;

----------------------------------------------------------------------
Re: execute immediate issue - updated [message #36027 is a reply to message #36026] Tue, 30 October 2001 13:34 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
DECLARE
v NUMBER;
v_obj_name VARCHAR2 (40);
qry VARCHAR2 (100);
BEGIN
v_obj_name := 'MAN';
qry := 'SELECT COUNT(*) FROM ' || v_obj_name;
EXECUTE IMMEDIATE qry into v;
DBMS_OUTPUT.put_line (v);
END;

----------------------------------------------------------------------
Previous Topic: SELECT with variables
Next Topic: SQL Query - return values from 2 rows as 1 row??
Goto Forum:
  


Current Time: Wed Dec 25 11:23:01 CST 2024