Declaring table and view definitions
Before your program issues SQL statements that select, insert, update, or delete data, the program needs to declare the tables and views that those statements access.
About this task
Your program is not required to declare tables or views,
but doing so offers the following advantages:
- Clear documentation in the program
The declaration specifies the structure of the table or view and the data type of each column. You can refer to the declaration for the column names and data types in the table or view.
- Assurance that your program uses the correct column names and
data types
The Db2 precompiler uses your declarations to make sure that you have used correct column names and data types in your SQL statements. The Db2 precompiler issues a warning message when the column names and data types in SQL statements do not correspond to the table and view declarations in your program.
Procedure
To declare table and view definitions, use one of the following methods: