"update tblTrains tr " +
"set tr.LOADEDTITAN = (select max(c.mtp_titan_nbr) as Loaded_MTP " +
"from tblTrains t,train.cor_train_leg_dn@cor c " +
"where t.archiveddt is null and " +
"trim(t.TRAINNAME) = trim(c.train_leg_nm) " +
"and tr.TRAINID = t.TRAINID " +
"and c.train_kind_cd {1} " +
"and (mtp_train_state_cd <> 'X'" +
" or mtp_train_state_cd is null)), " +
"tr.MTTITAN = (select max(c.mtp_titan_nbr) as MT_MTP " +
"from tblTrains t,train.cor_train_leg_dn@cor c " +
"where t.archiveddt is null and " +
"T.MTTRAINNAME is not null and " +
"trim(T.MTTRAINNAME) = trim(c.train_leg_nm) " +
"and tr.TRAINID = t.TRAINID " +
"and c.train_kind_cd {1} " +
"and (mtp_train_state_cd <> 'X'" +
" or mtp_train_state_cd is null)), " +
"tr.ALIASTITAN = (select max(c.mtp_titan_nbr) as ALIAS_MTP " +
"from tblTrains t,train.cor_train_leg_dn@cor c " +
"where archiveddt is null " +
"and trim(T.ALIASTRAINNAME) = trim(c.train_leg_nm) " +
"and t.ALIASTRAINNAME is not null " +
"and tr.TRAINID = t.TRAINID " +
"and c.train_kind_cd {1} " +
"and (mtp_train_state_cd <> 'X'" +
" or mtp_train_state_cd is null)), " +
"tr.ALIASLOADEDTITAN = (select max(c.mtp_titan_nbr) as ALIAS_Loaded_Titan " +
"from tblTrains t,train.cor_train_leg_dn@cor c " +
"where archiveddt is null " +
"and trim(T.ALIASLOADEDTRAINNAME) = trim(c.train_leg_nm) " +
"and t.ALIASLOADEDTRAINNAME is not null " +
"and tr.TRAINID = t.TRAINID " +
"and c.train_kind_cd {1} " +
"and (mtp_train_state_cd <> 'X'" +
" or mtp_train_state_cd is null)), " +
"tr.ALIASEMPTYTITAN = (select max(c.mtp_titan_nbr) as ALIAS_EMPTY_Titan " +
"from tblTrains t,train.cor_train_leg_dn@cor c " +
"where archiveddt is null " +
"and trim(T.ALIASEMPTYTRAINNAME) = trim(c.train_leg_nm) " +
"and t.ALIASEMPTYTRAINNAME is not null " +
"and tr.TRAINID = t.TRAINID " +
"and c.train_kind_cd {1} " +
"and (mtp_train_state_cd <> 'X'" +
" or mtp_train_state_cd is null)) " +
"where tr.archiveddt is null " +
"and tr.Lineupid = {0}",mLineup.LineupID,sqlTrainKindCD);
Regards,
Nitin Aggarwal
+91-9886604958
[email protected]
Enter your message below
Sign in or Join us (it's free).