I have the following UDF

CREATE FUNCTION GetQuant(
   p_cab char(10)) returns smallint AS
VAR
   v_quant smallint;
   v_dateres timestamp;
BEGIN
       SELECT field into :v_quant from table where resid=:p_cab;
       return 1;
END;


The two following statement returns the same resultset

SELECT *
FROM invest
WHERE cartnum=6280  and i.dateres='2006-05-25'

and

SELECT *
FROM invest
WHERE cartnum=6280


the follwoing statement returns correct resultset

SELECT getQuant('155')
FROM invest
WHERE cartnum=6280


but the followoing returns always empty resultset

SELECT getQuant('155')
FROM invest
WHERE cartnum=6280  and dateres='2006-05-25'



If from UDF remove SELECT statement then it will work correctly.


Fields cartnum and dateres in the table invest both have indexes.
CREATE INDEX INVEST_DATERES ON GIS.INVEST(DATERES ASC)
CREATE INDEX INVEST_CARTNUM ON GIS.INVEST(CARTNUM ASC)


7.6.00.16 is not affected.


How can I avoid this problem?

--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to