Subject using a stored procedure to return the value for an existing field in the table
Author

Hi All,


I have a table, Parts, with 30 fields in it.


One is named: ExtraData5 and it's varchar(20).


the Parts table has millions and millions of rows and ExtraData5 is in each.


here's my question... when a normal statement:


select * from parts

where _some conditions_ 


is executed?  the literal table data for the column ExtraData5 is returned (along with all other columns)


What i want to do is override the data being returned from ExtraData5  and  i do not want to do it at the select statement.  i want a stored procedure to be called when data is being returned for ExtraData5.


i know i can write this:


select iif( (char_length(ExtraData5)<10), 'Less than 10', Extradata5) as ExtraData5 from Parts


but i have 1000s of places i'd have to change code.


is there a way i can write a StoredProcedure or trigger to have the "code" in the database return that value i want for the existing column and not just return the table data for that column?


sort of like a OnGetText() for the field BUT at the Firebird table level, not in the field in the query in my development environment.


FB 2.5


plus, i cannot do this:

select *,  iif( (char_length(ExtraData5)<10), 'Less than 10', Extradata5) as ExtraData5 from Parts


thank you in advance, i always learn a ton from this forum!!