Tuesday, July 10, 2012

ODI Substitution Methods sample examples getTargetColList to create a table


Using getTargetColList to create a table

The following example shows how to use a column list to create a table.
The following KM code:
Create table MYTABLE
<%=odiRef.getTargetColList("(\n", "\t[COL_NAME] [DEST_WRI_DT]", ",\n", "\n)")%>
Generates the following statement:
Create table MYTABLE
(
        CUST_ID numeric(10),
   CUST_NAME varchar(250),
   ADDRESS varchar(250),
   CITY varchar(50),
   ZIP_CODE varchar(12),
   COUNTRY_ID varchar(3)
)
In this example:
  • Start is set to "(\n": The generated code will start with a parenthesis followed by a carriage return (\n).
  • Pattern is set to "\t[COL_NAME] [DEST_WRI_DT]": The generated code will loop over every target column and generate a tab character (\t) followed by the column name ([COL_NAME]), a white space and the destination writable data type ([DEST_WRI_DT]).
  • The Separator is set to ",\n": Each generated pattern will be separated from the next one with a comma (,) and a carriage return (\n)
  • End is set to "\n)": The generated code will end with a carriage return (\n) followed by a parenthesis.

No comments:

Post a Comment