Ok sorry if this seems simple but zero sleep is catching up

I'd like to accomplish the following but I want to dynamically pass
EMPNO and EMP to the FOR loop as opposed to hard coding them.

The desired result set looks like the following with the values
hard coded as below

set serveroutput on

CREATE OR REPLACE PROCEDURE merge_one
AS
BEGIN
FOR x IN (SELECT empno FROM emp) LOOP
dbms_output.put_line(x.empno);
END LOOP;
END;
/

exec merge_one;


7369
7499
7521
7566
7654
7698
7782
7788
7839
7844


However, when I try and pass EMPNO and EMP dynamically I am not getting what I want. Here is what I tried


set serveroutput on

CREATE OR REPLACE PROCEDURE merge_two (p_table_name VARCHAR2)
AS
var_col_1 VARCHAR2(100);
BEGIN
SELECT column_name INTO var_col_1 FROM user_tab_cols WHERE table_name = p_table_name AND column_name = 'EMPNO';
FOR x IN (SELECT var_col_1 FROM p_table_name) LOOP
dbms_output.put_line(x.var_col_1);
END LOOP;
END;
/


Warning: Procedure created with compilation errors.

Errors for PROCEDURE MERGE_TWO:

LINE/COL ERROR
-------- -----------------------------------------------------------------
6/10 PL/SQL: SQL Statement ignored
6/32 PL/SQL: ORA-00942: table or view does not exist
7/3 PL/SQL: Statement ignored
7/24 PLS-00364: loop index variable 'X' use is invalid



I also tried this

CREATE OR REPLACE PROCEDURE merge_three (p_table_name VARCHAR2)
AS
var_col_1 VARCHAR2(100);
BEGIN
SELECT column_name INTO var_col_1 FROM user_tab_cols WHERE table_name = p_table_name AND column_name = 'EMPNO';
FOR x IN (SELECT var_col_1 FROM user_tab_cols WHERE table_name = p_table_name) LOOP
dbms_output.put_line(x.var_col_1);
END LOOP;
END;
/

exec merge_three('EMP');

resulting in

EMPNO
EMPNO
EMPNO
EMPNO
EMPNO
EMPNO
EMPNO
EMPNO


any ideas?

tks

steve