Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8800

How does one handle NULL values on function parameters

$
0
0

Basic example:

 

CREATE FUNCTION "PMX_FN_TEST" (

    p_in INTEGER

)

RETURNS TABLE ( p_out INTEGER )

LANGUAGE SQLSCRIPT AS

BEGIN

    RETURN select :p_in AS p_out FROM dummy;

END;

 

If a call this with SELECT * FROM "PMX_FN_TEST"( 123 ); there is no problem and my 123 is returned.

But if I call it with SELECT * FROM "PMX_FN_TEST"( NULL ); I get an obscure error:

 

Could not execute 'SELECT * FROM "PMX_FN_TEST"( NULL )' in 41 ms 925 µs .

SAP DBTech JDBC: [257]: sql syntax error:  [257] sql syntax error: incorrect syntax near "AS": line 2 col 10 (at pos 92)Please check lines: 7,

 

How can I write this function so it works correctly instead of having HANA server give obscure errors?

 

Thanks,

Kris M.


Viewing all articles
Browse latest Browse all 8800

Trending Articles