I tried calling a procedure with 3 input parameters and 3 out parameters in both Oracle forms .pll file as well as in sql developer. Even I expected the same output parameter values for both cases, it gives different results. I confirmed printing a message on .pll and they are exactly same as I used in sql developer. Can anybody explain what the cause for such discrepancy is. Thanks.
In .pll
p_enquiry_date pp_acc.end_date%type := to_date((nvl(name_in('PPUN.DSP_RUN_END_DATE'),
to_char(sysdate, 'DD-MON-YYYY'))),'DD-MON-YYYY');
message('enq: '||p_enquiry_date);pause;
It prints 'enq: 11-JAN-23'
In Sql Developer,
p_enquiry_date pp_acc.end_date%type := to_date('11-JAN-2023','DD-MON-YYYY');
From my point of view, everything is OK. It is not about date value itself, but the way it is presented to you.
Both Forms and SQL Developer show these date values using format mask valid at that moment.
In SQL*Plus (easier to demonstrate), we set it by
If I change my mind, I can
Or, to display time component as well:
sysdateis the same in all cases, it is just about the way you see it.The same goes with Forms; its date format is set to
dd-MON-yyordd-MON-rrso you see it as11-OCT-23, but it is as valid as any other format.If you have to do some date arithmetic with that variable, no problem - you can, and all values will be OK as you're dealing with
datedatatype.You could modify the way you see that value - the simplest way is to apply
to_charwith desired format mask, e.g.but this is now a string (and so is e.g. 'ABC' or 'Littlefoot' etc.) so - for date arithmetic operations - you'd now have to either convert it back to date (using
to_date, again with appropriate format mask that matches that string) or - worse - rely on Oracle's implicit datatype conversion capabilities, and that's simple wrong. Imagine you see this value:02/04/08. What is it?Could be any of these values - that's why format model matters.
Once again: as long as you work with
datedatatype, you're fine. Don't go to the dark side and work with characters (representing date values).