Oracle v() vs nv() function
Asked Answered
O

3

6

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));
Odoacer answered 8/10, 2019 at 18:15 Comment(0)
P
7

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

Phenosafranine answered 8/10, 2019 at 18:24 Comment(1)
Which also means that we need to explicitly convert date values stored in session state => to_date(:P1_DATE)Bowline
M
4

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.

Makepeace answered 8/10, 2019 at 18:23 Comment(0)
S
0

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)

Stationery answered 7/5, 2021 at 5:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.