Zero records are fetching when using where statement in TPT

Tools & Utilities
Teradata Employee

Re: Zero records are fetching when using where statement in TPT

I have enough information.

I needed to know if the single-quotes were being stripped.

-- SteveF
Enthusiast

Re: Zero records are fetching when using where statement in TPT

Any way to make sure single-quotes present in the SELECT statement that is sent to Teradata and overcome this issue?

Thanks,

Hanu

Teradata Employee

Re: Zero records are fetching when using where statement in TPT

If you write a script and put the SELECT statement in the script, the single quotes will not be stripped.

-- SteveF
Enthusiast

Re: Zero records are fetching when using where statement in TPT

Currently also I am creating job variable file in perl script and then in the same script calling the tdload. Still issue exists.

It would be very helpful if you could please elaborate/give me sample example how to make it .

Thanks,

Hanu

Teradata Employee

Re: Zero records are fetching when using where statement in TPT

Our documentation will describe examples, and we ship sample scripts with TPT.

Look in the "samples" directory where TPT is installed.

-- SteveF
Enthusiast

Re: Zero records are fetching when using where statement in TPT

Hi Steve,

We tried many ways by putting select statement in the script but still no luck.

It would be very helpful if you could please provide one simple sample example.

Thanks & Regards,

Hanu

Teradata Employee

Re: Zero records are fetching when using where statement in TPT

If you tried to put the SELECT statement in the script, please send me your script and I will make adjustments as necessary.

-- SteveF

Re: Zero records are fetching when using where statement in TPT

SelectStmt='SELECT * FROM TABLE_NAME WHERE EFF_DT='2016-08-12' '

Unable to Enclose date inside single quotes while passing the variable in job_variable file for tdload script.

Please let me other ways to use this.

using version 14.10.

Teradata Employee

Re: Zero records are fetching when using where statement in TPT

You need to escape (double) the single quote characters around the date.

-- SteveF
Enthusiast

Re: Zero records are fetching when using where statement in TPT

Hi Steve,

PFB the details.

Code in the script where select statement is being assigned.

$parms{SelectStmt}="SELECT * FROM ${srcdb}.${srctblnm} WHERE STATUS=''A''";

Calling tdload in the script:

tdload --SourceTdpId '$parms{SourceTdpId}' --SourceLogonMech '$parms{SourceLogonMech}' --SourceUserName '$parms{SourceUserName}' --SourceUserPassword '$parms{SourceUserPassword}' --TargetTable '$parms{TargetTable}' --TargetTdpId '$parms{TargetTdpId}' --TargetLogonMech '$parms{TargetLogonMech}' --TargetUserName '$parms{TargetUserName}' --TargetUserPassword '$parms{TargetUserPassword}' --TargetWorkingDatabase '$parms{TargetWorkingDatabase}' --SelectStmt '$parms{SelectStmt}'

Select statement in the .out file:

SELECT * FROM sourcedb.sourcetablename WHERE STATUS=A

Error in the Tdlaod log:

TPT10508: RDBMS error 5628: Column A not found in sourcedb.sourcetablename

Please let me know if any details are needed.

Thanks & Regards,

Hanu