A custom view can be created within WhereScape RED to handle views that are not strictly one-to-one such as where multiple tables are joined or where a complex condition is placed on the view. There are two options for custom views, the first where the columns are defined in WhereScape RED, and the 'Select' component of the view is customized. The second option is where the view is customized and no columns need to be defined in WhereScape RED, although it is good practice to still define the columns for documentation purposes.
Creating a Custom or 'User Defined' view:
- Create a View either by dragging a table in or adding a new object.
- Change the table type to User Defined View from the View Type drop-down list.
- The following message is displayed. Click OK.
- Edit the new tab View Create Statement and insert the SQL Statement that will be used to create the view.
- This SQL Statement must start with either Create or Select.
- If Create is used then the columns in the view are ignored and the statement will be issued to create the view.
- If the statement starts with Select then WhereScape RED will build up a view create statement from the column names and the supplied Select clause.
- There is also a Load DDL button at the bottom right corner to get a sample Select statement, based on the columns in the view and any transformations.