TPT error

Database
Enthusiast

TPT error

I am reading data from one server and load into other, I am getting different errors.I am just putting my code down. I am getting at AND clause in select statement.

I need to create volatile table for below select and then run big select suing that and then load data in different table. PLEASE help what should I need to do with TPT.

DEFINE JOB TPT3_LOAD_JOB
DESCRIPTION 'TPT Job for PCA.aflt_loc'
(
DEFINE SCHEMA SUPV_SCHEMA
( Supv_Attuid varchar(20),
Supv_srid decimal(10,0),
Supv_FirstName varchar(40),
Supv_MiddleName varchar(40),
Supv_LastName varchar(40)
);

DEFINE OPERATOR ExportOperator
DESCRIPTION 'Export hierarchy from SBC EDW'
TYPE EXPORT
SCHEMA SUPV_SCHEMA
ATTRIBUTES
(
VARCHAR TdpID = '132.201.98.80',
VARCHAR UserName = 'rc0899',
VARCHAR UserPassword = 'honda123',
INTEGER MaxSessions = 32,
INTEGER MinSessions = 4,
INTEGER TenacityHours = 6,
INTEGER TenacitySleep = 2,
VARCHAR PrivateLogName,
VARCHAR SelectStmt = '

SELECT DISTINCT
ATTRIB.SBC_USER_ID as Supv_Attuid,
ATTRIB.SALES_RES_ID as Supv_srid,
ATTRIB.FIRST_NM as Supv_FirstName,
ATTRIB.MIDDLE_NM as Supv_MiddleName,
ATTRIB.LAST_NM as Supv_LastName
FROM
SDR_ACCESS_VIEWS.VCCR0H8S_SALES_RES_ATTR ATTRIB,
SDR_ACCESS_VIEWS.VCCR0H5S_ORG_NODE_SUPVSR SUPV
WHERE
ATTRIB.SALES_RES_ID = SUPV.SALES_RES_ID
[color=16] AND ATTRIB.EFF_END_DT >= date
AND ATTRIB.DATA_SNAPSHOT_DT = date
AND ATTRIB.ENTITY_DB_STATUS_ON_SNAPSHOT = 'C'
/* use current supervisor records */
AND SUPV.EFF_END_DT >= date
AND SUPV.DATA_SNAPSHOT_DT = date
AND SUPV.ENTITY_DB_STATUS_ON_SNAPSHOT = 'C'
;'[/color]
);
DEFINE OPERATOR LoadOperator
TYPE LOAD
SCHEMA *
ATTRIBUTES
(
VARCHAR TdpID = '135.203.24.22',
VARCHAR UserName = 'rc0899',
VARCHAR UserPassword = 'honda$456',
INTEGER MaxSessions = 8,
INTEGER MinSessions = 8,
VARCHAR TargetTable = 'SLSWIRDB.natt_supvsr_hier',
VARCHAR ErrorTable1 = 'SLSWIRDB.natt_supvsr_hier_e1',
VARCHAR ErrorTable2 = 'SLSWIRDB.natt_supvsr_hier_e2',
VARCHAR LogTable = 'SLSWIRDB.natt_supvsr_hier_log',
VARCHAR WorkTable = 'SLSWIRDB.natt_supvsr_hier_wt'
) ;

APPLY
('insert into SLSWIRDB.natt_supvsr_hier
(rprsnt_attuid
)
VALUES
(:Supv_Attuid
);'
)
TO OPERATOR ( LoadOperator[2] )
SELECT Supv_Attuid
FROM OPERATOR ( ExportOperator[4]);
);
1 REPLY
Teradata Employee

Re: TPT error

You have to "escape" the embedded quotes by doubling them. For example:

SelectStmt VARCHAR '
SELECT ...
...
AND ATTRIB.ENTITY_DB_STATUS_ON_SNAPSHOT = ''C''
...
;'