Oracle v() vs nv() function

Viewed 3905

What is the difference between v() and nv() functions in oracle apex?

I came across the nv() function and the only thing I can get google to spit out is the nvl() function.

apex_custom_auth.post_login(   
                p_uname      => l_authenticated_username,  
                p_session_id => nv('APP_SESSION'),  
                p_app_page   =>
apex_application.g_flow_id||':'||nvl(apex_application.g_flow_step_id,0));
3 Answers

nv returns a number rather than a string (so obviously it only works with numeric attributes). If you use v to return numeric values, you can sometimes run into performance issues related to data type conversion.

See Syntax for referencing item values

It is

GET_NUMERIC_SESSION_STATE Function

This function returns a numeric value for a numeric item. You can use this function in Oracle Application Express applications wherever you can use PL/SQL or SQL. You can also use the shorthand, function NV, in place of APEX_UTIL.GET_NUMERIC_SESSION_STATE.

See Oracle Application Express APIs for more info.

Instead of calling APEX_APPLICATION.G_USER (it shows currently logged user) you can easily call v('APP_USER') so according to me, it's like an evaluator function that provides you a ease to get values of Apex global variables. So these are equivalent.

v('APP_SESSION')
APEX_APPLICATION.get_session_id

Check Oracle APEX global variables

NV('APP_CURRENT_LOGGED_USERS_HIGH) works with numeric values,(took an example of a user-defined global variable in APEX)

Related