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

Home -> Community -> Usenet -> c.d.o.tools -> need to use variable in FROM clause

need to use variable in FROM clause

From: <tandym_at_hotmail.com>
Date: Tue, 29 Aug 2000 17:21:08 GMT
Message-ID: <8ogrda$n55$1@nnrp1.deja.com>

I want to be able to pass a table name to a procedure and have it execute a generic select statement. I have had problems doing this (PLS-00201) and have a vague notion that I will need to user DBMS_SQL to do it. PLease help - all examples I have been able to find don't show how to use a variable in a FROM clause. My code is below. I am using Oracle 8.1.5 and PL/SQL 8.1.5 on an NT box.



--PROC_EVENT_DET_OTHERS
--Is Called from PROC_EVENT_DETAIL_PARENT for details of tables that do
--not require joins to other tables
--Accepts request number and table name
--Passes Back CURSOR


procedure proc_event_det_others(v_table IN varchar2,
	v_requestnr IN NUMBER,
	c_event_detail IN OUT audit_cur_typ) IS


BEGIN         OPEN c_event_detail FOR

	SELECT *
	FROM V_TABLE
	WHERE requestnr = V_REQUESTNR;

END;


Thanks,

sonya
please respond email as well, if possible

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Tue Aug 29 2000 - 12:21:08 CDT

Original text of this message

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