Quantcast
Channel: SCN : Popular Discussions - SAP MaxDB
Viewing all articles
Browse latest Browse all 1545

Strange errors when using user defined function in where clause

$
0
0

Hello,

 

I am having trouble with a function that, when used in the where clause of a select will cause an error if the first column selected is of type INTEGER. Not sure whether I am doing something wrong or whether this is a bug.

Here is a very simple test case:

 

create table test(

col1 integer not null,

col2 varchar(20) ascii default ''

)

 

insert into test values(1,'2011-03-15 05:00:00')

insert into test values(2,'2011-03-15 07:00:00')

 

CREATE FUNCTION BTR_TAG  RETURNS VARCHAR AS

    VAR ret VARCHAR(20);

  SET ret='2011-03-15 06:00:00';

  RETURN ret;

 

Select * from test where col2 >= BTR_TAG()

Select col1,col2 from test where col2 >= BTR_TAG()

=>  Error in assignment;-3016 POS(1) Invalid numeric constant

 

Select '',* from test where col2 >= BTR_TAG()

Select col2,col1 from test where col2 >= BTR_TAG()

=> works as it should

 

MaxDB V 7.7.07.16 running on Windows Server 2003

I can replicated the test case above with Sql Studio and other ODBC based tools.

 

Thanks in advance,

Silke Arnswald


Viewing all articles
Browse latest Browse all 1545

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>