DB Execute Binding with another teradata query

Comments

10 comments

  • Avatar
    Stony Smith

    Do any of the input rows have NULL for a vale in the Cust_ID field?

    0
    Comment actions Permalink
  • Avatar
    LAWRENCE, KEVIN

    The Cust_ID field does not contain any null values.

    0
    Comment actions Permalink
  • Avatar
    Rocco Pigneri

    Dear Kevin,

    Might there be any empty strings ("")?  I'm wondering if that might be the problem as well.

    I'm presuming that your input data has 1 or more records.

    Hope that helps,

    Rocco

    0
    Comment actions Permalink
  • Avatar
    LAWRENCE, KEVIN

    There are no empty strings.  I even attempted the same bind with only one row of input and got the same error message.

    For smaller results I was able to use a an Agg node and  filter node and create a query using an "in" statement which worked fine, however using "=" with Teradata cli interface has not worked at all no matter what I do.  Many of the binds have over 1M of input

    This is something I'm going to have to use a lot to compete my process. 

    0
    Comment actions Permalink
  • Avatar
    Rocco Pigneri

    Dear Kevin,

    I have done some research on Teradata parameterized queries, and I noticed that there is a syntax difference between the format you provided and the format on Teradata's website.  What if you change the SqlQuery to the following:

    sqlSelect(1,"Select Cust_ID From Table A Where Cust_ID= '?Cust_ID'",'Cust_ID')

    Does that get you a little further along?

    I am presuming that the customer ID is a string.

    Hope that helps,

    Rocco

    0
    Comment actions Permalink
  • Avatar
    LAWRENCE, KEVIN

    I updated the node and received the following error:

    Position out of bounds: 0/0

    Line:2 BrainScript: sqlSelect(1,"Select service_receiver_customer_id From TELCO_UNREG_RETAIL_VIEWS.VCTB804_RECURRING_CHARGE_RATE Where service_receiver_customer_id = '?Service_receiver_customer_id'",'SERVICE_RECEIVER_CUSTOMER_ID')

    Operator: sqlSelect

    0
    Comment actions Permalink
  • Avatar
    Stony Smith

    Capitalization and spelling may affect the resutls.

    sqlSelect(1,"Select service_receiver_customer_id From TELCO_UNREG_RETAIL_VIEWS.VCTB804_RECURRING_CHARGE_RATE Where service_receiver_customer_id =

    '?SERVICE_RECEIVER_CUSTOMER_ID'",'SERVICE_RECEIVER_CUSTOMER_ID')

    0
    Comment actions Permalink
  • Avatar
    LAWRENCE, KEVIN

    I attempted again with the updates and received the same error.  I have searched the forums for related questions and came across a few that did not have a resolution.  Is this even possible with Teradata?

    0
    Comment actions Permalink
  • Avatar
    Stony Smith

    Try the colon again, instead of the question mark.

    This worked for me when I ran it just now:

    query="select system_cd table where and system_cd = :sys "
    sqlSelect(1,query,sys)

    =====

    Some of the troubles you are having may be due to Teradata version. The database I was successful with was version 15.10.02.06

    0
    Comment actions Permalink
  • Avatar
    Stony Smith

    The other problem might be that you have some odd type of data stored in the database.

    You might try wrapping the field with a CAST() statement to force it into a string.

    0
    Comment actions Permalink

Please sign in to leave a comment.



Powered by Zendesk