Subject | for select stored procedure question |
---|---|
Author | Raith,Daniel |
Post date | 2013-10-10T15:33:16Z |
I want to write a stored procedure that updates two columns (all records) in a table to initial caps or camel case.
For example: “testing a test” -> “Testing A Test”
I wrote a test procedure that accepts an input varchar, changes the string to initial caps and returns the output string. This works great. But now I want to create another stored procedure that contains a FOR SELECT on the table I want to update. However reading this page: http://ibexpert.net/ibe/index.php?n=Doc.FORSELECTINTODO mentions this caution statement:
Caution! If the value of a PSQL variable that is used in the SELECT
statement
changes during execution of the loop, the statement may (but will not always) be re-evaluated for the remaining rows.
To me, this means I should not create this procedure:
create procedure InitialCapsMyTable
as
begin
for select a, b from MyTable
into :aa, :bb
do
begin
:aa = initial_caps_proc( :aa );
:bb = initial_caps_proc( :bb );
end
end
Questions
1) Am I correct that the caution mentioned above applies my example?
2) Is there a better way to accomplish changing a column (all records) to initial caps?
I’m using FB1.5,
Daniel