Solved

updating value of global variable

Posted on 2014-01-25
2
280 Views
Last Modified: 2014-01-26
hello
http://www.experts-exchange.com/Database/Oracle/Q_28333549.html#a39765878

i used the code of slothw as the follwoing

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

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

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
0
Comment
Question by:NiceMan331
2 Comments
 
LVL 34

Expert Comment

by:johnsone
ID: 39808678
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.
0
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 39809380
Johnsone and other Experts,
The important related question is here:
http://www.experts-exchange.com/Database/Oracle/Q_28344919.html


>>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.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now