Focal Point
Custom SQL in iway DataMigrator

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/1381057331/m/8417042716

February 28, 2012, 02:18 PM
Ramanathan
Custom SQL in iway DataMigrator
Hi All,

Before loading the target I need to delete records based on date. So I have use Stored Procedure to run the delete, but I am receiving the following error message.

02/28/2012 11:10:47 SERVER1 (ICM18122) Request - processflows/pf_fdp_stg (Owner: user1) submitted.
02/28/2012 11:10:47 SERVER1 (ICM18015) DEP_0: procedure sp_deletefdp started.
02/28/2012 11:10:47 SERVER1 (FOC1400) SQLCODE IS -5016 (HEX: FFFFEC68)
02/28/2012 11:10:47 SERVER1 (FOC1414) EXECUTE IMMEDIATE ERROR.
02/28/2012 11:10:47 SERVER1 (ICM18039) DEP_0 sp_deletefdp Return Code = 0

I am using DB2, AS400 and the stored procedure as follows

SQL
DELETE FROM DB1.FDP_STG
WHERE DATEFD >= ((40927) - DAYS(CAST('1899-12-31' AS DATE)));

END

-RUN



SQL DB2

COMMIT WORK;

END

-RUN


WebFOCUS 7.7, iWay Data Migrator, Windows
Excel, PDF, HTML
February 29, 2012, 09:52 AM
dhagen
Why don't you just use a normal data flow to perform the delete?


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
February 29, 2012, 10:11 AM
Clif
The SQLCODE IS -5016 comes from IBM DB2 and means:

The qualified object name is inconsistent with the naming option.

I note that you are using SQL (automatic pass through) for the DELETE so DB1.FDP_STG refers to the app dir DB1 and synonym FDB_STG. Possibly you wanted to use SQL DB2 (direct pass through)?

Also the expression in the parenthesis returns a number, so DATEFD must be a number not a DATE.


N/A
February 29, 2012, 12:26 PM
Ramanathan
Thanks for your reply guys.

Clif: The DB1 refers to the database name and FDB_STG is the table name.

When I run the delete query in the database its working fine and when I run the following stored procedure directly it works, but when I pull the stored procedure to process flow it is not working.

SQL
DELETE FROM DB1.FDP_STG
WHERE DATEFD >= ((40927) - DAYS(CAST('1899-12-31' AS DATE)));

Please let me know what keywords am I missing in the stored procedure.

Dhagen: Am not sure, but I know that normal data flow will delete or truncate all the records based on the key column, but in this scenario I have to delete based on date.


WebFOCUS 7.7, iWay Data Migrator, Windows
Excel, PDF, HTML
March 01, 2012, 10:00 AM
Clif
Please change SQ DELETE to SQL DB2 DELETE so that you are using Direct Pass Through.


N/A
March 02, 2012, 02:55 PM
Ramanathan
quote:
Originally posted by Clif:
Please change SQ DELETE to SQL DB2 DELETE so that you are using Direct Pass Through.


I tried using SQL DB2 DELETE, but still it throws the same error message.


WebFOCUS 7.7, iWay Data Migrator, Windows
Excel, PDF, HTML