Calling a function from a view

Hello, I have a question:
I create a view, and I need to call a PL/SQL to function. I would like to know if there is some difference between these two variants
CREATE OR REPLACE FORCE VIEW TEST_VIEW
AS
SELECT Package_Name.Function_Name(Some argument)
FROM
...
and
CREATE OR REPLACE FORCE VIEW TEST_VIEW
AS
SELECT (SELECTPackage_Name.Function_Name(Some argument) FROM DUAL)
FROM
...
Thanks for the tips.

Hello

The second version will allow you to take advantage of the query as the caching that can be a significant reduction in the number of calls to your function. If you must call a function in a SQL statement, this would be a way advised to...

XXXX> create or replace package pkg_call_test
  2  AS
  3
  4      procedure p_reset;
  5
  6      function f_call(ain_arg in number) return number;
  7
  8      procedure p_print;
  9
 10  end;
 11  /

Package created.

Elapsed: 00:00:00.23
XXXX> create or replace package body pkg_call_test
  2  AS
  3      pn_ct       number;
  4
  5      procedure p_reset
  6      IS
  7
  8      BEGIN
  9
 10          pn_ct := 0;
 11
 12      END;
 13
 14      function f_call(ain_arg in number) return number
 15      IS
 16      BEGIN
 17
 18          pn_ct := pn_ct + 1;
 19
 20          RETURN ain_arg;
 21
 22      END;
 23
 24      procedure p_print
 25      IS
 26
 27      BEGIN
 28
 29          dbms_output.put_line(pn_ct);
 30
 31      END;
 32
 33  end;
 34  /

Package body created.

Elapsed: 00:00:00.10
XXXX>         CREATE TABLE test_data
  2  (   id  number
  3  )
  4  /

Table created.

Elapsed: 00:00:00.04
XXXX> insert into test_data select mod(rownum,5) from dual connect by level <= 10
  2  /

10 rows created.

Elapsed: 00:00:00.01
XXXX> set serveroutput on
XXXX> exec pkg_call_test.p_reset;

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.01
XXXX>
XXXX> select
  2      pkg_call_test.f_call(id)
  3  from
  4      test_data
  5  /

PKG_CALL_TEST.F_CALL(ID)
------------------------
                       1
                       2
                       3
                       4
                       0
                       1
                       2
                       3
                       4
                       0

10 rows selected.

Elapsed: 00:00:00.15
XXXX>
XXXX> exec pkg_call_test.p_print;
10

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.01
XXXX> exec pkg_call_test.p_reset;

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.00
XXXX>
XXXX> select
  2      (SELECT pkg_call_test.f_call(id) from dual)
  3  from
  4      test_data
  5  /

(SELECTPKG_CALL_TEST.F_CALL(ID)FROMDUAL)
----------------------------------------
                                       1
                                       2
                                       3
                                       4
                                       0
                                       1
                                       2
                                       3
                                       4
                                       0

10 rows selected.

Elapsed: 00:00:00.03
XXXX>
XXXX> exec pkg_call_test.p_print;
5

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.01
XXXX>

Note with the second version, the function is called once for each value in the column id rather than once for each line.

HTH

David

Tags: Database

