|
Archives of the TeradataForumMessage Posted: Tue, 28 Feb 2006 @ 18:41:58 GMT
The first thing that I notice is that your join columns can have different domains (VARCHAR(30) and CHAR(10)). So, you are using SPOOL and JOIN logic to get rid of any value longer than 10. Plus, you are using TRIM on a VARCHAR column and wasting CPU to accomplish absolutely nothing. So, my first two suggestions would be: 1. add: WHERE CHAR(B.DATA_SOURCE_CD) > 10 /* since DATA_SOURCE_CD in the account_event table is CHAR(10) */ 2. change ON: > ON COALESCE(TGT.DATA_SOURCE_CD),'') = COALESCE(B.DATA_SOURCE_CD,'' ) /* no sense trimming both */ Furthermore, is it possible to actually have a ' ' in the data? If so, you might want to use a word like 'null' in your coalesce to distinguish between a real space and a null. Just a thought. Michael Larkins
| ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||