Class UdfParameterTypes
java.lang.Object
dev.frostlake.executor.expressions.UdfParameterTypes
The type a SQL UDF's parameter carries INSIDE the body, which is not always the type it was declared
with. The account types the body as if the call were inlined: a parameter takes the ARGUMENT's own
static type wherever the argument needs no conversion to reach it, and the declared type only where
it does. Live-measured, family by family:
- a VARCHAR parameter takes a text argument's width, whatever it is — wider or narrower than the declaration — and the UNBOUNDED width for anything else, a number, a date and NULL alike;
- a BINARY parameter takes a binary argument's width, and the declared one otherwise;
- an exact NUMBER parameter takes an exact number argument's precision and scale only when that
scale is at least the parameter's —
1.25into NUMBER(10,2) stays NUMBER(3,2) while a bare1becomes NUMBER(10,2) — and the declared type for a FLOAT, a text or NULL; - every other family, FLOAT among them, keeps the declared type.
-
Method Summary
-
Method Details
-
effective
The type the body reads this parameter at.- Parameters:
declared- the parameter's declared typeargument- the argument's static type, or null when it could not be typed- Returns:
- the type to compile the body with
-