10.07.2017 15:11, Paul Reeves wrote:
I've also seen, in stored procedures, this sort of construct... where (( e.EMP_NO = :AEMP_NO ) OR ( :AEMP_NO IS NULL)) which, if the input parameter AEMP_NO is NULL will also behave as if a full result set was requested. ie, the stored procedure will return a single record if AEMP_NO has a value and the entire table if it is null. The advantage of using that sort of construct is that only one SQL statement is required, rather than a more complex 'if then else' but is it safe from future implementation changes ?
Well-known trick and FB3 supports it at the runtime/optimizer level (using either index scan or full scan depending on parameter value).
Dmitry ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
