How to alter session parameters from within oracle forms?

Question : How to alter session parameters from within oracle forms?

My form builder documentation on the ALTER SESSION command says “You can use the ALTER SESSION SQL command to override the NLS defaults.  An ideal place to do this is in the After Form trigger. “.

I put the fommowing line of code in the WHEN-BUTTON-PRESSES TRIGGER of a button on my form:
ALTER SETTION SET NLS_DATE_FORMAT = “DD-MM-YYYY”;

When I try to run the form the compiler complains saying:
“Encountered the symbol ALTER when expecting one of the following …”.

How can I call ALTER SESSION from my form??


 

Solution: How to alter session parameters from within oracle forms?

For example:

You could have a varchar2 field in a control block, and instead of changing the nls parameter, you could setup a global
variable to identify the format you desire,

in trigger , check global variable and do the select with the proper to_char format

if :global.datenls = ‘1’ then
select to_char(sysdate,’DD=MON=YYYY’) into :block.field from dual;
end if;

Just try to do the same thing in a different way.