Table of Contents

Search

  1. Preface
  2. Transformations
  3. Source transformation
  4. Target transformation
  5. Access Policy transformation
  6. B2B transformation
  7. Aggregator transformation
  8. Cleanse transformation
  9. Data Masking transformation
  10. Data Services transformation
  11. Deduplicate transformation
  12. Expression transformation
  13. Filter transformation
  14. Hierarchy Builder transformation
  15. Hierarchy Parser transformation
  16. Hierarchy Processor transformation
  17. Input transformation
  18. Java transformation
  19. Java transformation API reference
  20. Joiner transformation
  21. Labeler transformation
  22. Lookup transformation
  23. Machine Learning transformation
  24. Mapplet transformation
  25. Normalizer transformation
  26. Output transformation
  27. Parse transformation
  28. Python transformation
  29. Rank transformation
  30. Router transformation
  31. Rule Specification transformation
  32. Sequence Generator transformation
  33. Sorter transformation
  34. SQL transformation
  35. Structure Parser transformation
  36. Transaction Control transformation
  37. Union transformation
  38. Velocity transformation
  39. Verifier transformation
  40. Web Services transformation

Transformations

Transformations

SQL transformation output fields

SQL transformation output fields

You can view output fields for the SQL transformation on the
Output Fields
tab of the
Properties
panel. The Mapping Designer displays the name, type, precision, scale, and origin for each output field.
Information on the
Output Fields
tab varies based on the SQL type.

Output fields for stored procedures and functions

When the SQL transformation processes a stored procedure or function, the output fields include output parameters from the database. You cannot edit the transformation output fields. If you want to exclude output fields from the data flow or rename output fields before you pass them to a downstream transformation, configure the field rules for the downstream transformation.

Output fields for queries

When the SQL transformation processes a query, the output fields include the following fields:
Retrieved column fields
When the SQL query contains a SELECT statement, the transformation returns one row for each database row that it retrieves.
For user-entered queries, you must configure an output field for each column in the SELECT statement. The output fields must be in the same order as the columns in the SELECT statement.
For saved queries,
Data Integration
creates the output fields.
SQLError field
Data Integration
returns row errors to the SQLError field when it encounters a connection or syntax error. It returns NULL to the SQLError field when no SQL errors occur.
For example, the following SQL query generates a row error from an Oracle database when the Employees table does not contain Product_ID:
SELECT Product_ID FROM Employees
Data Integration
generates one row. The SQLError field contains the following error text in one line:
ORA-0094: “Product_ID”: invalid identifier Database driver error... Function Name: Execute SQL Stmt: SELECT Product_ID from Employees Oracle Fatal Error
When a query contains multiple statements, and you configure the SQL transformation to continue on SQL error, the SQL transformation might return rows from the database for one query statement, but return database errors for another query statement. The SQL transformation returns any database error in a separate row.
NumRowsAffected field
You can enable the NumRowsAffected output field to return the number of rows affected by the INSERT, UPDATE, or DELETE query statements in each input row.
Data Integration
returns the NumRowsAffected for each statement in the query. NumRowsAffected is disabled by default.
When you enable NumRowsAffected and the SQL query does not contain an INSERT, UPDATE, or DELETE statement, NumRowsAffected is zero in each output row.
The following table lists the output rows that the SQL transformation generates when you enable NumRowsAffected:
Query Statement
Output Rows
UPDATE, INSERT, DELETE only
One row for each statement with the NumRowsAffected for the statement.
One or more SELECT statements
Total number of database rows retrieved.
NumRowsAffected is zero in each row.
DDL queries such as CREATE, DROP, TRUNCATE
One row with zero NumRowsAffected.
When a query contains multiple statements,
Data Integration
returns the NumRowsAffected for each statement. NumRowsAffected contains the sum of the rows affected by each INSERT, UPDATE, and DELETE statement in an input row.
For example, a query contains the following statements:
DELETE from Employees WHERE Employee_ID = ‘101’; SELECT Employee_ID, LastName from Employees WHERE Employee_ID = ‘103’; INSERT into Employees (Employee_ID, LastName, Address)VALUES (‘102’, 'Gein', '38 Beach Rd')
The DELETE statement affects one row. The SELECT statement does not affect any row. The INSERT statement affects one row.
Data Integration
returns one row from the DELETE statement. NumRowsAffected is equal to one. It returns one row from the SELECT statement, NumRowsAffected is zero. It returns one row from the INSERT statement with NumRowsAffected equal to one.
Pass-through fields
Define incoming fields as pass-through fields to pass data through the SQL transformation. The SQL transformation returns data from pass-through fields whether or not the SQL query returns rows.
When the source row contains a SELECT statement, the SQL transformation returns the data in the pass-through field in each row it returns from the database. If the query result contains multiple rows, the SQL transformation repeats the pass through field data in each row.
When a query returns no rows, the SQL transformation returns the pass-through column data and null values in the output fields. For example, queries that contain INSERT, UPDATE, and DELETE statements return no rows. If the query has errors, the SQL transformation returns the pass-through column data, the SQLError message, and null values in the output fields.
To define a pass-through field, click
Add
in the Pass-Through Fields area, and then select the field you want to pass through the SQL transformation. When you configure an incoming field as a pass-through field,
Data Integration
adds the field with the suffix "_output" in the Pass-Through Fields area.
If you configure a field as a pass-through field and then change the field name in the source,
Data Integration
does not update the pass-through field name and no data is passed through the field. In the SQL transformation, delete the old pass-through field and configure the updated incoming field as a pass-through field.

0 COMMENTS

We’d like to hear from you!