I have the following SQL:
SELECT A.ctime, A.ctime_type, A.tripkey, A.clientkey, ;
ALLT(B.clname)+", "+ALLT(B.cfname) AS cname, ;
NVL(C.cloc," ") AS cpickup, NVL(D.cloc," ") AS cdropoff, ;
" " AS cstatus ;
FROM trips A ;
LEFT OUTER JOIN clients B ON A.clientkey = B.clientkey ;
LEFT OUTER JOIN locations C ON A.ipick_up = C.lockey ;
LEFT OUTER JOIN locations D ON A.idrop_off = D.lockey ;
INTO ARRAY laTrips ;
WHERE NOT DELETED() ;
ORDER BY A.ctime
When I do this:
INSERT INTO Curtrips FROM ARRAY laTrips
It tells me CDROPOFF doesn't accept null values. I looked at the array, and sure enough, there's nulls in it. Why doesn't the "NVL(D.cloc," ")" keep them out?
As long as I have the SQL posted, I'm also wondering if I'm doing this right. I want all of the trips, and the client name, pickup, and drop off that goes with each trip. That's what I'm getting, so I know it's not completely wrong. :) But is there a different way I should be wording it that's better?
Thanks,
-Michelle