Subject | Re: [firebird-support] only for numerics... |
---|---|
Author | Adomas Urbanavicius |
Post date | 2006-03-14T14:47:07Z |
>>>Thanks Adomas,Not generating SP for each field, but rewriting you sql select query with SP :
>>>I had thought about that too, though it would mean generating a SP for each
>>>field... and I think it's hardly feasible in my situation.
if it was
where
my_year > 1975
my_week > 45
my_age > 25
my_weight > 125
it would be
where
(SELECT MY_NUMERIC FROM MY_SP( my_year )) > 1975
AND
(SELECT MY_NUMERIC FROM MY_SP( my_week )) > 45
AND
(SELECT MY_NUMERIC FROM MY_SP( my_age )) > 25
AND
(SELECT MY_NUMERIC FROM MY_SP( my_weight )) > 125
>>>Still, a smart solution! ;)Rony Cesana wrote:
>>>Thanks a lot,
>>>> Rony
>----- Original Message -------
>From: "Adomas Urbanavicius" <adomas@...>
>To: <firebird-support@yahoogroups.com>
>Sent: Tuesday, March 14, 2006 1:45 PM
>Subject: Re: [firebird-support] only for numerics...
>
>
>
>
>>However, while not being interested into db design issues or similar,
>>I think we could do so with stored procedure :
>>something like (syntax not checked) :
>>create procedure MY_SP (INPUT_STRING varchar(100))
>>returns MY_NUMERIC NUMERIC(18,2)
>>begin
>> MY_NUMERIC = INPUT_STRING;
>> when convert_error do
>> MY_NUMERIC = NULL;
>> suspend;
>>end
>>
>>And then query would look :
>> select * from xxx
>> where
>>
>>(
>>(SELECT MY_NUMERIC FROM MY_SP( xxx.THIS_DATE_FIELD )) > 1975
>>)
>>
>>
>>It wont be so fast though :), but no need to write udf :).
>>
>>Adomas
>>
>>
>
>
>
>
>
>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
>Visit http://firebird.sourceforge.net and click the Resources item
>on the main (top) menu. Try Knowledgebase and FAQ links !
>
>Also search the knowledgebases at http://www.ibphoenix.com
>
>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
>Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>
Pagarbiai / Best Regards,
Adomas Urbanavicius
+37068543336