Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
UDF in SQL
Message
From
23/11/1998 10:26:27
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00160448
Message ID:
00160469
Views:
14
>>>>>I have this SQL:
>>>>>
>>>>>
>>>>>SELECT cname, tdatetime, ;
>>>>>       IIF(EMPTY(cPickup), cPaddr, cPickup) AS cPickup, ;
>>>>>       IIF(EMPTY(cDropoff), cDaddr, cDropoff) AS cDropoff, ;
>>>>>       IIIF(cStatus, "CXL", "NR", "NS", "Canceled", "Not Ready", "No Show") AS cstatus ;
>>>>>    FROM Trip_History ;
>>>>>    INTO CURSOR vtrips ;
>>>>>    WHERE (INLIST(cStatus, "CXL", "NR", "NS")) AND BETWEEN(TTOD(tdatetime), pdBegin, pdEnd) ;
>>>>>    ORDER BY cStatus, tdatetime
>>>>>
>>>>>
>>>>>"IIIF()" is a function I made that returns one of the last three options. VFP is giving me a "data type mismatch" error on the IIIF line. I've used UDFs in SQL before without a problem, and I think I might have used this IIIF() before. I don't understand why it's giving me an error. IIIF.prg is in the path, so I know it can find it. And the function works on its own.
>>>>>
>>>>>Any ideas?
>>>>>
>>>>>Thanks,
>>>>>
>>>>>-Michelle
>>>>
>>>>Add WAIT WINDOW cParm1 NOWAIT to IIIF code, run and bomb it again, and look what you have in wait window.
>>>
>>>It's "NR" which is what it should be.
>>>
>>>Is that good or bad? :)
>>>
>>>Thanks,
>>>
>>>-Michelle
>>
>>I don't know. If it bombs, so it's not very good. There are two places which can fire type mismatch: either function code itself (I hope you have very simple code inside) or SQL, when let say IIIF returns Integer (or maybe .NULL. ?) for the first record and tries to return Character for the next one.
>
>IIIF() is a simple case statement, and it works if I run it by itself. As far as I know, it's returning a character. The wait window only showed up once, so I'm guessing it's bombing on the first one. I don't know what it doesn't like...
>
>Thanks,
>
>-Michelle

Just a curiosity: could you post the function code? Also, how big the volume of data you process. Basically, UDF in SQL is not the best way to proceed: you significantly delay query speed.
Edward Pikman
Independent Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform