Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: DYNAMIC SQL PROBLEM - help
It compiles all right because it doesn't realise before runtime what you
are trying to do ...
In fact, you cannot 'bind' a table name or column name. You can only do
it with data (something you can store in a column). If you want to
dynamically change the table name, you must do something like
sql_stmt := 'select * from ' || table_name_in ;
and then parse the 'hard-coded' statement - yes, a new cursor every
time.
You do not actually need any dynamic SQL for what you are trying to do.
You can simply look in the DBMS_UTILITY (or is it DBMS_DDL? you'll find
it in $ORACLE_HOME/rdbms/admin/dbmsutil.sql anyway) for the suitable
function to ANALYZE your table, and then do a SELECT on USER_TABLES (or
DBA_TABLES, it depends) to get the average row length there ...
--
Regards,
Stéphane Faroult
Oriole Corporation
![]() |
![]() |