Solved

updating value of global variable

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
Suggested Courses

635 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