Subject Re: [firebird-support] Substring Function
Author Hans Hoogstraat
Thank You Helen. A very original solution :)
Did some playing and found out that the 'EXECUTE STATEMENT ..' never
returns a NULL and that a replacement by CH=SUBSTR(INPUT,I,I) executes
350 times faster, which is to be expected.

Best Regards
Hans
----------------------------------------------------------------------------
---

----- Original Message -----
From: "Helen Borrie" <helebor@...>
To: <firebird-support@yahoogroups.com>
Sent: Friday, October 10, 2003 9:59 PM
Subject: Re: [firebird-support] Substring Function


| At 08:54 PM 10/10/2003 -0600, you wrote:
| >Helen,
| >
| >I don't think you can use
| >OUTPUT = OUTPUT || EXECUTE (....
| >since EXECUTE doesn't seem to return any results
| >------------------------------------------------------------
|
| Nope, I couldn't imagine it would.
|
| CREATE PROCEDURE SUBSTRINGTEST (INPUT VARCHAR(12) )
| RETURNS (OUTPUT VARCHAR(12) )
| AS
| DECLARE VARIABLE I INTEGER;
| declare variable ch char;
| declare variable exestring varchar(200);
| BEGIN
| I = 1;
| OUTPUT = '';
| WHILE (I <= 12) DO
| BEGIN
| exestring = 'select substring('''||INPUT||''' from '||i||' FOR 1)
FROM
| RDB$DATABASE';
| execute statement exestring into ch;
| if (ch is not null) then
| begin
| OUTPUT = OUTPUT ||ch;
| SUSPEND;
| end
| else
| exit;
| I = I + 1;
| END
| END ^
|
| heLen
|
|
|
|
| To unsubscribe from this group, send an email to:
| firebird-support-unsubscribe@yahoogroups.com
|
|
|
| Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|
|
|