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

Home -> Community -> Usenet -> c.d.o.misc -> Generic function to test for a returned value in a select statement?

Generic function to test for a returned value in a select statement?

From: TurkBear <johng_at_mm.com>
Date: Fri, 05 Nov 1999 18:38:51 GMT
Message-ID: <38232245.14346659@super.news-ituk.to>


Hi,
I am attempting to create a function that will return a value based on the results on a select statement within the function...I would like it to be 'generic', that is I want to be able to pass the table name, the value to check for and the value to check against to the function...like this



Function TESTFLAG
  ( tblname IN varchar,
    testval IN varchar,testkey IN varchar)   RETURN varchar IS

     retval1 varchar2(1);
BEGIN
    select 'Y' into retval1 from dual where exists     (select testkey from tblname where testkey = testval) ;     if retval1 = 'Y' then
    RETURN 'True';
    else
    RETURN 'False' ;
    end if;
END;


When I try to compile this it fails because tblname is not a table name ( since I have not passed it a value ) ...

Am I on the wrong track here ? Can this be done...

Thanks for any help, or pointers ...

John Greco  

  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------    http://www.newsfeeds.com The Largest Usenet Servers in the World! ------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==----- Received on Fri Nov 05 1999 - 12:38:51 CST

Original text of this message

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