Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 100

How to return the result of a select query in a function - forum topic by juanalfonso

$
0
0

Hello to everybody,

I'm trying to return the result of a select query in a function. Something like:

REPLACE FUNCTION F_SIGUIPUNTERO_F (nPunt number, nLimite number) RETURNS int

LANGUAGE SQL
CONTAINS SQL
DETERMINISTIC
SQL SECURITY DEFINER
COLLATION INVOKER
INLINE TYPE 1

RETURN
  NVL(CALL DBC.SYSEXECSQL('select top 1 ID from TMP_CADENA where VALOR is not null and ID > ' || nPunt || ' order by ID;'), nLimite+1);
END
;

But it's not working. Also, I think that the DBC.SYSEXECSQL is not being detected properly...

Could anyone help me?

Thanks and regards

Forums: 

Viewing all articles
Browse latest Browse all 100

Trending Articles



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