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 -> Re: IN Clause Question - Function

Re: IN Clause Question - Function

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Tue, 14 Mar 2000 19:36:01 +0800
Message-ID: <38CE2421.7E2E@yahoo.com>


Moore wrote:
>
> Greetings.
>
> I have written a function that returns a CHAR similar to:
>
> ('02-00','01-00','12-99')
>
> The function name is get_Past3Months.
>
> The query that uses the function is as follows:
>
> SELECT customer_code,
> premis_code,
> action_date
> FROM (
> SELECT get_Past3Months in_DateString
> FROM DUAL
> ) months,
> history
> WHERE TO_CHAR(action_date, 'MM-YY') IN months.in_DateString
>
> Will my scheme work?
>
> TIA
Unfortunately not as it stands - the components of the IN clause must be static or bind variables..

However, take a look at DBMS_SQL (for 8.0 and below) and EXECUTE_IMMEDIATE for 8i upwards...This lets you build a character string and run it as an SQL.

HTH
--



Connor McDonald
http://www.oracledba.co.uk

We are born naked, wet and hungry...then things get worse Received on Tue Mar 14 2000 - 05:36:01 CST

Original text of this message

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