ITS POSSIBLE TO CALL A FUNCTION WHEN THE LINES ARE ALREADY MET?

Hello, I'm new in pl sql and I learn.
My requirment is:

I made a function for calculating the values of cumulative of the account period.

My problem is:

I have this data

amount of the account
12 100
12 50
13 200

and I have this simple query

SELECT flat, account, acumulated_amount (period)
THE F1
GROUP account, the period

I get

amount of the account
12 150
13 200

I want to add is to add a column that is calculated by a function. This function calculates the cumulative amount of previous years of account.
If I insert this select statement so that it will calculate the cumulative amount each online account and what I want is show the amount acumullated after the grouped data

For example: my accumulated amount of the 12 is 1000 and based on my request I will receive

account amount acumullated
12 150 2000
13 200

because the cumulative amount in each line and I need perform the calculation only when data are collected. Something like this:


account amount acumullated
12-150-1000
13 200

Someone has an idea how to do this?

Thanks in advance

Paulo Duarte

Hi, Paulo,

user4256563 wrote:
Hello, I'm new in pl sql and I learn.
My requirment is:

I made a function for calculating the values of cumulative of the account period.

My problem is:

I have this data

amount of the account
12 100
12 50
13 200

Whenever you have a problem, please psot of CREATE TABLE and INSERT statements for your sample data, even if it's only 3 rows.
Always say what version of Oracle you are using (for example, 11.2.0.1.0).

and I have this simple query

SELECT flat, account, acumulated_amount (period)
THE F1
GROUP account, the period

I get

amount of the account
12 150
13 200

You have 3 columns in your SELECT statement, but only 2 columns in the output. Is one of the output NULL columns?

I want to add is to add a column that is calculated by a function. This function calculates the cumulative amount of previous years of account.
If I insert this select statement so that it will calculate the cumulative amount each online account and what I want is show the amount acumullated after the grouped data

For example: my accumulated amount of the 12 is 1000 and based on my request I will receive

account amount acumullated
12 150 2000
13 200

Sorry, I don't see how you get 1000 or 2000 for examples of data that you said that you have. Can you explain, step by step, how to get this figure?

because the cumulative amount in each line and I need perform the calculation only when data are collected. Something like this:

account amount acumullated
12-150-1000
13 200

That's what you want, or you want the results given just before her, with accumulated = 2000?
Whatever it is, I still don't see how you get 1000 or 2000 of 100, 50 and 200.

Someone has an idea how to do this?

Analytical functions can do what you want. When you use analytical functions and aggregation in the same query, the GROUP BY clause is applied and aggregate functions are calculated before the analytical functions are started.

You can write (or analytical) global functions defined by the user. For a simple (and very useful) example, called STRAGG, see
http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:2196162600402

Tags: Database

