Subject RE: [firebird-support] for select stored procedure question
Author Raith,Daniel

That works, but only if my stored proc contains the suspend.

 

SET TERM ^ ;

 

CREATE OR ALTER PROCEDURE INITIAL_CAPS_PROC (

    input_string varchar(100))

returns (

    output_string varchar(100))

as

declare variable input_length integer;

declare variable idx integer;

begin

  output_string = '';

  input_length = char_length(input_string);

 

  if (input_length > 0) then

  begin

 

    idx = 1;

    while (idx <= input_length) do

    begin

      if (idx = 1) then

        output_string = upper( substring( input_string from 1 for 1 ) );

      else

      begin

        if ( substring( input_string from idx-1 for 1 ) = ' ' ) then

          output_string = output_string || upper( substring( input_string from idx for 1 ) );

        else

          output_string = output_string || lower( substring( input_string from idx for 1 ) );

      end

 

      idx = idx + 1;

    end

  end

 

  suspend;

end^

 

SET TERM ; ^

 

From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of Woody
Sent: Thursday, October 10, 2013 1:27 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] for select stored procedure question

 

 

As long as the initial_caps_proc doesn't have a suspend statement, it will
basically be seen as a function call. To use it to update records one time:

Update MyTable set Column_A = (select OutVar from
initial_caps_proc(Column_A)), Column_B = (select OutVar from
initial_caps_proc(Column_B));

I haven't tested this but it should work if memory serves me correctly. :)

Woody (TMW)