Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: giving field name as variable of a function
Unfortunately the DBMS_SQL package is not considered 'pure' as of PL/SQL 2.3 (Oracle8 PL/SQL Programming pp300-303). This means AFAIK that any function which uses DBMS_SQL cannot be pure either, even if you declare it in a package and attempt to PRAGMA RESTRICT_REFERENCES(...). Such a function will not be able to be called within an SQL statement, ie you wouldn't be able to say: select a, myfunction(), b from...
David.
Tony Colston wrote:
> I think that you can do this kind of thing with the DBMS_SQL package. It
> lets you create SQL on the fly and execute it.
>
> Tony
>
> Diablo <diabl_at_email.com> wrote in message
> news:7j2r5j$hqt$1_at_usenet48.supernews.com...
> > I need to write a function that takes a field name as variable like this:
> >
> > Function F_PUR_F05
> > ( FieldName IN VARCHAR2)
> >
> > cursor C_PER is
> > SELECT * FROM sometable
> > WHERE FieldName ='XXXX';
> > .......
> >
> > But I could not do it as it does not recognize varchar2 as a fieldname..
> > Any ideas?
> >
> > Any help would be appreciated.
> >
> >
> >
> >
Received on Thu Jun 03 1999 - 01:50:20 CDT