updating value of global variable


i used the code of slothw as the follwoing

create or replace package mypkg
	C_Per date := '31-jan-13';
	function myfunc return date;

create or replace package  body mypkg
	function myfunc return date
		return C_Per;

Open in new window

i would like to use the function to return the value of the end of the month
the question is :
1- how to update the value of c_per  via forms ?
2-how to get the value of end of next month
Who is Participating?
slightwv (䄆 Netminder)Connect With a Mentor Commented:
Johnsone and other Experts,
The important related question is here:

>>how to update the value of c_per  via forms ?

It's a constant.  To reset it to a new value, recreate the package.

If you wish to change it often then the table solution in the other question may be the best solution.
johnsoneSenior Oracle DBACommented:
Why do you need a package and a hard coded value for the end of the month?  Oracle supplies a LAST_DAY function that will give you the last day of the month.  For the current month, this would work:

SELECT trunc(last_day(sysdate)) FROM dual;

Your package could contain a function that would return that value, rather than a hard coded value.

The only way to permanently change the value in the package header that you created would be to replace the package header.  That would require a lock, which may or may not be easy to get.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.