Solved

updating value of global variable

Posted on 2014-01-25
2
278 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

707 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

12 Experts available now in Live!

Get 1:1 Help Now