You can't declare a variable whose data type is not known until runtime.
If you are trying to use dynamic SQL where the structure of the result set is also dynamic (if the number of columns and their data types are fixed for any table that is passed in, you could statically declare a record variable of an appropriate type), then you would realistically need to use the DBMS_SQL
package to execute the statement, to gather data about the columns that are returned, and to bind appropriate variables into which you could fetch the data.
You can see an example of using the DBMS_SQL
package in Tom Kyte's dump_csv
function that dumps the results of an arbitrary SQL statement to a file.