How to execute a function periodically

Hi ,
I have been working on a multithreaded application where i require that a function is called
periodically after every 10 seconds.
Please suggest.
Thanks

There is no standard way of doing that in C++, you'll have to use some library function. What's your platform?

Similar Messages

  • How to execute a function with date parameter as an input?

    HI
    I have a function named fun1(v_fun in date), with date as an input parameter and it returns a number. I have created the function successfully. But i couldnt execute this function in sqlplus. How to pass the dates? Can any one help me in this regard.

    Hi,
    V11081985 wrote:
    HI
    I have a function named fun1(v_fun in date), with date as an input parameter and it returns a number. I have created the function successfully. But i couldnt execute this function in sqlplus. It's hard for me to say what you're doing wrong when I don't know what you're doing. Post a complete test script that people can run to re-create the problem and test their ideas. Include a function definition, CREATE TABLE and INSERT statements for any of your own tables (if necessary), and the results you want to get from that data, as well as your query.
    How to pass the dates? Can any one help me in this regard.You can call the function like this:
    SELECT  fun1 (hiredate)  AS fun1_results
    FROM    scott.emp
    ;

  • How to execute a function module?

    I am new to SAP and I need to execute a function module, per OSS Note 894279.
    It says I need to run a function module with a certian parameter.  Well I see how I can modify function modules in SE37 or SE80, but how do I run/execute them?
    I am sure this is something simple that I am not aware of.  Thanks.

    Hi,
    Go to SE37--> Give the FM name --> press F8 --> Give the values for Import parameters --> Press F8 or exection button on application tool bar.
    Thanks,
    Sri.

  • How to execute a function and return the result into a bind variable

    Hi,
    I am trying to calculate the sum of salaries of all persons with a particular JOB_ID using a function TOTAL_INCOME(v_job_id).
    create or replace function total_income
    +(v_job_id IN varchar2)+
    RETURN number IS
    v_total number(6);
    cursor get_sal is
    select salary from employees
    where job_id = v_job_id;
    BEGIN
    v_total := 0;
    for emp in get_sal
    loop
    v_total := v_total emp.salary;+
    end loop;
    dbms_output.put_line('Total salary of '||v_job_id||' is: '|| v_total);
    return v_total;
    END;
    Now I woud like to execute this function and assign the returned value into a bind variable test_sal
    variable test_sal number(6)
    SELECT total_income('AD_VP') into :test_sal FROM DUAL;
    dbms_output.put_line('Total Sal:'||:test_sal);
    This is returning the below errors:
    SELECT total_income('AD_VP') into :test_sal FROM DUAL
    *+
    Error at line 0
    ORA-01036: illegal variable name/number
    dbms_output.put_line('Total Sal:'||:test_sal);
    Error at line 3
    ORA-00900: invalid SQL statement
    Could someone help me what could be the problem?? Thanks for your time...

    Dear,
    If everything you will do will be done inside PL/SQL (stored procedure or stored function) then you don't have to care about bind variable.
    When using PL/SQL (static SQL) you will never encounter issues related to bind variables. PL/SQL itself takes care of your code and uses bind variables behind the scene.
    The only situation where you have to look carefully to the use of bind variables within PL/SQL is when you use Dynamic sql into stored procedures or functions.
    So, see in the light of the above comment, if you have to care about returning your function into a bind variable?
    Best regards
    Mohamed Houri

  • How to execute a function returning type in oracle

    hi
    i want to execute a function which is returning table from oracle prompt.
    i have created type in order to return table from function.
    /*creating type
    CREATE OR REPLACE TYPE U_VOC.t_in_list_tab AS OBJECT (i_group NUMBER ,
                                  i_company number,
                                  i_estab number
    NOT FINAL ;
    CREATE OR REPLACE TYPE U_VOC.t_in_list_tab_type
    AS TABLE OF U_VOC.t_in_list_tab;
    /*function */
    CREATE OR REPLACE FUNCTION FU_VOC_S_VEHICLES(pi_group number,
                                                      pi_company number,
                                                 pi_estab number
         RETURN t_in_list_tab
    AS
    v_nb_idvehicle           U_REF.V_REF_VEHICLES.NB_IDVEHICLE%type ;
    v_vc_reference           U_REF.V_REF_VEHICLES.VC_REFERENCE%type ;
    v_vc_licenceplate      U_REF.V_REF_VEHICLES.VC_LICENCEPLATE%type ;
    l_tab t_in_list_tab := t_in_list_tab( pi_group ,pi_company, pi_estab );
    BEGIN
              SELECT      V_REF_VEHICLES.NB_IDVEHICLE,
                   V_REF_VEHICLES.VC_REFERENCE,
                   V_REF_VEHICLES.VC_LICENCEPLATE
              INTO      V_NB_IDVEHICLE,
                   V_VC_REFERENCE,
                   V_VC_LICENCEPLATE
              FROM      U_REF.V_REF_VEHICLES
              WHERE      V_REF_VEHICLES.NB_IDGROUP = pi_group
              AND      V_REF_VEHICLES.NB_IDCOMPANY = pi_company
              AND      V_REF_VEHICLES.NB_ESTABL = pi_estab;
    RETURN l_tab;
    END;
    please help
    Thank in advance
    Sandy

    Sandy,
    I have a series of examples on this issue in my demo application. See this one:
    http://htmldb.oracle.com/pls/otn/f?p=31517:146
    You will basicaly need to write it like this:
    CREATE OR REPLACE TYPE u_voc.t_in_list_tab AS OBJECT (
       i_group     NUMBER,
       i_company   NUMBER,
       i_estab     NUMBER
    CREATE OR REPLACE TYPE u_voc.t_in_list_tab_type AS TABLE OF u_voc.t_in_list_tab;
    CREATE OR REPLACE FUNCTION fu_voc_s_vehicles (
       pi_group     NUMBER,
       pi_company   NUMBER,
       pi_estab     NUMBER
       RETURN t_in_list_tab PIPELINED
    AS
       l_tab   t_in_list_tab := t_in_list_tab (NULL, NULL, NULL);
    BEGIN
       FOR c IN (SELECT v_ref_vehicles.nb_idvehicle, v_ref_vehicles.vc_reference,
                        v_ref_vehicles.vc_licenceplate
                   FROM u_ref.v_ref_vehicles
                  WHERE v_ref_vehicles.nb_idgroup = pi_group
                    AND v_ref_vehicles.nb_idcompany = pi_company
                    AND v_ref_vehicles.nb_establ = pi_estab)
       LOOP
          l_tab.i_group := c.nb_idvehicle;
          l_tab.i_company_number := c.vc_reference;
          l_tab.estab_number := vc_licenceplate;
       END LOOP;
       RETURN l_tab;
    END;
    SELECT *
      FROM TABLE (fu_voc_s_vehicles (value1, value2, value3))But looking at your code, your function will return only one record.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/apex/f?p=107:7
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • How to execute the functionality of button at a time of pressing if function is in continuous loop?

    Hello,
    I am facing one basic problem that how can I execute the button which I have used in my vi at a time of pressing means in my vi I have used 4 button 1. Start 2. OK 3. Save and 4. Stop button
    when user press start button then continuous loop will be executed and after pressing OK it will stop that loop and waiting for next instruction from user whether he want to do reading operation again or he want to save or he want to stop.
    The thing is when I press start button then while loop is execute then its not possible to press stop button or save button, user need to wait until OK button is pressed.
    Will you please guide me how can I do so that when ever user press any button that button is executed at time.
    Thank you very much once again.
    Attachments:
    voltageforcecapacitance without instrument.vi ‏40 KB

    Hi Ankit,
    There are some issue in your code mention below please have a look and correct these will work fine for your requirement.
    1. Save button Boolean value pass to the lower wheel conditional loop means if you press save your bottom loop will stop working this is not the code requirement you have to continue loop and tigger start event in last using value tigger event property to tigger again start event.
           This step will reset your loop and start from zero.
    2. According to me I think both loop should stop only in stop condition so you can remove stop function from upper loop and pass the button value in both loop directly to wheel loop condition terminal.
           Upper loop direct and lower both loop local variable.
    3. Why you want to stop your upper loop on any error condition, you should Handel the errors and keep running the code.
    4. What is the use of queue no case related with dequeue in bottom loop.
    5. Wheel loop in a event is not  good practice so you can use your queue structure here to run continuous lower code.
    I hope these changes can improve your code.
    Thanks and Regards
    Himanshu Goyal | LabVIEW Engineer- Power System Automation
    Values that steer us ahead: Passion | Innovation | Ambition | Diligence | Teamwork
    It Only gets BETTER!!!

  • How to execute NIDAQ functions

    From LabVIEW, how do I tell if my SCXI chassis is powered / turned on?
    The knowledge base of NI site speaks about a NI-DAQ function called
    SCXI_ModuleID_Read, but there seems not to be any VI calling this
    function.
    How can I execute it?
    Thanks,

    See:
    http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B45EACE3DD1356A4E034080020E74861&p_node=DZ52434&p_source=external
    2006 Ultimate LabVIEW G-eek.

  • How to execute callback functions progamatically

    Title says it all.
    I want to execute a callback for a Command Button programatically. How is this possible?
    Solved!
    Go to Solution.

    Wolfgang answer is the most direct and indeed it works. Nevertheless, there can be different approaches that has been discussed severl times in this board. I can point you to this discussion and this one that offers alternatives to direct calling of the function.
    Additionally, as a minor correction to Wolfgang's words, please note both in direct callback calling and if using CallCtrlCallback () you must pass the panel handle to the function, not the panel ID.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • How to execute javascript function then Code Behind in an ASP Button

    Hi Guys,
    I am currently working in a web application. I have a problem with calling a js function and codebehind.
    I have this asp button that when clicked, a javascript function should be called.
    My javascript function is like this:
    function Calculate(){
    // Set Route in google map
    // Store distance, lat/long in an array
    Then, after the Calculate function was executed, it should execute the code behind:
    protected void btn_calculate_onclick(object sender, EventArgs e)
    // Pull data stored in the array created by javascript
    // connect to db
    // store data
    But the javascript function doesn't execute.
    What should i do?
    Thanks in advance

    Hello,
       javascript function can not executed in server side, you can tranlate javascription fuction to c# function.
     if the reply help you mark it as your answer.
     Free
    Managed .NET
    Word Component(Create,
    Modify, Convert & Print)

  • How to execute a function module after a SAP_END_OF_JOB event ?

    Hello,
    I would like to execute a specifique function when a job is finished/aborted
    In SM62 I can use the SAP_END_OF_JOB event to execute a job, an exernal command or an external program (in SM36).
    But I wand to execcute a funtion.
    An idea ?
    Thank you.

    >
    Ferhati Ramdane wrote:
    > May be I have to make a standard modificatication in the program that intercepts this event, to insert my own function.
    > I don't know which one is and I don't like to do that.
    Intercepting the event SAP_END_OF_JOB doesn't help for your goal. This event  is only raised if a job is scheduled with the "after job XYZ" start condition. This means: The event SAP_END_OF_JOB will NOT be raised for jobs with start condition = at time hh:mm:ss. And there is no other event which is raised at the end of jobs with start condition = at time hh:mm:ss.
    Thus I think your goal is not feasible with the R/3 job scheduler. Perhaps you should consider purchasing an external scheduler from a third party company. But I don't know if there is something suitable for your goal on the market.

  • How to execute created function in query wizard or query generator

    Hi to all
    i create a function in sql and i want to use this in a query wizard or query generator, I tried to include this function in my query to create a report . but i im receiving a error saying 'invalid build function',
    running the query with the created function in sql server produce the expected result..
    I would like to know if is possible to used this created function in the query wizard or function?
    thanks
    Loren

    Hi Owen
    Thank you for your reply
    The function falls on scalar valued function , Here is my code
      start of code -
    USE [gk]
    GO
    /****** Object:  UserDefinedFunction [dbo].[SalesForThisDate]    Script Date: 01/19/2009 12:42:24 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER  FUNCTION [dbo].[SalesForThisDate]
    (     @vItemCode nvarchar(20),
        @FrmDate DateTime,
         @ToDate  DateTime
    Returns Real
    AS
    BEGIN
      RETURN (SELECT ISNULL(SUM(T1.[Quantity]),0)
         FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
         WHERE T0.[DocDate] Between @FrmDate and @ToDate
              and t1.[ItemCode]=@vItemCode
         GROUP BY  T1.[ItemCode])
    END
      end of code -
    then i tried to run this function on the query manager with this statement
    SELECT T1.[ItemCode],
         ISNULL(dbo.SalesForThisDate(T1.[ItemCode],'2008-10-1','2008-10-8'),0) Value1,
         ISNULL(dbo.SalesForThisDate(T1.[ItemCode],'2008-11-1','2008-11-8'),0) Value2,
         ISNULL(dbo.SalesForThisDate(T1.[ItemCode],'2008-12-1','2008-12-8'),0) Value3,
         ISNULL(dbo.SalesForThisDate(T1.[ItemCode],'2009-1-1','2009-1-8'),0) Value4
    FROM OITM T1
    ORDER BY T1.[ItemCode]
    executing this statements pop a error
    "SalesForThisDate is not recognized build-in function name"
    Thanks
    Loren

  • How to execute a function in oracle plsql object, when object dies

    I have a plsql object with a member function as exec_last.
    I want this procedure to be called when plsql object is cleaned or when the session hosting this object dies.
    In C, we have a system call as atexit(). Is there any such feature in Oracle 10g or any workaround using embedded java.
    This feature is required to flush the contents stored in plsql table in the object to the database, when program exits.
    Thank you,
    Warm Regards,
    Navin Srivastava

    navsriva wrote:
    Is there any better way to implement this in memory caching. What is the buffer cache of Oracle? It is exactly that - a memory cache for data blocks. Both new blocks (created by inserting new rows) and existing blocks (used by selects, updates and deletes, and re-used (freespace) by inserts).
    The Oracle buffer cache is a very mature and sophisticated cache. Attempting to do it "+better+" than the db buffer cache in another software layer (like PL/SQL) is mostly a waste of time and resources.. and invariable introduces another s/w layer that simply increases the number of moving parts. This in turn usually means increased complexity and slower performance.
    Why use bulk processing in PL/SQL? The basic and fundamental answer to that is to decrease the context switching between the PL engine and SQL engine.
    When running PL code to insert data into SQL, that data needs to be passed to the SQL engine, the PL engine needs to perform a context switch to the SQL engine to allow it to process that data and perform the SQL instruction.
    If there are a 1000 rows to inserts, it means a 1000 context switches.
    Bulk processing makes the "+communication/data pipe+" between the two bigger. Instead of passing a single row's data to the SQL engine via a context switch, a bulk collection/array of a 100 rows is passed. There is now a mere 10 context switches required to push that 1000 rows from the PL engine to the SQL engine.
    You can do the same from any other SQL client... (remember, that PL itself is also a SQL client). You can, using C/C++ for example, do the exact same thing. When passing row data to the SQL engine to insert, pass a collection of a 100 rows instead of the data for a single row.
    The exact same benefits result as in PL/SQL. A bigger communication pipe, allowing more data to be transferred to/from the SQL engine, resulting in less context switching.
    Of course, a context switch ito C/C++ is a lot more expensive than in PL/SQL - as the PL engine sits in the very same physical process as the SQL engine. Using C/C++, this will usually be a separate process communicating with the SQL engine process across the network.
    The same applies to other languages, like Java, C#, Delphi, Visual Basic and so on.
    It does not make sense to introduce another s/w layer, the PL/SQL engine, and have the client "+insert+" rows into its memory structures... and then use the PL engine to "+flush"+ that to the SQL engine via a bulk process command.
    It will be faster, and more scalable, having the client language using bulk processing directly and dealing with the SQL engine directly.
    Simple example. What does the SQL*Loader program (written in C) use? It does not use PL as a proxy for moving data from a CSV file into a SQL table. It calls SQL directly. It uses bulk processing. It is very fast at loading data.
    There is an exception to this. When PL is used as a business processing and validation layer. Instead of the client code implementing that logic, it is done using PL. The client then no longer will manually add an invoice to the INVOICES table for example. It instead calls the AddNewInvoice PL/SQL procedure - and this procedure does all. It checks the customer code as valid. Ensures that there's stock available of the products being ordered on the invoice. Etc.
    But in this scenario, PL is not used a secondhand "buffer cache". It is used for what it has been designed for - a proper application layer inside the database.

  • How to execute a command periodically?

    hi
    well it may seems so silly to ask such question ,but i am a beginner.
    I want to execute a command ,i mean printing some text every five minutes without any loop.I mean using some kind of interrupt or so.So my processor has got time to do other jobs.
    I would be glad if anybody could give me a clue,so i know where to start from.
    BRs
    saeed
    Edited by: zaec on Oct 27, 2008 1:54 AM

    But I have got another problem ,suppose I have got 3 different threads which are going to be done as follow:
    thread one-----every 5 seconds
    thread two-----every 7 seconds
    thread three--every 10 seconds
    Now ,if thread one,as an example,take more than 10 secondsand by now thread 2 has passed its 7 second what happens.does thread 1 stops at its 7 seconds and thread 2 starts,or thread 1 doesnot give the control to anyother thread till it is finished.By the way i use sleep() method to give the control to other threads.
    sleep looks like a good way to ensure that other threads get a chance to execute.
    As for what happens to concurrent threads when a particular thread is running -- as far as I understand, Java machine specification does not mandate strict "rules of the game" here. I wouldn't be surprised if things differ on different devices.
    More details on multi threading in Java are available in 9-part series of articles in Java World: *"Programming Java threads in the real world"*. You can find these articles with search at Java World site: [click here for search results|http://www.javaworld.com/ifind/java/query.html?col=java&qt=Programming+Java+threads+in+the+real+world]

  • How to execute LXE_COMMON_XSTRING_TO_STRNGTAB function module ?

    HI,Experts,
    the data in output table is unformate please sugesst me on passing the values for codepage parametes of the below fm.
    CALL FUNCTION 'LXE_COMMON_XSTRING_TO_STRNGTAB'
      EXPORTING
        IN_XSTRING            = I_CONTENT
      TEXTKEY               = ''
        IN_CODEPAGE           = 4100 -
    >
        EX_CODEPAGE           = 4120----
    >
       DROP_EMPTY_LINE       = 'X'
    IMPORTING
       EX_TAB                = it_table
      PSTATUS               =
    thanks in advance

    Hi Which version of SAP are you using?

  • How to execute function takes user defined type parameters as input &output

    Hi All,
    I want to execute a function which takes user defined type as input & output parameters. But i don't know how to execute that function in pl/sql statements.
    CREATE TYPE T_INPUT AS OBJECT
    USER          VARCHAR2(255),
    APPLICATION     VARCHAR2(255),
    REFERENCE          VARCHAR2(30)
    ) NOT FINAL;
    CREATE TYPE T_ID UNDER T_INPUT
    E_ID                    VARCHAR2 (50),
    CODE                    VARCHAR2 (3),
    SERVICE                    VARCHAR2 (10),
    C_TYPE                    VARCHAR2 (1)
    ) NOT FINAL;
    CREATE TYPE T_OUTPUT AS OBJECT
         R_STATUS               NUMBER(10),
         E_DESC_LANG_1          VARCHAR2(1000),
         E_DESC_LANG_2          VARCHAR2(1000),
         A_REFERENCE          VARCHAR2(30)
    ) NOT FINAL;
    CREATE TYPE T_INFO UNDER T_OUTPUT
    E_INFO XMLTYPE
    CREATE FUNCTION Get_Dtls
    I_DETAILS IN T_ID,
    O_DETAILS OUT T_INFO
    RETURN NUMBER AS
    END;
    Here
    1. T_ID is an input parameter which is a combination of T_ID + T_INPUT,
    2. T_INFO is an output parameter which is a combination of T_INFO + T_OUTPUT.
    Here i'll assign the T_ID values.
    --- T_INPUT values
    USER          = "admin";
    APPLICATION     = "test";
    REFERENCE     = "null";
    ---- T_ID values
    E_ID               = "1234";
    CODE               = "TTT";
    SERVICE               = "NEW";
    C_TYPE = "P";
    Now i want to execute Get_Dtls function with T_ID,T_INFO parameters in pl/sql statements.
    I want to catch the E_INFO value from T_INFO type.
    How can i Do this ?
    Pls Help. Thanxs in advance.
    Anil.

    I am very new to this. New to Oracle, PL/SQL, OO programming or testing?
    set serveroutput on
    declare
      tst_obj ctype;
    begin
      tst_obj := pkg.proc(11);
      dbms_output.put_line('id='||tst_obj.id||'::code='||tst_obj.code||'::usage='||tst_obj.usage);
    end;
    /Generally I disapprove of the use of DBMS_OUTPUT (for just about anything) but it is sufficient to demonstrate the basic principle.
    Really you should start using proper testing practices, ideally with an automated test harness like QUTE.
    Cheers, APC
    Blog : http://radiofreetooting.blogspot.com/

Maybe you are looking for

  • I have been really messed up and defrauded by your employee. I have the email proof through this site, besides witness's.

    I have a record of my email and post regarding my problems with Internet Explorer 11, with my Windows 7, not working and connecting to other sites not nearly working as well as Int. Explorer 10. I was just told by support since I didn't have a case n

  • Minimum price of a material

    16.10.2007 Hi friends, Other than PMIN is there any other way by which I can enter  the minimum price of a material and check the same while creating sales documents. Regards, Udaynath.

  • Planning data sources configuration error

    Hi, We have installed epm 11. Within workspace there is the option to manage planning data sources. When this is run a couple of error messages appeared saying the awb database is not running another about the configuration not being correct. All the

  • DDConverter cant convert

    Hi When I try to deploy my existing 8.1 WARs/EARs onto 9.0 i get validation errors during deployment which basically say that I cant have <description> element within a <context-param> element in web.xml I am trying to convert all web.xml DDs using t

  • Cisco XML Obj/command for doing nothing?

    Hello there! I was wondering if I can write a cisco XML obj to instruct the phone do nothing? I'm pushing a XML page to the phone, if certain condition holds, the phone will display an image, otherwise it should do/show nothing. How can I do that? wh