Re: Tablename as a Parameter in stored procedures

From: Jochen Pege <pege_at_kespretlang.de>
Date: Fri, 8 Dec 2000 13:58:06 +0100
Message-ID: <90qlvu$r17$1_at_news10.roka.net>


Dear Ray,

thanks for your suggestions. Because of my Problem ( it is a select statement) I wasn't able to receive the Results. I tried .variable_value but during studying this I found the Execute Immediate Function, with which Im able to solve my problem.

Best regards

Jochen

P.S. You have problems with yopur hotmail account!

Ray Lynch <raylynch_at_hotmail.com> schrieb in im Newsbeitrag: 90q6dj$9h4$1_at_oslo-nntp.eunet.no...
> Use the DBMS_SQL package to execute dynamically built sql, or DML
> statements.
>
> As an example, see the following procedure:
>
> procedure exec_direct
> (STRING IN varchar2)
> is
>
> cursor_name INTEGER;
> ret INTEGER;
> BEGIN
> cursor_name := DBMS_SQL.OPEN_CURSOR;
> DBMS_SQL.PARSE(cursor_name, string, DBMS_SQL.native);
> ret := DBMS_SQL.EXECUTE(cursor_name);
> DBMS_SQL.CLOSE_CURSOR(cursor_name);
> END;
>
>
> "Jochen Pege" <pege_at_kespretlang.de> wrote in message
> news:90ntcg$3qm$1_at_news10.roka.net...
> > Hi everybody,
> >
> > I have a problem with my stored procedure (sp). To make it generally
 valid
 I
> > want to give the sp the Tablename as a parameter.
> > May I call the parameter v_tab and it is a varchar2.
> >
> > In the sp I have a query, something like
> >
> > Select bla, bla from v_tab
> >
> > This occurs an Errormessage: PLS-00201 identifier 'string' must be
 declared
> >
> > Where is my mistake?
> >
> > Jochen
> >
> >
>
>
Received on Fri Dec 08 2000 - 13:58:06 CET

Original text of this message