Similar Questions

  • Remote PC stops responding when the lines are added to a multiline textbox

    Hello

    When connected two RDP connections and multiline textbox is visible and always up-to-date (e.g. time real record on the screen), then all other processes and threads are suspended on the remote PC. For example, the task manage does not refresh, the clock stops, if you have a few applications running on this PC Server/services so their customers will get the writing/connect timeout errors, etc.

    to reproduce this problem:

    1. create a test application simulating recording in real time on the screen. For example, create a new GUI application (for example, in visual basic, delphi, etc.), several (for example six) textbox, control and set multiline = true (or use TMemo components in delphi), add the button and code to add rows in a loop (for example 200 iterations) these textbox/TMemo controls (see the sample code below). Build the executable

    2. have three PC of loan. The first connect to second via RDP and from there linking to third parties via a second RDP connection. Third PC start test application, that you created in step 1. While the lines are added to the multiline/TMemo text box, try to do something with this PC, for example open the Task Manager, check how it is refreshing, open clock and note how seconds are proliferating, try to connect to some services from another PC (shared disk for example, ftp, web, etc.) and see how to answer they are

    Windows 2000 seems to be ok, xp, 7, Server 2003/2008 have some problems

    is there something that we could do to make the third-party application with real-time logging to the multiline/TMemo text box does not slow down or suspend our services that are running on the same PC, when someone connect via RDP? also, it would be great if microsoft could fix this problem

    example code:

    For i As Integer = 1 to 200
    Dim s As String = «»
    J As Integer = 1 to 10
    Convert.ToString (i) & s = s & ""
    Next J
    TextBox1.AppendText (s & Chr (13) & 10)

    J As Integer = 1 to 10
    Convert.ToString (i) & s = s & ""
    Next J
    TextBox2.AppendText (s & Chr (13) & 10)

    J As Integer = 1 to 10
    Convert.ToString (i) & s = s & ""
    Next J
    TextBox3.AppendText (s & Chr (13) & 10)

    J As Integer = 1 to 20
    Convert.ToString (i) & s = s & ""
    Next J
    TextBox4.AppendText (s & Chr (13) & 10)

    J As Integer = 1 to 20
    Convert.ToString (i) & s = s & ""
    Next J
    TextBox5.AppendText (s & Chr (13) & 10)

    J As Integer = 1 to 20
    Convert.ToString (i) & s = s & ""
    Next J
    TextBox6.AppendText (s & Chr (13) & 10)
    Next I

    var
    i: Integer;
    s:string;
    Start
    for i: = 1 to 200 start
    s:='';
    While length<20 do="" s:="s+intToStr(i)+'">
    glMemo1.Lines.Add (s);

    While length<40 do="" s:="s+intToStr(i)+'">
    glMemo2.Lines.Add (s);

    While length<60 do="" s:="s+intToStr(i)+'">
    glMemo3.Lines.Add (s);

    While length<80 do="" s:="s+intToStr(i)+'">
    glMemo4.Lines.Add (s);

    While length<100 do="" s:="s+intToStr(i)+'">
    glMemo5.Lines.Add (s);

    While length<200 do="" s:="s+intToStr(i)+'">
    glMemo6.Lines.Add (s);
    end;

    Thank you
    Paulius

    http://social.technet.Microsoft.com/forums/en-us/itproxpsp/threads

    you might do better at the forum above. Good luck. :)

  • Call or function of the class from a loaded MC

    Hello

    Can someone tell me if its possible to call a function or a class from a loaded MC?

    mainMovie charge MC > MC calls the function in a class of mainMovie

    If so, what is the best method?

    I tried this loaded MC but (of course) an error:

    movieClip (parent.parent). DO_THIS();

    Thanks for everything 'light' on this.

    Have the loaded SWF file send a custom event that spreads and listen to this event in the parent.

    In SWF loaded:

    dispatchEvent (new Event ("customEvent", true));

    Parent:

    addEventListener ("customEvent", handleCustomEvent);


    function handleCustomEvent(event:Event):void

    {

    do your stuff in the parent here
    }

    TS

  • Calling a function in the HTML window that course is located inside - 8 Captivate

    Hello

    I scoured the forums to answer this but still have developed in white.

    Our LMS is launching a course in a pop-up window and inside that the Captivate output file .htm lies.

    Currently this pop-up window has a button that performs a function.  The problem is this button is rather unsightly sitting above the price in the HTML window and I wish I could call this function inside the Captivate course itself.

    The function is called closeSCOContent() and it closes the window of course but basically sends the user to a page of comments.

    So, basically is it possible to call this function using the Javascript function in Captivate 8?

    I hope that I have explained that sufficient

    Thank you very much!

    You should be able to call the function, but you would need to know where he is regarding parents/children/opener. Looks like there's frameset inside the popup.

  • Need to call the javascript function when the page is loaded

    Hello - I have a javascript function defined on Page 0 of my application. It is in the source of an unconditional
    region whose view point is after the header.

    I call successfully the function of event onchange on individual page elements. (The function
    sets the value of an element based on the value of another).

    But I also need to call the function when the page is loaded. The page is a form of data modification,
    so many values is filled when it is loaded, and I need the dependent values populated
    also.

    I tried to add the call to function in the following way. It is not at all get called (alerts are not forthcoming)
    and there is no error in the Firefox error console...
    - as an event onload in individual items
    -call directly to the edit HTML page header
    -call directly from the HTML body of the edit page (which, from what I've read, sounds
    as to execute onload and my page template doesn't have a defined substitution onload string).

    In these 2 cases, I simply call it like: jsLookupValue ($v ("P8_OBJECTTYPE_ID"), "objecttype_id", "P8_OBJECTTYPE_NAME", "objecttype_name", "hdb_objecttype");

    How can I do this?

    Thank you
    Carol

    If you define the function on the zero page and any page you should be able to call using something like:

    
    

    Have you tried to put just a statement alert() on the page in order to check that it runs just about anything?

  • Is it Possible to use a function when you create a table?

    Hello

    Is it possible to use a function during the construction of a table?

    I would like to browse my data returned from the db and call a function. The part where I call the function "myFunction [i]" doesn't seem to work. How can I solve this problem? I need to put the function call results in the table.

    var i: uint;

    for (i = 0; i < dataArray.Length; i ++)

    {

    dgArray = [{name: dataArray [i] .name, Type: myFunction [i]}];

    }

    Thank you!
    -Laxmidi

    Hi laxmi,

    Yes of course it is quite possible to use a function when you create a table... In your code, you made some mistakes...

    You used hooks to call the function myFunction [i]... where you are supposed to use parentheses... myFunc (i)... and other you must push the object in the dgArray but yous hould not not attribute...

    dgArray = [{name: dataArray [i] .name, Type: myFunction [i]}]; This will result in only the last table iterates in dgArray...

    So you should write dgArray.push ({name: dataArray [i] .name, Type: (i) myFunction});

    Check out the code below...


    http://www.Adobe.com/2006/mxml"layout ="absolute"creationComplete ="init (); » >

      private var dgArray:Array = new Array();
    private var myDataArray:Array = [{data: '1', name: 'Robert'}, {data: '2', name: 'Nicolas'}, {data: '3', name: "Bika"}]
     
    private function init (): void
    {
    for (var i: int = 0; i
    {
    dgArray.push ({name: dataArray [i] .name, Type: (i) myFunction});
    }
    }
      
    private void myFunction(i:int):String
    {
    Return 'Type' + i;
    }
    ]]>

    If this post answers your question or assistance, please mark it as such.

    Thank you

    Jean Claude Chari

  • call a function in the hull of the SWF to a SWF imported

    We have set flash up as a shell to retrieve data from the lesson in XML and display image by image.

    We import SWF files when the XML code that tells it to affix the frame.

    How can I get the SWF file imported to call a function in the hull...

    basically a button or movie clip in swf call imported the function "gotoNextFrame()" in the hull.

    We found an easier way to 'bit' if anyone is interested... We have an eventlistner added to the charger to assign an event in the swf file that is imported:

    flashLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, addEventHandlers);

    then when its done, it adds event listeners and calls our function "goNextFrame" (then it clears when its removed from the scene):

    function addEventHandlers(event:Event):void
    {

    var swfMC:MovieClip = event.target.content as MovieClip;

    swfMC.addEventListener ("NextFrame", goNextFrame);
    swfMC.addEventListener ("PreviousFrame", goPrevFrame);
    swfMC.addEventListener (Event.REMOVED_FROM_STAGE, clearEventListeners);

    }

    Then in the swf file that will be imported, its real simple:

    next_btn.addEventListener (MouseEvent.CLICK, MoveToNextFrame);
    prev_btn.addEventListener (MouseEvent.CLICK, MoveToPreviousFrame);

    function MoveToNextFrame(e:MouseEvent):void
    {
    dispatchEvent (new Event ("NextFrame"));
    }

    function MoveToPreviousFrame(e:MouseEvent):void
    {
    dispatchEvent (new Event ("PreviousFrame"));
    }

  • Can I call a function using the array index?

    I defined a table that stores the name of the function, like this:

    var aresetButtonTop:Array = new Array(resetTop1,resetTop2,resetTop3,resetTop4,resetTop5);

    Then I have a button named "btnresetTop" which, once clicked will be called one of the five functions stored in the array (aresetButtonTop) above. Functions are called at runtime depending on certain conditions. I need to figure out how I can call these functions using the array index. I use the following code to call the function. The value of i has already been calculated.


    btnresetTop.addEventListener (MouseEvent.CLICK, aresetButtonTop [i]);

    After doing this, I get the following error when I click on the button:

    TypeError: Error #2007: parameter listener must be non-null.
    at flash.events::EventDispatcher/addEventListener()
    at gallerytest_fla::MainTimeline/thumbTopClick()

    Note: thumbTopClick() is a function within which all these codes are written.

    I need to know if it is posible in AS3 to call a function name using array index or not. If so, could you afford ehelp me out.

    You can certainly do.

    In your case, it looks like i is out of range. Show your loop.

  • Is it possible to call a function in a parent of a child component component in Flex 3?

    It is probably a very basic question, but ask for this for awhile.

    I need to call a function in a parent component and the appeal of its child element in Flex 3. Is there a way to access an element functions of the child element parent? I know that I can send an event for children and add a listener in the parent to call the function, but just wanted to know if could also directly call a function of parent of a child (similar to how you can call a function in the main mxml file using Application.application). Thank you

    There are no performance issues, but it's ok if you use the child component in a single category. Suppose that you want to use the same component as a child to a lot of parents then if all the following

    public interface IParentImplementation{
    
         function callParentMethod();
    }
    

    and the parent of the class has to implement this 'IParentImplementation '.

    usually to the next line

     public class parentClass extends Canvas implements IParentImplementation{
              public function callParentMethod():void{
         //code
              }
         }
    

    in children, you should do something like that.

    (this.parent as IParentImplementation).callParentMethod();
    

    Here the use of Interfaces, we're to decouple the parent and child

    If this post answers your question or assistance, please mark it as such.

  • Calling a function in the main sequence of a loaded swf file

    I know this is probably a very basic question, but I loaded a SWF file in another film. Now, I want to call a function in the main SWF file. Is it possible to do? Otherwise, I have a custom class where I could put the function, but I was not able to understand how to call it from the SWF loaded either. Can I somehow associate the class with the main movie, or...?

    Nevermind - I did something very stupid and was not calling the function as a method of a clip. I was just calling checkTarget (event) and not event.currentTarget.checkTarget (event); that seems to work.

  • Call a function within the same CFC component

    Hello
    / * Niewbie Question * /.
    I have a strange problem. When I try to call one function on the other in the same CFC component, I get an error named: "Entity has incorrect type to be called as a function."
    I looked on many forums and searched in Google groups. I have yet found a work around for this problem.
    I thought I did caution o not use twice the same name...
    Can someone tell me what I did wrong?

    My sample code to reproduce this error is included

    The full error message is:
    Entity is of the wrong type to be called as a function.
    The symbol you provided superfunction is not the name of a function.

    The error occurred in C:\ColdFusion8\wwwroot\admin\_components\test.cfc: line 6

    4: < cfinvoke
    5: method = "superfunction".
    6: returnVariable = "myReturn" >
    7: < / cfinvoke >
    8: < cfset some_text = myReturn >

    OK, solved with all your advice!

    A big thank you to everyone

    Here is the final code for others...

  • Field containing average function works only when the data are engaged on the same page. Does not work for fields on other pages.

    I'm having a problem with a field defined to calculate the average of eleven points fields (points 1 to 8 on page 1-9-11 on page 2). My original question was that it could exclude fields of points when they do not have information entered and adjust the average calculation (number of "divided by") accordingly.

    I had someone write JavaScript code for him, but I just found a small problem I don't know if it's something in the code or what the person who originally wrote the script cannot understand it either and suggested that I have post here.

    The middle area (located on the 2nd page of the pdf page two) seems to work exclusively with precision if at least one of the points of the fields on the 2nd page, 9, 10 (and 11) are engaged with the data. No values entered on the first page and only the first page, are for some reason any dividing by a more than expected. For example, if I fill the boxes 1, 2 and 3, it divides the total by four. If I filled just box 7, it halves. If I fill all 8 boxes on the 1st page, it divides by nine. It is corrected as soon as I get the points in one or more of the three boxes on the 2nd page points, suddenly the overall average is accurate. But if boxes 9, 10 and 11 contain no points, then the average is still inaccurate because the number of ' divide by "he uses is one more than what it should. I can't understand how to attach the form to this post, so I downloaded on Dropbox: Dropbox - used Evaluation.pdf.

    Under the direction of State: javascript came work to exclude the empty boxes when the points are entered in one of the three points of fields on the 2nd page (and more), but the average function is not accurate because it adds 1 to the number of ' divide by "in the calculation of the average If the points are only entered into the fields on the 1st page.

    Here's the code I entered in the 'Custom calculation Script' box in the 'Calculate' tab of the Properties menu of Test field:

    Initialize variables

    var num = 0;

    var sum = 0;

    Browse the input fields

    for (var i = 1; i < 12; i ++) {}

    var f = getField ("points." + i);

    If {(f.valueAsString)

    increment the counter to non-empty field

    NUM ++;

    Add the value of the running total field

    sum += + f.value;

    }

    }

    Calculate the average

    If {(num)

    Event.Value = sum / num;

    } else {}

    All fields are empty, then the empty value

    Event.Value = "";

    }

    I do not see that. Add the code of script debugging will display the results that each field is completed:

    Initialize variables
    var num = 0;
    var sum = 0;

    Browse the input fields
    for (var i = 1; i)< 12;="" i++)="">
    var f = getField ("points." + i);
    If {(f.valueAsString)
    increment the counter to non-empty field
    NUM ++;
    Add the value of the running total field
    sum += + f.value;
    }
    }
    Debug - display results as the form is filled;
    Console.Show
    Console.println (sum + "/" + num + "=" + sum/num);
    end of debugging;
    Calculate the average
    If {(num)
    Event.Value = sum / num;
    } else {}
    All fields are empty, then the empty value
    Event.Value = "";
    }

  • When I use the function "cut", the line of results more sharpness compared to the original files. For example, {A: "file.psd"-&gt; cultures 4x6inch, 300 dpi-&gt; B: "cropped file.psd} then the results are as described as a first step. What s the problem.

    When I use the function "cut", the line of results more sharpness compared to the original files. For example, {A: "file.psd"-> cultures 4x6inch, 300 dpi-> B: "cropped file.psd} then the results are as described as a first step. What s the problem. (Photoshop CC, windows7)

    I'm a Retoucher of photpfile have used the CS2 version for many years, and fuction 'Harvest' is an important and frequent tree tools myself. The result of the broke lines drive me annoying cause my feeling touch Sofete are all blown away. Please help me.

    I think you're talking about using the crop tool? If you're cropping with a size and resolution that involves interpolation of the image, the crop tool will use your preference for the Interpolation of the Image. By default, bicubic is automatic, which can easily result in a sharp file. Change your preference (in general) to bicubic and you shouldn't see any sharpening.

    I hope it works for your situation.

  • My button mute in my launch buttons fast remains red when the speakers are not dumb.

    I have a Pavilion dv7-3165dx with win 7 Home premium pre-installed, and recently, I noticed that my button mute in the quick launch buttons stopped to change to white when the speakers are reactivated. I tried to install the latest drivers for the buttons to quick launch, which did not work. Someone solved a similar problem (button remained white when cut) by installing something, it calls the Total of HP Advisor and his advice, but I can't find the program.

    IF what I post solves your problem, please, click the button 'Problem solved' on my post.
    Oh, and if I helped you, by clicking on the star of "Congratulations" on my post would not hurt my feelings ether.

    Hello

    Try download and reinstall the IDT Audio driver on the link below.

    FTP://ftp.HP.com/pub/SoftPaq/sp48501-49000/sp48830.exe

    Once installation is complete, restart the computer and see if it has no effect.

    Kind regards

    DP - K

  • MacBook randomly landed volume when the headphones are connected.

    Hey,.

    There is something wrong with my MacBook. When I plug my headphones, the Mac randomly landed the volume at any time. I thought the keyboard can be broken, but it doesn't happen when the headphones are connected so it may be a problem with the software (I think?). Has anyone experienced the same problem? Do you know how to fix this?

    My Mac is the MacBook Pro 15 "retina (mid-2014) running the El Capitan 10.11.6

    Please try resetting the memory NVRAM and SMC.

    Reset the NVRAM/PRAM memory.  http://support.Apple.com/kb/PH18761

    Reset the SMC. Choose the method for "If the battery is good behaviour."

    https://support.Apple.com/en-us/HT201295

Maybe you are looking for