Solved

updating value of global variable

Posted on 2014-01-25
2
288 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 35

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 77

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

738 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