From oracle-l-bounce@freelists.org Tue Feb 1 00:07:43 2005 Return-Path: Received: from air891.startdedicated.com (root@localhost) by orafaq.com (8.12.10/8.12.10) with ESMTP id j1167hIn025421 for ; Tue, 1 Feb 2005 00:07:43 -0600 X-ClientAddr: 206.53.239.180 Received: from turing.freelists.org (freelists-180.iquest.net [206.53.239.180]) by air891.startdedicated.com (8.12.10/8.12.10) with ESMTP id j1167hem025416 for ; Tue, 1 Feb 2005 00:07:43 -0600 Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 3EE3169740; Tue, 1 Feb 2005 00:06:49 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 04509-09; Tue, 1 Feb 2005 00:06:49 -0500 (EST) Received: from turing (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 8F46B68ABC; Tue, 1 Feb 2005 00:06:48 -0500 (EST) From: Lyndon Tiu To: oracle-l Subject: PL/SQL - Use bind variable in "from " query Date: Mon, 31 Jan 2005 21:05:06 -0800 User-Agent: KMail/1.6.1 MIME-Version: 1.0 Content-Disposition: inline Content-type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit Message-Id: <200501312105.06794.ltiu@alumni.sfu.ca> X-archive-position: 15534 X-ecartis-version: Ecartis v1.0.0 Sender: oracle-l-bounce@freelists.org Errors-To: oracle-l-bounce@freelists.org X-original-sender: ltiu@alumni.sfu.ca Precedence: normal Reply-To: ltiu@alumni.sfu.ca X-list: oracle-l X-Virus-Scanned: by amavisd-new-20030616-p9 (Debian) at avenirtech.net X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on air891.startdedicated.com X-Spam-Status: No, hits=0.2 required=5.0 tests=AWL,HTML_MESSAGE, HTML_TAG_BALANCE_TABLE autolearn=no version=2.60 X-Spam-Level: Hello, I have a lookup table with a column. This column holds a variable - the name of another table. In PL/SQL code, I need to query (at run time) the lookup table, retrieve the value stored in the lookup table's column and use it as the table in another query. I have tried using bind variables but it seems that I cannot set the
in: select * from
to a bind variable. The code: ------------ declare: v_table_name varchar2 v_value varchar2 begin select table_name into v_table_name from lookup_table; select value into v_value from :v_table_name; end; ------------ does not even compile. I get an error that :v_table_name is a bad bind variable. Thanks for any help. -- Lyndon Tiu -- http://www.freelists.org/webpage/oracle-l