Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: DYNAMIC SQL PROBLEM - help

Re: DYNAMIC SQL PROBLEM - help

From: Stephane Faroult <sfaroult_at_oriolecorp.com>
Date: Mon, 12 Apr 1999 19:46:29 -0700
Message-ID: <3712B005.27B9@oriolecorp.com>


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



http://www.oriolecorp.com, designed by Oracle DBAs for Oracle DBAs
Received on Mon Apr 12 1999 - 21:46:29 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US