UDA
Enthusiast

## How do write Insert ststement with where condition in Mload

Hello,

I am loading values from the file using Mload, but before insert i have to validate the data and insert. Any one know how can i write insert statement with where condition if the values are coming from file. Any help would be appreciated.

Thank you
4 REPLIES
Enthusiast

## Re: How do write Insert ststement with where condition in Mload

Hi,
You have to specify the where clause along with the apply statement in the mload script.
like this,
apply ins_rec where col1=1234;
here ins_rec is the labe for the DML and col1 is the column from the table.

Regards,
Aravind Hegde
Enthusiast

## Re: How do write Insert ststement with where condition in Mload

Thank you Aravind. Can you please give me a example.

Insert into temp (emplid) values ('1234') apply ins_rec where col1=1234 and exists(..);

Is this statement make sence. Also in the where condition can i write subselect. thank you for yuor help.
Enthusiast

## Re: How do write Insert ststement with where condition in Mload

You can only reference fields that are coming in from your file in the "APPLY" clause, so you can't do an "EXISTS" or reference tables within Teradata. Also, the "APPLY" clause is part of the "IMPORT" statement, not the "INSERT" statement.