Solved

updating value of global variable

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

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
query in Oracle forms Builder 2 53
How to return an OUT parameter from and ORACLE 3 72
history tablespace temp usage 2 42
upgrading Oracle 10g/ 11g / 11g R2 to Oracle 12c 25 54
Article by: Swadhin
From the Oracle SQL Reference (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm) we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
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…
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

810 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