Length validation checking starts with the conditional IF- THEN statement. This updated approach resembles the original function however at line 6, differences begin. Using the IF-THEN statement to validate the length of the cut_amt parameter. With a different approach to the same function, one option of accomplishing these validation checks is presented in the below example: Validating that the pipe_id is present in the table and the cuts value is a valid length of greater than zero, would be solid considerations. To strive in developing the best solutions, some form of validation checking should be incorporated into this function to construct certain rules for specific instances of events. Previously constructed, this function is designed to help automate a potentially redundant task of updating the cuts and new_lt columns, found in the cut_log table, for assets of pipe: Getting acquainted with the cut_log table as shown below: I will be using Xubuntu Linux 16.04.2 LTS (Xenial Xerus), PostgreSQL 9.6.2 and pgAdmin for these exercises. It by no means depicts actual data belonging to or being used by any party or organization. Note: All data, names or naming found within the database presented in this post, are strictly used for practice, instruction and testing purposes. In today’s example, I will add to a previous post by enhancing an existing PL/pgSQL function utilizing conditionals and defined validation checking.
0 Comments
Leave a Reply. |