From oracle-l-bounce@freelists.org Tue Feb 1 00:48:37 2005 Return-Path: Received: from air891.startdedicated.com (root@localhost) by orafaq.com (8.12.10/8.12.10) with ESMTP id j116mb2o029796 for ; Tue, 1 Feb 2005 00:48:37 -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 j116mbem029792 for ; Tue, 1 Feb 2005 00:48:37 -0600 Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 7F9786994C; Tue, 1 Feb 2005 00:47:43 -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 15021-10; Tue, 1 Feb 2005 00:47:43 -0500 (EST) Received: from turing (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 039146994D; Tue, 1 Feb 2005 00:47:42 -0500 (EST) From: Lyndon Tiu To: Mladen Gogala Subject: Re: PL/SQL - Use bind variable in "from " query Date: Mon, 31 Jan 2005 21:45:57 -0800 User-Agent: KMail/1.6.1 Cc: oracle-l References: <200501312105.06794.ltiu@alumni.sfu.ca> <1107235787l.6799l.1l@medo.noip.com> In-Reply-To: <1107235787l.6799l.1l@medo.noip.com> MIME-Version: 1.0 Content-Disposition: inline Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-Id: <200501312145.57192.ltiu@alumni.sfu.ca> X-archive-position: 15537 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: OK, I figured it out, you need to create the statement as a string first using the concat operator ||: begin <... pl sql code ...> select_stmt := 'select ' || v_record_type || ' from ' || v_table_view_name || ' where ' || v_record_pk_field_name || ' = ' || new.record_pk_field_name; execute immediate select_stmt into v_value; <... more pl sql code ..> end Thanks. -- Lyndon Tiu -- http://www.freelists.org/webpage/oracle-l