Function in a function - ?
is it possible to declare/write a function with in the function of some class? I am not talking about "anonymous classes".
If there is a way then can you post some sample code.
>>
[url=http://gafter.blogspot.com/2006/08/closures-for-j
ava.html]Not yet, no
Do you agree with such an implementation in Java?
Regards,
Sim085
I'm not sure. While they would prove useful, isn't the language bloated enough already? Already there are new features in the language that a lot of people don't make use of, or in some cases don't even know exist (generics leaps to mind, for one) and there are even people who don't know what java pre-5 was like. Seems closures would just be another way in which different versions were incompatible. Gafter's post doesn't seem to mention what will be going on at bytecode level, either. I'd rather find out more first, but it certainly looks like they're coming
What do you think?
Similar Messages
-
If we use DML statement in function then that function can be used inside s
if we use DML statement in function then that function can be used inside select query or any DML query?
select f from t2;I think you meant to query t1.
It works if the function is an autonomous transaction:
create or replace function f return number
is
PRAGMA AUTONOMOUS_TRANSACTION;
begin
update t1 set c=2;
commit;
return 1;
end;
select f from t1But as Billy said why would you want to do DML this way. And this is not the way autonomous procedures should be used either.
An an answer to an interview question though nothing wrong with it. -
I own a MAC Pro 3,1 (early 2008) and am running Mavericks 10.9.3 with no problems. I would like to add an I/O card to add USB 3 functionality or ESATA functionality but am unable to find a compatible card. As such my question...can I do this and if so what is the best card?
Thank youHave you looked at the previous discussions listed on the right side of this page under the heading "More Like This"?
Also see:
https://discussions.apple.com/thread/6282459?tstart=0 -
Calling a function in a function
I am trying to call a function in a function (CF Report
Builder 7) and I always got an error. As far as I know, it is
suppose to be very simple and I keep it simple but since I work
with re-usable function, I try to apply this method as well in CF
Report Builder to create report with more sense than just use
CFDOCUMENT.
It seems that everytime I am using the amp to add on a
string, it generates an error. Why? It is very standard to use a
variable such as: <cfset vReturn = "As of " &
fGetAsof()>.
Thank you in advance for any help!
Here is the code from the first function -
Report.fGetReportTitle3()
<cfset vReturn = "">
<cfset vReturn = "As of " & report.fGetReportAsOf>
<cfreturn vReturn>
Here is the code for the second function -
Report.fGetReportAsOf()
<cfset vAsOfTemp = CreateDate(query.dtYear, query.dtMonth,
1)>
<cfset vAsOfTemp = DateAdd("d", -1, DateAdd("m", 1,
vAsOfTemp))>
<cfset vReturn = "" & DateFormat(vAsOfTemp, "d mmmm
yyyy")>
<cfreturn vReturn>
Please note:
query.dtYear is an integer that contain just the year (e.g.
2007).
query.dtMonth is an integer that contain the month integer
value (e.g. 1 will means January, 2 will means Ferbuary and so on
until 12 for December).The only think that do not generate error is when I am
calling the function such as this:
<cfset vReturn = "As of " & fGetReportAsOf>
But, it display an empty line of information. This is the
third line of the title on 4 so 1 and 2 will be shown, as well as
4, but not the third line - if I am using this method. I found it
strange since there is a "hard-code' part in the string (the As of
words which is force manually to be displayed). So if the system is
not able to retrieve the content of a variable, I will assume it
will show an error. In this case, no error but no display! -
Can we call a function within a function??????Urgent
Dear All,
Like we can call a procedure from another procedure , in the same way can we call a function within a function. Please reply it's urgent.
Regards> Please reply it's urgent.
My usual soapbox response.
Saying your posting is urgent is rude and arrogant. Why? Because you are saying that other people who have posted problems here, have less important problems than yours. That despite how complex and critical their problem may be, yours take priority.
You're also demaning attention and a quick answer from people that provide support here - in their free time... and not getting paid a single cent for their efforts.
So just how can you demand any urgency to your posting from them?
Remember that this is a public forum. You cannot demand anything here. This is not Oracle Support. There are no SLA's here. Basic nettiquette applies. -
How to use analytic function with aggregate function
hello
can we use analytic function and aggrgate function in same qurey? i tried to find any example on Net but not get any example how both of these function works together. Any link or example plz share with me
Edited by: Oracle Studnet on Nov 15, 2009 10:29 PMselect
t1.region_name,
t2.division_name,
t3.month,
t3.amount mthly_sales,
max(t3.amount) over (partition by t1.region_name, t2.division_name)
max_mthly_sales
from
region t1,
division t2,
sales t3
where
t1.region_id=t3.region_id
and
t2.division_id=t3.division_id
and
t3.year=2004
Source:http://www.orafusion.com/art_anlytc.htm
Here max (aggregate) and over partition by (analytic) function is in same query. So it means we can use aggregate and analytic function in same query and more than one analytic function in same query also.
Hth
Girish Sharma -
Use of Sender & Receiver Function in Constant Functions
Hi All,
What is the use of "Sender" and "receiver" function in "Constant Functions" in graphical mapping. In which scenarios it will be used.
Thanks & Regards
Venkat AnilNo its does not create "Test_Sender_System" & "Test_Receiver_System" Nor you have to create these business sytems.
At runtime based on your scenario/ID configuartion it will give you the actual sender and receiver systems in the mapping.
But if you are testing your mapping directly in Integration repository->Message Mapping->Test Tab at design time then it will give "Test_Sender_System" & "Test_Receiver_System" as a ouput (at design time it does not have actual sender/reciver information).
For e.g. if you have scenario with BS_SENDER and BS_RECEIVER as your sender and receiver business system then
1. If you run your interface end-to-end the the output at runtime will be BS_SENDER and BS_RECEIVER for "Sender" and "Receiver" functions respectively.
2. If you directly test your message mapping in IR->MM->Test Tab output at design time will be "Test_Sender_System" & "Test_Receiver_System" for "Sender" and "Receiver" functions respectively. (at design time it does not have actual sender/reciver information). -
Calling a function inside a function
How does one do that? I am trying to call function 1 inside function 2. What is the corrct syntax?
If this post answers your question or helps, please mark it as such.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
private function callFuncs():void{
one();
private function one():void{
txt.text += "In function one()\n";
two();
private function two():void{
txt.text += "In function two()\n";
three();
private function three():void{
txt.text += "In function three()\n";
]]>
</mx:Script>
<mx:Button label="Call Functions" click="callFuncs();"/>
<mx:TextArea width="500" height="500" id="txt"/>
</mx:Application> -
Hi All,
I have an outer function and an inner function. i want to execute both simultaneously by passing corresponding parameters. i am giving my outer and inner function below.
outer function
CREATE OR REPLACE FUNCTION OGRDS_USER.f_hier_browser (v_prnt_chr_val_id IN number) RETURN varchar2
IS
v_breadcrumb varchar2(200);
BEGIN
SELECT h.hier_name || ' > ' ||
ltrim(sys_connect_by_path(*OGRDS_USER.f_val_dscr(21,he.prnt_chr_val_id,4)*,' > '),' > ') path
INTO v_breadcrumb
FROM hier_t h
INNER JOIN hier_dscr_t hd
ON hd.hier_id = h.hier_id
INNER JOIN hier_defn_t hdef
ON hdef.hier_id = h.hier_id
INNER JOIN hier_elmnt_t he
ON hdef.hier_defn_id = he.hier_defn_id
WHERE he.prnt_chr_val_id = v_prnt_chr_val_id
START WITH hdef.prnt_chr_id = (SELECT mh.prnt_chr_id FROM hier_defn_t mh WHERE mh.hier_id = hdef.hier_id AND lvl = 1)
CONNECT BY PRIOR hdef.chld_chr_id=hdef.prnt_chr_id;
RETURN v_breadcrumb;
END f_hier_browser;
inner funciton:
CREATE OR REPLACE FUNCTION OGRDS_USER.f_val_dscr(v_lang_id IN number,
v_chr_val_id IN number,
v_dscr_id IN number) RETURN varchar2
IS
v_val_dscr varchar2(50);
BEGIN
WITH chld_lang
AS
(SELECT OGRDS_USER.GRD_GLOBAL_PKG.GRD_OGRDS_LANG_REL(v_lang_id) from dual)
SELECT distinct
CASE
WHEN vcl.chr_val_dscr IS NOT NULL THEN
vcl.chr_val_dscr
WHEN vpl.chr_val_dscr IS NOT NULL THEN
vpl.chr_val_dscr
ELSE
cl.chr_val_dscr
END text INTO v_val_dscr
FROM chr_val_dscr_t cl
LEFT OUTER JOIN (SELECT chr_val_id, chr_val_dscr, lang_id
FROM chr_val_dscr_t vpl,chld_lang
WHERE vpl.chr_val_id = v_chr_val_id
AND vpl.lang_id = (SELECT OGRDS_USER.GRD_GLOBAL_PKG.GRD_OGRDS_LANG_REL(v_lang_id) from dual)
AND vpl.dscr_id = v_dscr_id
) vpl
ON vpl.chr_val_id = cl.chr_val_id
LEFT OUTER JOIN (SELECT chr_val_id,cd.lang_id,chr_val_dscr,dc.dscr_name,dl.dscr_lbl,cd.dscr_id
FROM chr_val_dscr_t cd,dscr_config_t dc,dscr_lbl_t dl
WHERE dc.dscr_id=cd.dscr_id
AND dc.dscr_id = dl.dscr_id
AND cd.chr_val_id = v_chr_val_id
AND cd.dscr_id = v_dscr_id
)vcl
ON vcl.chr_val_id = cl.chr_val_id
AND vcl.lang_id = v_lang_id
AND vcl.dscr_id = v_dscr_id
WHERE cl.chr_val_id = v_chr_val_id
AND cl.dscr_id = v_dscr_id
AND cl.lang_id = 0;
return v_val_dscr;
end f_val_dscr;
right now i am able to call the outer function by passing paramter like this.
select ogrds_user.f_hier_browser(10002) from dual
but the irony is, i am not able to change/pass the parameters for the inner function(f_val_dscr) when i call outer function.
can anyone please help?Hi,
In your scenario, the inner function is called with the values fetched from the SELECT statement.
So we need not explicitly pass values to the parameters of inner function.
If your requirement is to explicitly pass the values to the inner function along with the outer function, then you can add additional parameters in the outer function and pass them to the inner function like
CREATE OR REPLACE outer_func(of_param1 number
,of_param2 number
,if_param1 number
,if_param2 varchar2
) AS
BEGIN
variable:= inner_func(if_param1,if_param2);
...Regards,
Sreekanth Munagala -
Excel function and ev function not working in static column key
I have created a evdre report and I notice that when I tried to use any excel function and ev functions in the static column key cell to get the value for that cell, it's not working.
e.g I have Col key define as:
ColKeyRange Sheet!&$J$12:$N$14
In K13 which is key id for time. I define is as = $K$10 where K10 is the time value from current view, it not working,the value is still K13 = $K$10. then I tried to use EVCVW function to replace K10, it also not working, but I use the same function in the description of the ID underneath, both of the are working, Any thought?
Edited by: DFW on Feb 9, 2010 7:33 PMHi,
That was exactly what I meant. They just dont work on the green ID areas or the yellow data region. Few days back even I tried that, but didnt work. So, I followed the different approach. I dont remember about the dynamic templates. Are you sure that the functions were written in the green ID region?
I remember this used to work fine in the MS version. However, in the NW version, even I am not able to make them work.
Edited by: nilanjan chatterjee on Feb 9, 2010 9:38 PM -
Renaming a function in a function group
Hi,
I'm trying to rename a function in a function group, and I keep getting
Object components locked in request and separate task
It was decided the Function group should be called a different name, and so I copied the function group, and then copied all the functions with a new name.
Now in the original Function Group I want to rename the functions, so I can use the correct names in the new function group - or is there a faster way of renaming a function group?
ThanksYou are not able to rename original function group / modules because they are also locked in another task of same transport.
Goto SE09, give the transport no and see the details of transport.
There must be multiple tasks - may be some other developers are using same transport.
So you need to change task owner to your id and then rename fm . function group.
Pls make sure that you are not disturbing other developer's development as you all are sharing the transport. -
How to you refer to a function in another function in a cfc
HI,
How to you refer to a function in another function in a cfc like so
<cffunction name="getApplicationConstants" access="remote" returntype="struct">
<cfset flash.result.users = [the result from the getUsers function]>
<cfreturn flash.result>
</cffunction>
<cffunction name="getUsers" access="remote" returntype="query">
<cfquery name="q" datasource="#datasource#">
select c.*
from USERS as c WHERE looksLikeUserIsDeleted = 'False'
AND userPrivileges = 1
ORDER BY fullName
</cfquery>
<cfset flash.result = q>
<cfreturn flash.result>
</cffunction>Hi, Nikos,
If the CFCs are in the same directory, you could do the following:
CFCA
<cfcomponent>
<cffunction name="getApplicationConstants" access="remote" returntype="struct">
<cfset flash.result.users = cfcB.getUsers() />
<cfreturn flash.result>
</cffunction>
</cfcomponent>
CFCB
<cfcomponent>
<cffunction name="getUsers" access="remote" returntype="query">
<cfquery name="q" datasource="#datasource#">
select c.*
from USERS as c WHERE looksLikeUserIsDeleted = 'False'
AND userPrivileges = 1
ORDER BY fullName
</cfquery>
<cfset flash.result = q>
<cfreturn flash.result>
</cffunction>
<cfcomponent>
If the CFCs were in different directories, the cfset expression in CFCA would be this:
<cfset flash.result.users = path.to.cfc.cfcB.getUsers() />
Where I have path.to.cfc, you would use either a mapping from CF Admin or the hierarchy of folders to the CFC from the web root.
Does that help? -
Calling one function in another function
Hi,
How to call one function in another function?
regards,
Kishore.example:
SQL> ed
Wrote file afiedt.buf
1 declare
2 function bob(x number) return number is
3 begin
4 return x*x;
5 end;
6 function fred(x number) return number is
7 begin
8 return x+bob(x);
9 end;
10 begin
11 dbms_output.put_line('Value: '||to_char(fred(5),'fm9999'));
12* end;
SQL> /
Value: 30
PL/SQL procedure successfully completed.
SQL> -
NVL Function and Truncate Function in Template Builder
Hi Guys,
How would I use NVL function and Truncate function in the Word Template Builder.
These functions do not work in the Query Builder when i use SQL Query as the Dataset while creating a report.
I could not find examples in the Publisher Guide either.
Thanks
rkingmduHi
How can you not use the functions in your query? Does the builder return an error? ow about just pasting your query into the report definition does the nvl/trunc work then ?
Regards
Tim
http://blogs.oracle.com/xmlpublisher -
Combing rounding functions with other functions
I am using hyperion reports. Is it possible to combine a rounding function with another function? Specifically, I am taking a variance of actual vs budget where actual and budget are % of total functions. The variance I am getting is off (see ex. below.) I need to keep the actual and budget at 1 decimal point. To correct this problem in excel I am able to round the numbers pulled in by essbase. The ex. below illustrates my problem. Actual .2% Budget .2% Variance .1%
You may want to make a 'Scenario' for rounding that is rounding the input data. If you make it (variance) 2pass, it will show the difference of the rounded numbers (ie. 0%)Rich [email protected]
-
Function Groups and Function Modules
Hi,
Can anyone give me the detail steps for creating Function Group and then from that function group creation of function module with example?
Regards,
ChandruHi,
Function Group creation -
A function group is a program that contains function modules. With each R/3 system, SAP supplies more than 5,000 pre-existing function groups.
In total, they contain more than 30,000 function modules. If the functionality you require is not already covered by these SAP-supplied function modules, you can also create your own function groups and function modules.
We can put all the relevant function modules under one function group and all the global variables can be declared in this FG.
FG Creation:
1) Function group can be created in SE80. There choose the 'Function Group' from the list of objects.
2) Then give a name for ur function group (starts with Y or Z) and press ENTER.
3) The click 'YES' in the create object dialog box and give a short desc. for this FG and save.
Function Module:
A function module is the last of the four main ABAP/4 modularization units. It is very similar to an external subroutine in these ways:
Both exist within an external program.
Both enable parameters to be passed and returned.
Parameters can be passed by value, by value and result, or by reference.
The major differences between function modules and external subroutines are the following:
Function modules have a special screen used for defining parameters-parameters are not defined via ABAP/4 statements.
tables work areas are not shared between the function module and the calling program.
Different syntax is used to call a function module than to call a subroutine.
Leaving a function module is accomplished via the raise statement instead of check, exit, or stop.
A function module name has a practical minimum length of three characters and a maximum length of 30 characters. Customer function modules must begin with Y_ or Z_. The name of each function module is unique within the entire R/3 system.
Defining Data within a Function Module
Data definitions within function modules are similar to those of subroutines.
Within a function module, use the data statement to define local variables that are reinitialized each time the function module is called. Use the statics statement to define local variables that are allocated the first time the function module is called. The value of a static variable is remembered between calls.
Define parameters within the function module interface to create local definitions of variables that are passed into the function module and returned from it (see the next section).
You cannot use the local statement within a function module. Instead, globalized interface parameters serve the same purpose. See the following section on defining global data to learn about local and global interface parameters.
Defining the Function Module Interface
To pass parameters to a function module, you must define a function module interface. The function module interface is the description of the parameters that are passed to and received from the function module. It is also simply known as the interface. In the remainder of this chapter, I will refer to the function module interface simply as the interface.
To define parameters, you must go to one of two parameter definition screens:
1) Import/Export Parameter Interface
2) Table Parameters/Exceptions Interface
Then in the FM interface screen, give the following
1) Import parameters
2) Export parameters
3) Changing parameters
Then give
1) Define internal table parameters
2) Document exceptions
You enter the name of the parameter in the first column and the attributes of the parameter in the remaining columns. Enter one parameter per row.
Import parameters are variables or field strings that contain values passed into the function module from the calling program. These values originate outside of the function module and they are imported into it.
Export parameters are variables or field strings that contain values returned from the function module. These values originate within the function module and they are exported out of it.
Changing parameters are variables or field strings that contain values that are passed into the function module, changed by the code within the function module, and then returned. These values originate outside the function module. They are passed into it, changed, and passed back.
Table parameters are internal tables that are passed to the function module, changed within it, and returned. The internal tables must be defined in the calling program.
An exception is a name for an error that occurs within a function module. Exceptions are described in detail in the following section.
Syntax for the call function Statement
The following is the syntax for the call function statement.
call function 'F'
[exporting p1 = v1 ... ]
[importing p2 = v2 ... ]
[changing p3 = v3 ... ]
[tables p4 = it ... ]
[exceptions x1 = n [others = n]].
where:
F is the function module name.
p1 through p4 are parameter names defined in the function module interface.
v1 through v3 are variable or field string names defined within the calling program.
it is an internal table defined within the calling program.
n is any integer literal; n cannot be a variable.
x1 is an exception name raised within the function module.
The following points apply:
All additions are optional.
call function is a single statement. Do not place periods or commas after parameters or exception names.
The function module name must be coded in uppercase. If it is coded in lowercase, the function will not be found and a short dump will result.
Use the call function statement to transfer control to a function module and specify parameters. Figure 19.9 illustrates how parameters are passed to and received from the function module.
sample FM
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ' '
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT =
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab =
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Example
1 report ztx1905.
2 parameters: op1 type i default 2, "operand 1
3 op2 type i default 3. "operand 2
4 data rslt type p decimals 2. "result
5
6 call function 'Z_TX_DIV'
7 exporting
8 p1 = op1
9 p2 = op2
10 importing
11 p3 = rslt.
12
13 write: / op1, '/', op2, '=', rslt.
Regards,
Shanthi.P
Reward points if useful ****
Edited by: shanthi ps on Jan 26, 2008 12:03 PM
Maybe you are looking for
-
Moving iTunes Library to external hard drive when iTunes can't consolidate.
Hi guys, hope you can help. I want to move my whole iTunes library to an external hard drive and then delete it all from my laptop, and from reading around I realise I have to consolidate the library into the iTunes music folder. However, as my inter
-
Work Agents in Partner Profile
Hi Guru's I need to set up a Workflow for gathering the Inbound IDOC which are in error state. I did the following tasks. 1. Setting up the Work agent and assigned the users ( who receives the WF messages), thro PPOME 2. Assign the work agent to the
-
So why did Apple decide not to put a Kensington Security Slot on the new MBP?
So, I went to the Apple Strore today to prove I wasnt crazy. There is no Kensington Security Slot on the new MacBook Pro. I work in the Production and Audio Visual Industry and there are times when we need to lock down our walkables MACS. Now at $3,7
-
Hi Experts, I am working on class builder.i've come across a situation.in a method i have to store transaction number into a structure.where should i give the structure as tables statement is not allowed in oops.can anyone explain me how to do it? R
-
How can I switch to 32bit Windows 7
I recently purchased a U150 laptop. It came with Windows 7 64bit installed. I am discovering that there are a number of devices that I need to connect to that only have 32bit drivers available. Is there any way I can convert my laptop to 32bit Wind