Subject Re: [firebird-support] Substring Function
Author Helen Borrie
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