Similar Questions

  • Call a function from C++ QML

    How to get there? How to call a function QML file c ++.

    I have a list view, and an indicator of activity in the qml and after extraction of xml data from a web service call, I'm unable to fix the datamodel as the XMLDatamodel does not work GroupDataModel works, but to make it work I have to use the data source and I can't set the property type of the DataSoure in c ++

    I'm getting below the code to load the data to GroupDataModel

    dataModel = new GroupDataModel();
    
    DataSource *ds = new DataSource(this);
    ds->setSource(QUrl("file://" + QDir::homePath() + "/model.xml"));
    
    ds->setType(bb::data::DataSourceType::Type.Xml);
    ds->setQuery("/ArrayOfPeople/People");
    

    Hereby, I get Compilation error to

    ds->setType(bb::data::DataSourceType.Xml);
    

    error: wait before create primary expression '.' token

    To work around, I want to load the data source and model of QML function, but this function must be called those the network connection has data extracted and stored in the file.

    Hel me please on this...

    You must give a signal of c ++ and set up a slot in qml connect.

    Example:

    C++

    mQmlDocument->setContextProperty("_myClass", myClass);
    
    emit mySignal()
    

    QML:

    _myClass.mySignal.connect(doSomething);
    
    function doSomething() {
        // logic here
    }
    
  • Calling JavaScript function from c ++

    Hello

    I need to call a function javascript from c++ code. I have a webview in which an html page is opened.

    I can connect to c ++ js using navigator.cascades.postMessage. I have to call vice versa.

    c ++ for js now.

    Concerning

    Hello

    I tried another way of calling JavaScript function continue in every 5 seconds.

    Steps to follow:

    1 import im .js QML file.

    2. create a function in QML and call the java script of QMLfunctuion function.

    3 the signal of the CPP in every 5 seconds and connect this signal to function in QML whare you call java script function.

    4. it indirectly calls the java script function.

    Thank you

    Anand

  • calls to functions from class to class

    How to call a function that is in one class from another class? My first class creates instances of a second class. The second class is emerging. I want it so that if a user clicks an instance of the second class, first class will know which instance of the second class was clicked. I try to use a clickHandler inside the second class that then calls the function (do) in the first class, but I get this error:

    1180: call to a method may not set of doubts.

    Here is a very simplified version of what I have in progress:


    This works! Using a single object to pass parameters is a great way to do it...!

    Thank you!!!

  • Quick answer appreciated - Calling Edge function from an HTML page that is embedded in iFrame in Comp

    It's a delicate issue, but maybe it's just that I do not understand the syntax,

    Location:

    I have a composition of edge animate that acts as an interface and a container in which any content is integrated by using an iFrame.  I have several functions in Stadium > creationComplete, and for one of the embedded content items, I want to include a button that calls a function Edge.

    Challenge:

    I read on SEO elements within edge when it's the Edge file that is embedded in an HTML page, but I can't understand how to reference Edge in the back.

    I tried these options where headerselect (page) is my function:

    AdobeEdge.getComposition("EDGE-531849691").getStage () .headerSelect ("community");

    window.top.Edge.getComposition("EDGE-531849691").getStage () .headerSelect ("community");

    It is a project that is time sensitive.  Your help is greatly appreciated!

    Thank you!

    Fred

    Success!  I thought about it.  I'm a little embarressed.  It was a combination of the two options I listed above:

    window.top.AdobeEdge.getComposition("EDGE-531849691").getStage () .headerSelect ("community");

    So... Nevermind.  But I hope this will help you, too!

    Thank you!

    Fred

  • call a function from a webview actionscript

    In the mobile application that I develop, I need to be able to open a webview that displays a Web site that is saved locally in the app. Then, I need to be able to press a button in the webview and do call a function in the application itself. Is there a way to do this? Can a webview (via javascript or something) call a function in the application? If so, how?

    In JavaScript, set the custom document.location on some channels of URL property. You can use your own URL scheme to pass parameters of JS to AS3, as3 example: / / actions/document/record? overwrite = false. Then in ActionScript, handle the LocationChangeEvent.LOCATION_CHANGING event and examine or decode the URL.

    Call Event.preventDefault () in your AS3 event handler to cancel the navigation and stay on the same page.

  • How to call a function from creationComplete clicking a button?

    Hello

    I wrote a function called getJson (jsonUrl) within the complete creation.  I need where to load the default power json in the carousel.

    However, I also need to be able to call from button clicks, i.e.

    var blogJsonURL = ' http://mywebsite.com/ui_jsonFeeds/blog.aspx?callback=?';

    getJson (blogJsonURL);

    This is so that I can switch between different json stream.

    Any help would be most appreciated.

    Thank you.

    And you should also keep the definition above the function call:

    Thus,.

    var defaultJsonURL = 'http://dev-www5.coj.net/ui_jsonFeeds/coj2/mayorsBlog.aspx?callback=?';

    sym.getJson = function (jsonURL) {...};

    sym.getJson (defaultJsonURL);

    HTH,

    Vivekuma

  • Calling the function from inside a onEnterFrame action

    I have a class file called MonsterGame. Inside her, one of the methods that are called "queueAnim" creates a onEnterFrame function to wait until the current film is play before making the following visible.

    That works fine, but I have certain conditions that the Main() function is called just after a certain movie is played (called "eatMovie"). Everything works except the call to Main();

    I think it's a problem with SEO in the wrong place, but I don't know why.

    The trace for "this should be the root name" returns "MonsterGame", which is the name of the class where the Main() method. So if this ._name returns MonsterGame and MonsterGame has Main() inside, why used Main() or that. Main() run the function?

    PS: It's NOT because I remove the onEnterFrame before calling the Main(), at least I'm sure it's not because I put a trace here, and it works very well, proving that after deleting lines are always executed.

    PM me if you want the link to the source code and swf file

    Try the attached code. If not post a link to a zip with all the files.

  • Calls to functions from loaded SWF files

    I have a Flex application that uses the SWFLoader object to load an external SWF file (which has also been developed in Flex) in a section of the page. The parent SWF file defines several variables and global functions in ActionScript I would use from all SWF files loaded in the SWFLoader. Is it possible in ActionScript to access the functions and variables that are defined in the SWF file the SWF load/child parent? The two SWF files are on the same domain, so there should not be problems of security.

    Peter thank you very much for your answer. I have tried loading in the same ApplicationDomain, but he did not what I expected from him. I, however, found the solution to my problem. I needed to understand how cross-script from a SWF file loaded the loaded SWF file. I discovered how and published a description of my conclusions on another thread that was no longer relevant to my question. The described solution has allowed me to do what I needed without touching the ApplicationDomain.

  • Cannot call the functions from Javascript using ExternalInterface

    Hi all, I use external Interface to call Javascript in an HTML document with an embedded flash object, but I can't call functions in the flash JavaScript object.

    JavaScript:
    function call_actionscript {}
    If (document.getElementById ('flashObj')) {}
    Alert ('object flash found.');
    document.getElementById('flash2').test_from_javascript ();
    }
    }


    ActionScript:

    package {}
    import flash.display.MovieClip;
    to import flash.external.ExternalInterface;
    import flash.events.Event;

    SerializableAttribute public class extends MovieClip {} FlashObj
    public void FlashObj() {}
    ExternalInterface.addCallback("IsStatic",IsStatic) ('test_from_javascript', test_from_javascript)
    }

    public void test_from_javascript(e:Event):void {}
    ExternalInterface.call("saveglobalscore",score) ("alert", "javascript test received in actionscript!")
    }
    }
    }

    Call the "call_actionscript()" javascript function produces no result. Call Test_from_javascript() manually to code Actionscript product alert "javascript test has received in actionscript!" without problem. So the ExternalInterface.call("saveglobalscore",score) method works fine, but the the ExternalInterface.addCallback("IsStatic",IsStatic) doesn't seem to work at all. What I'm missing here?

    Try to change/add the JS in your HTML code to the following.

    TS

  • How to call a function from another script.

    Hallo

    TypeError: Error #1009: cannot access a property or method of a null object reference.
    next / NEXT)

    and here is my script.

    Main.As

    package
    {
    import flash.display.MovieClip;
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;

    import flash.events.Event;
    import flash.events.EventDispatcher;
    import flash.events.MouseEvent;
    import flash.net.URLRequest;
    import flash.net.URLLoader;


    SerializableAttribute public class Main extends MovieClip
    {
    public void Main()
    {
    trace ("Startup");
    }

    public void PRINT (): void
    {

    trace ('work');

    }
    }
    }


    Next.As

    package
    {
    import flash.display.MovieClip;
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;

    import flash.events.Event;
    import flash.events.EventDispatcher;
    import flash.events.MouseEvent;
    import flash.net.URLRequest;
    import flash.net.URLLoader;


    SerializableAttribute public class then extends MovieClip
    {

    private var _main:Main;

    public function Next()
    {
    NEXT_INT();
    }


    private void NEXT_INT (): void
    {

    mc.buttonMode = true;
    mc.addEventListener (MouseEvent.MOUSE_DOWN, NEXT_PRINT, false, 0, true);
    }

    private void NEXT_PRINT(e:MouseEvent):void
    {
    _main. PRINT();
    }

    }

    }

    http://noLabel.pl/QuickTest.rar

    http://noLabel.pl/QuickTest.zip

    Try this. I can't compile your application in case of location (names of variables with national characters). Here you have a quick example: we have two symbols in the library buttonMC and playerMC related to clssses Player and button. There handleClick (click event handler) method in the Button class, who do the work for you.

    concerning

    JK

  • Call the function in LabView from a DLL, and then access the global variable of DLL

    I've created a DLL in LabWindows with a function and structure.  I want to call the function from LabView and then access the overall structure.  I am able to call the function in the DLL with a "call library function node" and has access to the return value, but I can't understand how to access the overall structure.  The structure is declared in the header DLL with __declspec (dllimport) struct parameters file.

    Is it possible to access this structure without using the library of network variables?

    My guess is that you need two bytes of padding after "in_out" and another to two bytes of padding after "anin."  The reason being that ints are 4 bytes, and most of them C compilers will align on 4-byte boundaries.  The struct will naturally start to such a limit (in fact, in Windows, it will probably start to an 8 byte boundary).  If you then count bytes in your structure, you are 70 byte after "in_out."  70 is not divisible by 4, so you need 2 bytes more to reach the next 4 byte boundary.  You can also you could reorganize your struct so that "anin" follows "in_out" and this is probably the best option if it won't cause you other problems.

    Unlike most C compilers, LabVIEW compressed structures as closely as possible, without filling.  I don't know enough about the history of LabVIEW and internal parts to explain the reasons and to do this performance penalty, but, as choice of LabVIEW "endianness", it is probably a remnant of the first versions of LabVIEW that were running on the Mac.

    If for some reason you want to force your C struct to match package LabVIEW, you can use the #pragma pack (x) directive, but I wouldn't recommend that here because you can control the C and LabVIEW.

    EDIT: in the cases where it was not clear, add padding to your cluster of LabVIEW, insert appropriate size or items at the place desired in the cluster.

  • Option buttons fail to call a function... why?

    Hi all

    I'm working on a complex form that will require a lot of fields, show/hide, based on user input. I am trying to automate the behavior of a JavaScript function that is placed at the level of the parent form. In fact I already have a few features out there, and they work great. This one is a mystery. If the two functions and function calls are placed in the same object (Group of radio buttons) everything works perfectly. At the point where I have to move the function to my parent form script oppose nothing works. Any ideas what I'm missing?

    Thank you

    Raquel

    XMP. #variables [0] ApplicantForm .toggleOptComment.


    // Hide/Show fields based on field name prefix (substring)
    // sectionName = parent subform to hide/show fields (search range)
    // endPosition = integer, position of last character to be searched in field name (initial position is always zero)
    // prefixString = substring to find in field name
    // presenceValue = "visible" or "hidden"
    
    function toggleFields(sectionName,endPosition,prefixString,presenceValue) {
    
            var oFields = sectionName.nodes;
            var nNodesLength = oFields.length;
      
            for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) {
                if (oFields.item(nNodeCount).name.substring(0,endPosition) == prefixString) {
                    oFields.item(nNodeCount).presence = presenceValue;
            }
        }
    }
    


    XMP. ApplicantForm.S9.S9 - Radio: Exchange - (JavaScript, client)


    /* Submit Section 9.1 */
    if (this.rawValue == "Yes") {
        // Show these:
        toggleFields(this.parent,2,"S9","visible");
        // Hide these:
        toggleFields(this.parent,4,"S9_2","hidden");
        }
    /* Submit Section 9.1 */
    if (this.rawValue == "No") {
        // Show these:
        toggleFields(this.parent,4,"S9_2","visible");
        // Hide these:
        toggleFields(this.parent,2,"S9","hidden");
        }
    

    Hello

    to call a function from a Script object, you must reference the object itself to access its functions...

    So to be able to call toggleFields from any object in the form of a Script object, you need to call it this way:

    toggleOptComment.toggleFields (this.parent, 2, "S9","hidden" ");

    I hope this helps!

  • Calling a function in the apex region

    Hello
    I want to call a function from a package in the region of Apex report, but he used to analysis
    I tested in sql dev successfully

    code example goes like this...

    SELECT DISTINCT SOR_OFFENDER. FIRST_NAME. » ' ||
    SOR_OFFENDER. MIDDLE_NAME | ' ' ||
    SOR_OFFENDER. Last_name like "Name",
    SOR_OFFENDER_DETAILS.get_offlu_url(:p216_detail) - package where the function is defined
    OF SOR_OFFENDER.
    SOR_LOCATION
    WHERE SOR_OFFENDER. OFFENDER_ID = SOR_LOCATION. OFFENDER_ID
    AND: p216_detail = SOR_LOCATION. OFFENDER_ID




    any idea/help

    Published by: Red_Bull on 8 August 2012 15:02

    I agree. Until and unless it is absolutely necessary avoid calling function in a select statement because it will degrade your performance of applications over a period of time.
    As far as I know if the query is run in SQLDeveloper, it should also work in the APEX.
    I see a syntax problem in your query. Try this.

    SELECT DISTINCT SOR_OFFENDER. FIRST_NAME. » ' ||
    SOR_OFFENDER. MIDDLE_NAME | ' ' ||
    SOR_OFFENDER. Last_name like "Name",
    SOR_OFFENDER_DETAILS.get_offlu_url(:p216_detail) url,
    OF SOR_OFFENDER.
    SOR_LOCATION
    WHERE SOR_OFFENDER. OFFENDER_ID = SOR_LOCATION. OFFENDER_ID
    AND: p216_detail = SOR_LOCATION. OFFENDER_ID

    Thank you
    Mehabub

  • Calling a function within a symbol?

    Hello

    I am one of these flash devs who try to get edge animate to do what I usually do in Flash, so I could do this the wrong way, but I have a symbol with an "inner" function on my scene, and I want to call this function from the scene.

    I tried to use () .getStage () sym.getComposition ().getSymbol("symbolName").functionName; but it does not work.

    I have no problem handling the symbol itself by calling the . play() or . hide() so I know the path work... someone can show me the proper syntax to call a function within a symbol?

    THX in advance

    Hi Abnesher,

    An important principle to grasp is that symbols (and the stadium is one of them) is located in parallel, despite instances of different symbols, nested one inside the other (and all ultimately nested in the scene).

    The consequence is that from the inside of your nested symbol, you have no direct visibility of the function defined inside the step symbol!

    Inside of the symbol of the step , in the document.compositionReady event handler:

    sym.yourGlobalFunction = function (firstParameter)

    {

    your stuff

    }

    Inside another symbol, in one of its event handlers:

    sym.getComposition () .getStage () .yourGlobalFunction (5);

    Gil

Maybe you are looking for