Programmatically trigger cursor output?

Hello

I use the framework of the actor to develop a large application in LabVIEW. I have the sliders on a graph that trigger data be filled by actors using a structure of the event and a cursor output event. The data are also met (initialized) when the program starts.

I currently do this initialization using a structure below and a change event of value on the "Init": Boolean

also described here:

http://forums.NI.com/T5/LabVIEW-idea-exchange/add-first-run-event-on-event-structure/IDC-p/1044975#M...

The problem with the help of the 'init' Boolean is that I duplicate the same code in two events: "init": value change and "graph": output cursor events (the event two do exactly the same thing).  Does anyone know how slick combine these the Init event with cursor output event so that the cursor output event fires start? That way I wouldn't have to duplicate my code in two places...

I've searched and have not found exactly what I needed, sorry if this has been covered somewhere in the forum.

Taking place your common code? In case the Structure? Could register just for two events:

Or to register for the event separately to send it to the nested actor:

Tags: NI Software

Similar Questions

  • trigger digital output myrio

    Hello friends,

    I have a question. I need to trigger an output of Myrio with a single pulse. After the pulse, the output will remain active. Then with another single pulse, the output will be switched off. Should what tool I use?

    Thanks for listening,

    Kind regards

    David

    Hi Davi08,

    I did a little research for you answer and I found another "NI Discussion forums" forum that maybe can help you.
    Try using this link, I think this will help you.

    http://forums.NI.com/T5/academic-hardware-products-Elvis/myRIO-digital-trigger/TD-p/3278560

    Best regards

  • Programmatically trigger itemClick event?

    Is it possible to programmatically trigger the itemClick on a component event?

    I would like to do on a TabedButtonBar control to initialize the selected view in the viewstack on first load (as the first element of the TBB is still selected).

    How can this be achieved?

    Thank you!

    Hmm, try:

    Import mx.events.ItemClickEvent;

    var click: ItemClickEvent = new ItemClickEvent (ItemClickEvent.ITEM_CLICK);

    Click.index = 0; the index of the tab that you want to

    buttonBar.dispatchEvent (click);

    Who doesn't get better?

    Ben Edwards

  • How to call a stored procedure with a REF CURSOR output parameter

    I'm looking forward to example calling a function/stored procedure with a REF CURSOR output parameter and get the result.
    In other words, I have a stored function/procedure that runs a SELECT statement using the OCI library and then he could get the values of each row and each column.

    I put a code snippet, it have only the main thing to call a simple stored procedure and to print the name of each column of the cursor, but I couldn t to print out values in the table that calls the stored procedure.
    I understand that the next step is to call an OCIStmtFetch.
    How to associate the slider with the OCIStmtFetch?

    If you need more information, just tell me.

    I use ANSI C with HP - UX (HP - UX C) operating system and Oracle 10 g.


    Kind regards.

    Antonio Garcia


    / * callOracleSP * /.

    #include < stdio.h >
    #include < string.h >
    #include < oci.h >
    #include < stdlib.h > to

    char * pConnectChar = "Server";
    char * pUsernameChar = "user";
    char * pPasswordChar = "passwd";
    char * sqlCharArray1 = "BEGIN SP_GETCITIES (:,: c); END; « ;
    int retval;
    UB4 parmcnt = 0;
    UB4 pos2 = 0;
    text * pcoln [20];
    UB4 namelen [20];
    char state_key [5];

    OCIStmt * pOciStatement;
    OCIStmt * pOciStatCursor;
    OCIError * pOciError;
    OCIEnv * pOciEnviron;
    OCIServer * pOciServer;
    OCISession * pOciSession;
    OCISvcCtx * pOciServiceContext;
    OCIBind * pOciBind [500];
    OCIParam * pOciParam;


    int main()
    {
    retval = OCIEnvCreate (& pOciEnviron, OCI_DEFAULT, NULL, NULL, NULL, NULL, 0, NULL);
    retval = OCIEnvInit (& pOciEnviron, OCI_DEFAULT, 0, NULL);
    retval = OCIHandleAlloc (pOciEnviron, (void *) & pOciError, OCI_HTYPE_ERROR, 0, NULL);
    retval = OCIHandleAlloc (pOciEnviron, (void *) & pOciServiceContext, OCI_HTYPE_SVCCTX, 0, NULL);
    retval = OCIHandleAlloc (pOciEnviron, (void *) & pOciStatement, OCI_HTYPE_STMT, 0, NULL);

    retval = OCILogon (pOciEnviron, pOciError, & pOciServiceContext,(unsigned char *) pUsernameChar,
    strlen (pUsernameChar), (unsigned char *) pPasswordChar, strlen (pPasswordChar).
    (unsigned char *) pConnectChar, strlen (pConnectChar));
    printf ("retval=%d\n",retval OCILogon);

    retval = OCIStmtPrepare (pOciStatement, pOciError, (unsigned char *) sqlCharArray1, strlen (sqlCharArray1),)
    OCI_NTV_SYNTAX, OCI_DEFAULT);
    printf ("StmtPrepare retval=%d\n",retval);

    retval = OCIHandleAlloc (pOciEnviron, (void *) & pOciStatCursor, OCI_HTYPE_STMT, 0, NULL);
    retval = 1 OCIBindByPos(pOciStatement,&pOciBind[0], pOciError, (ub4), (void *) & state_key,)
    ((sb4) sizeof (state_key), SQLT_STR, (void *) 0, (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT (ub4));
    printf ("BindByPos OCI_HTYPE_STMT retval=%d\n",retval);

    retval = OCIBindByPos(pOciStatement,&pOciBind[1], pOciError, (ub4) 2, (void *) & pOciStatCursor,)
    ((sb4) 0, SQLT_RSET, (void *) 0, (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT (ub4));
    printf ("BindByPos OCI_HTYPE_STMT retval=%d\n",retval);

    strcpy (state_key, 'ca');

    retval = OCIStmtExecute (pOciServiceContext, pOciStatement, pOciError, (ub4) 1, (ub4) 0,)
    (OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_DEFAULT (ub4));
    printf ("StmtExecute retval=%d\n",retval);

    / * How to get the values of the cursor? */

    / * Number of parameters of the cursor * /.
    OCIAttrGet ((void *) pOciStatCursor, OCI_HTYPE_STMT (ub4), (void *) & parmcnt,(ub4 *) 0,)
    (ub4) (OCI_ATTR_PARAM_COUNT, pOciError);
    printf ("\nNumber of the slider settings = %d\n",parmcnt);

    for (int pos = 1; pos < = (int) parmcnt; pos ++)
    {
    OCIAttrGet ((void *) pOciStatCursor, OCI_HTYPE_STMT (ub4), (void *) & pos2,(ub4 *) 0,)
    (ub4) (OCI_ATTR_CURRENT_POSITION, pOciError);
    retval = OCIParamGet ((void *) pOciStatCursor, OCI_HTYPE_STMT (ub4), pOciError, (void *) & pOciParam,)
    POS (ub4));
    OCIAttrGet pOciParam, (ub4) ((void*) OCI_DTYPE_PARAM,(void*) & pcoln [pos - 1],(ub4 *) & namelen [pos-1],)
    (ub4) OCI_ATTR_NAME,(OCIError *) pOciError);
    }
    for (int i = 1; i < = (int) parmcnt; i ++)
    printf ("%i\tNAME = % column. ("* s\n", i, namelen [i-1], pcoln [i-1]);

    return 0;
    }


    This is the script that create the table, insert records and create the stored procedure

    CREATE TABLE CITIES)
    STATE_CODE VARCHAR2 (2) NULL,
    CITY_CODE NUMBER (15.5) NULL,
    CITY_NAME VARCHAR2 (30) NULL
    )
    /


    INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES ('CA', 30, 'SAN DIEGO')
    /
    INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES ('CA', 40 'SACRAMENTO')
    /
    INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES ('FL', 10, 'MIAMI')
    /
    INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES ('FL', 20, 'ORLANDO')
    /
    INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES ('NEW YORK', 10, 'NEW YORK')
    /
    INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES ('NEW YORK', 20, 'ALBANY')
    /
    INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES ('CA', 10, 'LOS ANGELES')
    /
    INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES ('CA', 20, 'SAN FRANCISCO')
    /


    CREATE or REPLACE PACKAGE globalPkg AUTHID CURRENT_USER AS
    / * The following is specific global variables T/SQL. */
    TYPE RCT1 IS REF CURSOR; / * new cursor low definition * /.
    END globalPkg;
    /



    CREATE OR REPLACE PROCEDURE SP_ADDCITY)
    P_STATE_CODE IN VARCHAR,
    P_CITY_CODE NUMBER,
    P_CITY_NAME IN VARCHAR2,
    P_RETURN IN NUMBERS)
    AS
    StoO_error INTEGER;
    StoO_selcnt INTEGER;
    StoO_rowcnt INTEGER;
    StoO_errmsg VARCHAR2 (255);

    BEGIN
    StoO_rowcnt: = 0;
    StoO_error: = 0;
    StoO_selcnt: = 0;
    P_RETURN: = 0;
    INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES (P_STATE_CODE, P_CITY_CODE, P_CITY_NAME);
    StoO_rowcnt: = number of LINES SQL %;
    EXCEPTION
    WHEN TOO_MANY_ROWS THEN
    StoO_rowcnt: = 2;
    WHILE OTHERS THEN
    StoO_rowcnt: = 0;
    StoO_selcnt: = 0;
    StoO_error: = SQLCODE;
    StoO_errmsg: = SQLERRM;
    IF StoO_error! = 0 THEN
    BEGIN
    P_RETURN: = 1;
    RETURN;
    END;
    END IF;
    END;
    /

    CREATE OR REPLACE PROCEDURE SP_GETCITIES)
    STATE_KEY IN VARCHAR,
    RC1 IN OUT globalPkg.RCT1)
    AS
    StoO_error INTEGER;
    StoO_selcnt INTEGER;
    StoO_rowcnt INTEGER;
    StoO_errmsg VARCHAR2 (255);
    BEGIN
    StoO_rowcnt: = 0;
    StoO_error: = 0;
    StoO_selcnt: = 0;
    OPEN FOR RC1
    SELECT STATE_CODE, CITY_CODE, FRANCISCO
    CITIES
    WHERE STATE_CODE = STATE_KEY
    ORDER BY CITY_CODE;
    StoO_rowcnt: = number of LINES SQL %;
    EXCEPTION
    WHILE OTHERS THEN
    StoO_rowcnt: = 0;
    StoO_error: = SQLCODE;
    StoO_errmsg: = SQLERRM;
    END;
    /

    Hi Antonio,.

    I see this:

    c_buf=(ub1 **)calloc(sizeof(ub1 *),3);
    
    ...
    
    rc=OCIDefineByPos(pOciStatCursor,&pdef,(OCIError *)pOciError,pos,c_buf[pos-1],size+1,(ub2)type,(dvoid *)c_indp[pos-1],(ub2 *)0,(ub2 *)0,OCI_DEFAULT);
    

    That I don't understand. You allocate space for 3 pointers ub1 but I don't see where these pointers are then initialized to point to where the data is to be stored.

    I do not read correctly?

    Sorry for posting code long, but here is an example of code that I have. It is much more 'code' for your code, but maybe that will be enough...

    NOTE: This is just the code example and not rigorous. For example, I don't check the memory, allocations etc in this code!

    Kind regards

    Mark

    #ifdef WIN32
    #define _CRT_SECURE_NO_DEPRECATE 1
    #endif
    
    #include 
    #include 
    #include 
    #include 
    
    void checkerr(sword status, OCIError *errhp);
    
    int main(int argc, char *argv[]) {
      OCIEnv      *envhp = NULL;  /* OCI Environment handle     */
      OCIError    *errhp = NULL;  /* OCI Error handle           */
      OCISvcCtx   *svchp = NULL;  /* OCI Service Context handle */
      OCIServer   *srvhp = NULL;  /* OCI Server handle          */
      OCISession  *usrhp = NULL;  /* OCI User Session handle    */
    
      OCIStmt     *stmtp = NULL;  /* OCI Statement handle       */
      OCIStmt     *cursr = NULL;  /* OCI Statement handle       */
    
      OCIParam    *prmp1 = NULL;  /* OCI Parameter handle       */
      OCIParam    *prmp2 = NULL;  /* OCI Parameter handle       */
      OCIParam    *prmp3 = NULL;  /* OCI Parameter handle       */
    
      OCIDefine   *defp1 = NULL;  /* OCI Define handle          */
      OCIDefine   *defp2 = NULL;  /* OCI Define handle          */
      OCIDefine   *defp3 = NULL;  /* OCI Define handle          */
    
      OCIBind     *bndp1 = NULL;  /* OCI Bind handle            */
      OCIBind     *bndp2 = NULL;  /* OCI Bind handle            */
      OCIBind     *bndp3 = NULL;  /* OCI Bind handle            */
    
      /* used to hold column width */
      ub2 col_width;
    
      /* used to set the prefetch count */
      ub4 prefetch_count = 32;
    
      /* will hold output from database */
      oratext *pEmpId = NULL;
      oratext *pFirstName = NULL;
      oratext *pLastName = NULL;
    
      /* the anonymous block to execute */
      /* this opens a ref cursor        */
      oratext *sqlstmt = "begin " \
                         "  open :1 for " \
                         "  select   to_char(employee_id), " \
                         "           first_name, " \
                         "           last_name " \
                         "  from     hr.employees " \
                         "  order by last_name, " \
                         "           first_name; " \
                         "end;";
    
      /* used to hold the results of each OCI call */
      sword result = 0;
    
      /* Initialize and create a default environment  */
      result = OCIEnvCreate(&envhp,
                            OCI_DEFAULT,
                            (dvoid *) 0,
                            0,
                            0,
                            0,
                            (size_t) 0,
                            (dvoid **) 0);
    
      /* allocate an error handle */
      result = OCIHandleAlloc((dvoid *) envhp,
                              (dvoid **) &errhp,
                              OCI_HTYPE_ERROR,
                              0,
                              (dvoid **) 0);
    
      /* allocate a service context handle */
      result = OCIHandleAlloc((dvoid *) envhp,
                              (dvoid **) &svchp,
                              OCI_HTYPE_SVCCTX,
                              0,
                              (dvoid **) 0);
    
      /* allocate a server handle */
      result = OCIHandleAlloc((dvoid *) envhp,
                              (dvoid **) &srvhp,
                              OCI_HTYPE_SERVER,
                              0,
                              (dvoid **) 0);
    
      /* allocate a user session handle */
      result = OCIHandleAlloc((dvoid *) envhp,
                              (dvoid **) &usrhp,
                              OCI_HTYPE_SESSION,
                              0,
                              (dvoid **) 0);
    
      /* create a server context using the "ORADEMO" database */
      result = OCIServerAttach(srvhp,
                               errhp,
                               "ORADEMO",
                               (ub4) strlen("ORADEMO"),
                               OCI_DEFAULT);
    
      /* set the server attribute in the service context handle */
      result = OCIAttrSet((dvoid *) svchp,
                          OCI_HTYPE_SVCCTX,
                          (dvoid *) srvhp,
                          (ub4) 0,
                          OCI_ATTR_SERVER,
                          errhp);
    
      /* open the session with the database */
      /* using external authentication      */
      result = OCISessionBegin(svchp,
                               errhp,
                               usrhp,
                               OCI_CRED_EXT,
                               OCI_DEFAULT);
    
      /* set the user session attribute in the service context handle */
      result = OCIAttrSet((dvoid *) svchp,
                          OCI_HTYPE_SVCCTX,
                          (dvoid *) usrhp,
                          (ub4) 0,
                          OCI_ATTR_SESSION,
                          errhp);
    
      /* allocate the statement handle */
      result = OCIHandleAlloc((dvoid *) envhp,
                              (dvoid **) &stmtp,
                              OCI_HTYPE_STMT,
                              0,
                              (dvoid **) 0);
    
      /* prepare the statement for execution */
      result = OCIStmtPrepare(stmtp,
                              errhp,
                              sqlstmt,
                              (ub4) strlen((char *) sqlstmt),
                              OCI_NTV_SYNTAX,
                              OCI_DEFAULT);
    
      /* allocate the handle for the ref cursor */
      result = OCIHandleAlloc((dvoid *) envhp,
                              (void **) &cursr,
                              OCI_HTYPE_STMT,
                              0,
                              NULL);
    
      /* bind the ref cursor parameter */
      result = OCIBindByPos(stmtp,
                            &bndp1,
                            errhp,
                            1,
                            &cursr,
                            0,
                            SQLT_RSET,
                            NULL,
                            0,
                            NULL,
                            0,
                            0,
                            OCI_DEFAULT);
    
      /* execute the statement */
      result = OCIStmtExecute(svchp,
                              stmtp,
                              errhp,
                              1,
                              0,
                              NULL,
                              NULL,
                              OCI_DEFAULT);  
    
      /* get parameter descriptor for first column */
      result = OCIParamGet((dvoid *) cursr,
                           OCI_HTYPE_STMT,
                           errhp,
                           (dvoid **) &prmp1,
                           (ub4) 1);
    
      /* get parameter descriptor for second column */
      result = OCIParamGet((dvoid *) cursr,
                           OCI_HTYPE_STMT,
                           errhp,
                           (dvoid **) &prmp2,
                           (ub4) 2);
    
      /* get parameter descriptor for third column */
      result = OCIParamGet((dvoid *) cursr,
                           OCI_HTYPE_STMT,
                           errhp,
                           (dvoid **) &prmp3,
                           (ub4) 3);
    
      /* get the first column width in characters */
      result = OCIAttrGet((dvoid*) prmp1,
                          (ub4) OCI_DTYPE_PARAM,
                          (dvoid*) &col_width,
                          (ub4 *) 0,
                          (ub4) OCI_ATTR_DATA_SIZE,
                          errhp);
    
      /* allocate memory to hold the result */
      pEmpId = (oratext *) malloc(sizeof(oratext) * (col_width + 1));
    
      /* define the first column in the results */
      result = OCIDefineByPos(cursr,
                              &defp1,
                              errhp,
                              1,
                              (dvoid *) pEmpId,
                              (sword) col_width + 1,
                              SQLT_STR,
                              (dvoid *) NULL,
                              (ub2 *) 0,
                              (ub2 *) 0,
                              OCI_DEFAULT);
    
      /* get the second column width in characters */
      result = OCIAttrGet((dvoid*) prmp2,
                          (ub4) OCI_DTYPE_PARAM,
                          (dvoid*) &col_width,
                          (ub4 *) 0,
                          (ub4) OCI_ATTR_DATA_SIZE,
                          errhp);
    
      /* allocate memory to hold the result */
      pFirstName = (oratext *) malloc(sizeof(oratext) * (col_width + 1));
    
      /* define the second column in the results */
      result = OCIDefineByPos(cursr,
                              &defp2,
                              errhp,
                              2,
                              (dvoid *) pFirstName,
                              (sword) col_width + 1,
                              SQLT_STR,
                              (dvoid *) NULL,
                              (ub2 *) 0,
                              (ub2 *) 0,
                              OCI_DEFAULT);
    
      /* get the third column width in characters */
      result = OCIAttrGet((dvoid*) prmp3,
                          (ub4) OCI_DTYPE_PARAM,
                          (dvoid*) &col_width,
                          (ub4 *) 0,
                          (ub4) OCI_ATTR_DATA_SIZE,
                          errhp);
    
      /* allocate memory to hold the result */
      pLastName = (oratext *) malloc(sizeof(oratext) * (col_width + 1));
    
      /* define the third column in the results */
      result = OCIDefineByPos(cursr,
                              &defp3,
                              errhp,
                              3,
                              (dvoid *) pLastName,
                              (sword) col_width + 1,
                              SQLT_STR,
                              (dvoid *) NULL,
                              (ub2 *) 0,
                              (ub2 *) 0,
                              OCI_DEFAULT);
    
      /* loop through and print the results */
      while ((result = OCIStmtFetch(cursr,
                                    errhp,
                                    (ub4) 1,
                                    (ub2) OCI_FETCH_NEXT,
                                    (ub4) OCI_DEFAULT)) == OCI_SUCCESS)
      {
        printf("Employee ID: %s\n", pEmpId);
        printf(" First Name: %s\n", pFirstName);
        printf("  Last Name: %s\n\n", pLastName);
      }
    
      /* free allocated memory */
      free(pEmpId);
      free(pFirstName);
      free(pLastName);
    
      pEmpId = NULL;
      pFirstName = NULL;
      pLastName = NULL;
    
      /* terminate the session with the database */
      result = OCISessionEnd(svchp, errhp, usrhp, OCI_DEFAULT);
    
      /* detach from the server */
      result = OCIServerDetach(srvhp, errhp, OCI_DEFAULT);
    
      /* deallocate the environment handle     */
      /* OCI will deallocate the child handles */
      result = OCIHandleFree((dvoid *) envhp, OCI_HTYPE_ENV);
    
      return OCI_SUCCESS;
    }
    
    void checkerr(sword status, OCIError *errhp)
    {
      oratext errbuf[512];
      sb4 errcode = 0;
    
      switch (status) {
        case OCI_SUCCESS:
          break;
    
        case OCI_ERROR:
        case OCI_SUCCESS_WITH_INFO:
          (void) OCIErrorGet((dvoid *) errhp, (ub4) 1, (oratext *) NULL, &errcode, errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
          (void) printf("Error: %.*s\n", sizeof(errbuf), errbuf);
          break;
    
        case OCI_NEED_DATA:
          (void) printf("Error - OCI_NEED_DATA\n");
          break;
    
        case OCI_NO_DATA:
          (void) printf("Error - OCI_NO_DATA\n");
          break;
    
        case OCI_INVALID_HANDLE:
          (void) printf("Error - OCI_INVALID_HANDLE\n");
          break;
    
        case OCI_STILL_EXECUTING:
          (void) printf("Error - OCI_STILL_EXECUTING\n");
          break;
    
        case OCI_CONTINUE:
          (void) printf("Error - OCI_CONTINUE\n");
          break;
    
        default:
          break;
      }
    }
    
  • How to trigger and outputs analog and digital Outout tasks begins on a counter to start?

    Hello

    I'm trying to synchronize the start of a task outputs analog, a task of digital output and a task of counter. I want to start the counter to serve the master trigger and analog and digital tasks to synchronize his departure.

    I guess I need something like:

    analogOutputTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger ("?", DigitalEdgeStartTriggerEdge.Rising);

    digitalOutputTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger ("?", DigitalEdgeStartTriggerEdge.Rising);

    analogOutputTask.Start (); Slave 1

    digitalOutputTask.Start (); slave 2

    () counterTask.Start; n / / master

    Where? is a string specifying a command source for the beginning of the task of the meter. However, I can't find what this string. Any suggestions?

    Thank you!

    -Jon

    Just FYI, the solution to this problem as well as some other ones is encapsulated in a short example .NET, I created. It is on the Web site of EITHER:

    http://decibel.NI.com/content/docs/doc-15500

    This project shows how to synchronize all your analogue/digital outputs through tasks and forums in terms of synchronizing Calendar and start clock.

    -Jon

  • Peuvent trigger cursors?

    A cursor [select... for update] may trigger a before update trigger?

    user13659065 wrote:
    A cursor [select... for update] may trigger a before update trigger?

    N °

    http://docs.Oracle.com/CD/E11882_01/server.112/e25789/srvrside.htm#CNCPT118

  • REF CURSOR output and race update

    Hello

    I have a process where I need to make changes in quantity for the products. I want to these products and the quantity of output in a c# application and also update my table of inventory with the new values.

    My question is what is the best way to have a stored procedure out a REF CURSOR (for the purposes of c#) and use the same data that came out in the REF CURSOR to update my table of inventory?

    I have this:

    -USE IT TO GET MY PRODUCTS-
    PROCEDURE sp_get_products)
    r_products ON SYS_REFCURSOR
    )

    IS

    BEGIN

    Select ProductID, InStock
    Products

    END sp_get_products;


    -USE CE TO OUTPUT REF CURSOR and run - UPDATE
    PROCEDURE sp_get_ref_products)
    r_ref_products ON SYS_REFCURSOR
    )

    IS

    type ProductID is the Products.ProductID%type table;
    QTY type is table of the Products.QTY%type;

    l_ProductID ProductID;
    l_QTY QTY;

    BEGIN
    sp_get_products (r_ref_products);

    Get the r_ref_products COLLECT in BULK IN l_ProductID, l_QTY;
    ForAll indx l_ProductID.first... l_ProductID.Last
    Update product p
    Set p.QTY = l_QTY (indx)
    Where p.ProductID = l_ProductID (indx);

    COMMIT;


    END sp_get_ref_products;

    Maybe you're not understanding what is a Ref Cursor. It does not store a result set.

    Take a read of this thread:

    [PL/SQL 101: understanding Ref Cursor | http://forums.oracle.com/forums/thread.jspa?threadID=886365&tstart=0]

  • Problems using trigger cursor query and post.

    Hello

    I use a block non-base of data/model to query records in a database block. My form has a point text 'report No.' that will be used to enter a valid number of reports. Based on the number of this report, I hit a button to search (also from the same block of data non-base) to view records that have this "report No.' in the database block. I think I need to use a cursor in a post for this request but I am not able to operate :( Help, please! I really need this point that nobody is helping me to work:(la figure)

    My search button - button the trigger:
    DECLARE
    NUMBER OF CHOICES;
    BEGIN
    IF: DUMMY_BLK. NWTFR IS NULL THEN
    ALERTS. STOP_ALERT ("Start Date is required", choice);
    RAISE FORM_TRIGGER_FAILURE;
    END IF;
    go_block ('T_VESSEL_BLK');
    execute_query;
    END;

    My post_query:

    DECLARE
    cursor vessel_cur is
    SELECT VES_RPTNO, VES_SENDER, VES_SENDER_MBOX, VES_INTCTRL_REF, VES_NAME, VES_VOYNO, VES_ARRDT
    SHIP
    WHERE VES_RPTNO =: DUMMY_BLK. NWTFR;
    var_mot vessel_cur % ROWTYPE;
    BEGIN
    Open vessel_cur;
    LOOP
    extract the vessel_cur in var_mot;
    EXIT WHEN vessel_cur % NOTFOUND;
    END LOOP;
    close vessel_cur;
    END;

    instead of execute_query you do now

    Why do you offer me something like that? Replacing the standard behavior that you use forms must be well thought out, because you have to manage a large number of possible problems. You can easily get the desired using the standard logic behavior:

    -Create an item number IT_COUNT in a control block, assign 'calculation mode' to 'Summary', 'Synthesis function' to 'Count' "Down block" and your DB-bloc and "just point' a null-element not contained in this block. Last series the block 'Interrogate all folders' to 'Yes' in your databaseblock. Now, in your code, you can just checkl the value of this element of count, as

    ...
    EXECUTE_QUERY;
    IF :BL_CONTROL.IT_COUNT=0 THEN
      error
    END IF;
    
  • Ref cursor output

    Hi all
    .....
    .....
    v_out VARCHAR2(32767) := '1613484.92,1247592.74,,,,,,,,,,,,2861077.66,,,,,,,,,,1808338.11,478522.61,,,,,,,,,,,,2286860.72,,,,,,,,'; 
    
     v_query := 'SELECT territory_id, territory_name, node_level, node_type'||v_out||' FROM yep_hier_node_mv WHERE territory_id = : x'  ;
                                
    OPEN p_refCursor FOR v_query USING p_terrId; 
    
    .....
    ....
    When I run the cursor, I get error of invalid Expression.
    This could be the list of columns that ends with a comma in the SELECT query.

    What could be the best way to run the slider, so that I get the output in a single line.
     5694,Los Angeles Territory_Commercial,6,Region,1613484.92,1247592.74,,,,,,,,,,,,2861077.66,,,,,,,,,,1808338.11,478522.61,,,,,,,,,,,,2286860.72,,,,,,,,
    Thank you and best regards.

    Well, your first mistake is that you do not have a comma following node_type (just to the left of the apostrophe). But it's not going to give you all the outputs that has commas in there, just a bunch of essentially anonymous columns.

    How do you rely on access to the data once you have managed to select?

  • How to create a procedure for REF CURSOR output with any WHERE clause?

    I have a requirement like this: I have a huge question that need to reuse in my code over 10 times. This SQL has about 50 lines. Here for these 10 odd times sometimes changes in WHERE clause (columns are the same). So I can't create a view as SQL is not static.

    I thought to write a procedure with a para of WHERE_CLAUSE entry. I pulled out a refcursor sys by adding where clause. But I can't do it because you cannot add a clause like this where clause.

    i.e.
    PROCEDURE dynamyic_query (p_where_clause IN VARCHAR2, p_out_query OUT SYS_REFCURSOR ) IS
    BEGIN
    
      OPEN p_out_query FOR SELECT ......... FROM table WHERE || ' ' || p_where_clause;
    
    END;
    The foregoing gives an error.

    How to handle such a situation? Any help would be greatly appreciated.

    Hello

    Channa wrote:
    ... However, when I change the procedure like this:

    PROCEDURE FORMS_TEXT_DYN_SQL_TEST(p_where_cluase IN VARCHAR2, p_out_cursor OUT SYS_REFCURSOR) IS
    v_stmt VARCHAR2(1000);
    BEGIN
    v_stmt := 'SELECT tname FROM tab_test WHERE tname LIKE ''%ABS_V4%'' AND :y';
    
    OPEN p_out_cursor FOR v_stmt using p_where_cluase;
    
    END;
    

    And run this block of code:

    declare
    v_tname varchar2(200);
    out_cursor sys_refcursor;
    begin
    forms_text_dyn_sql_test(' 1 = 1 ', out_cursor );
    LOOP
    fetch out_cursor INTO v_tname;
    exit when out_cursor%NOTFOUND;
    DBMS_OUTPUT.PUT_LINE(v_tname);
    END LOOP;
    end;
    /
    

    I get the error:

    [1]: (Error): ORA-00920: invalid relational operator ORA-06512: at "ABS.FORMS_TEXT_DYN_SQL_TEST", line 6 ORA-06512: at line 5
    

    Looks like you can only set column_name =: z, column_name =: values of type y. You can not it seems to replace it with no WHERE CLAUSE?

    A bind variable, such as: it, represents a single value.
    If: is the VARCHAR2 '1 = 1', then

    SELECT tname FROM tab_test WHERE tname LIKE '%ABS_V4%' AND :y
    

    takes the value

    SELECT tname FROM tab_test WHERE tname LIKE '%ABS_V4%' AND '1 = 1'
    

    I think you want something like this:

    CREATE OR REPLACE PROCEDURE FORMS_TEXT_DYN_SQL_TEST
    (     p_where_clause      IN      VARCHAR2
    ,      p_out_cursor      OUT      SYS_REFCURSOR
    ) IS
      v_stmt VARCHAR2(1000);
    BEGIN
      v_stmt := 'SELECT ename FROM scott.emp WHERE ename LIKE ''%A%'' AND '
              || p_where_clause;
    
      OPEN p_out_cursor FOR v_stmt;
    
    END;
    /
    show errors
    
    SET  SERVEROUTPUT  ON
    
    declare
      v_tname varchar2(200);
      out_cursor sys_refcursor;
    begin
      forms_text_dyn_sql_test(' 1 = 1 ', out_cursor );
      LOOP
        fetch out_cursor INTO v_tname;
        exit when out_cursor%NOTFOUND;
        DBMS_OUTPUT.PUT_LINE(v_tname);
      END LOOP;
    end;
    / 
    

    Output:

    ALLEN
    WARD
    MARTIN
    BLAKE
    CLARK
    ADAMS
    JAMES
    
  • NamedStoredProcedure with Ref Cursor output

    I would like to install a NamedStoredProcedureQuery who can receive results of a cursor, and I wonder if it's possible.

    So I have my procedure:

    procedure test_proc (t_cursor ON ref_cursor)
    is
    Start
    Open the t_cursor for
    Select * from enrolment;
    end;

    and my NamedStoredProcedureQuery:

    @NamedStoredProcedureQuery (name = "TEST_REF_CURSOR", procedurename = "TEST_REF_CURSOR.test_proc", returnsResultSet = true,
    parameters = {@StoredProcedureParameter (queryParameter = "t_cursor", name = "t_cursor", direction = Direction.OUT_CURSOR, type = Enrolment.class)})


    So I try to call my Proc with:

    Query query = em.createNamedQuery ("TEST_REF_CURSOR");
    List results = query.getResultList ();

    and I get a oh so helpful error:


    Inner exception: java.sql.SQLException: ORA-00900: invalid SQL statement

    Error code: 0
    Call: BEGIN TEST_REF_CURSOR.test_proc (t_cursor = >?); END;
    link = > [= > t_cursor]


    I'm doing something wrong or should I use StoredProcedureCall instead?

    It should work.

    The question seems to be

    returnsResultSet = true,

    delete it, or set it to false.

    ---
    James: http://www.eclipselink.org

  • Programmatically trigger a structure of the event with the value (signaling) is not responding

    Hey, in my attached program I check if the two steps of translation are in a specific position. If Yes, I want my code to execute a sequence of movements. If this isn't the case, I'm asking the user if he wants contributed from this position anyway. It has three options: Yes, go to load (the specific position) and cancel. If he hits Yes, I am using a property of signal value which should update the controls Boolean true, allowing the sequence. Cancellation and work "to load" perfectly fine, but 'Yes' does not work. I think I need a structure of the event to ahndle the value of the Boolean control 'x' change event, however, the addition of this structure of the event for some reason any even do not allow me to click on the Start button of the procedure.
    Thanks for any help in advance.
    Doug

    Really, you should look into using a State Machine.  You should have really not what happens inside a structure of the event.

    In addition, I would like to use a shift register to store this value instead of a front panel control.

  • Fire graphic cursor move event programmatically

    Is it possible to programmatically trigger the move bar graph event?  Assign a value to the Index of the cursor or the property node Cursor Position does not seem to do.

    Create a user and set up the case of the event which handles the cursor movement to handle that event as well. Then fire this event when the data updated?

    Ben

  • Post-formulaire relaxation - output options

    I use form 10g.
    I have a block non-base of data in the form. Stored procedures (program units) are used in triggering the validation button to save any changes made to this block, to the database. Because, it is a block not db, the form does not identify the changed items. So when the user selects accidentally any other form in the menu, the form does not give warning to the user saying that "changes are not saved."

    The form has two tabs. If the user leaves the form from the second tab (non db block based), I would like to issue a generic warning for the user, such as "you are about to leave the form XYZ. You will lose all unsaved changes. You wish to proceed? »

    Is the trigger of the Form after the right place to do this check and raise the warning msg? I have the the following code in the form post trigger
    DECLARE
       canvas_id      canvas;
       current_tab    VARCHAR2(30);
       alert_id       alert;
       alert_button   NUMBER;
    BEGIN
       canvas_id := FIND_CANVAS('XY_Canvas');
       current_tab := GET_CANVAS_PROPERTY(canvas_id, topmost_tab_page);
    
       IF current_tab = 'XY_TAB' THEN
          alert_id := FIND_ALERT('ME_WARNING_A');
          SET_ALERT_PROPERTY(
             alert_id,
             alert_message_text,
             'You are about to leave the XYX form. You will lose any unsaved changes. Do you wish to proceed?'
          );
          alert_button := SHOW_ALERT(alert_id);
    
          IF alert_button = alert_button1 THEN
             NULL;
          ELSE
             COMMIT_FORM;
          END IF;
       END IF;
    END;
    The Commit_form is a restricted procedure cannot be used in the trigger of the form. What can I use, so that the control remains on the form? (It is not necessary to call stored procedures to save the changes to the database. The goal is to stop navigation to a different form or outside the current form)

    Thanks in advance.

    Smita,
    Sorry, but I gave you bad information. You cannot programmatically change the status of FORM or BLOCK variables. You can change the RECORD_STATUS, but this is only valid if you perform a check of the State of registration that you leave the specific record. For a verification of large form, it would be better to create a GLOBAL or a SETTING that you can configure and then check the status of this SETTING to out of shape or GLOBAL. Personally, I recommend the use of a PARAMETER to the GLOBAL variable. This requires a little configuration, but it's not too bad. Here are the steps that I got to do this:
    1. create the Parameter object: PREV_VALUE, data type: CHAR
    2. create the Parameter object: FORM_STATUS, data type: CHAR, default value: QUERY
    3. create the Pre-Text-trigger on block with the following code:

    BEGIN
      COPY(NAME_IN('SYSTEM.TRIGGER_ITEM','PARAMETER.PREV_VALUE');
    END;
    

    4. create block-level when-validate-item trigger with the following code:

    BEGIN
      IF ( :PARAMETER.Prev_Value != NAME_IN('SYSTEM.CURSOR_VALUE') ) THEN
        :PARAMETER.Form_Status := 'CHANGED';
      END IF;
    END;
    

    Notes; If you have a trigger point level when validate point on any of the elements of this block, you need to change the default value of the property of the hierarchy of execution of two triggers; a 'before' and the other 'AFTER' so that both triggers will fire. If you do not, only the block-level trigger fires.

    5. Finally, create a trigger button-output level/form with code Module:

    BEGIN
      IF ( :PARAMETER.FORM_STATUS != 'QUERY' ) THEN
        --Prompt your user to save changes here.
        --Call your program logic to perform the save.
      END IF;
      Exit_Form;
    END;
    

    Again, sorry for the wrong direction to my first answer.

    Hope this helps,
    Craig B-)

    If someone useful or appropriate, please mark accordingly.

    Published by: Silvere on 7 February 2012 09:44

  • Output meter, at the request

    I would like to have a counter to a single output pulse whenever an incident occurs in a loop. My current solution (in pseudocode; I'm using LabWindows CVI on an RT target) looks like this:

    DAQmxCreateTask (...);
    DAQmxCreateCOPulseChanTime (...);
    While (true)
    {
    If (condition)
    {
    T1 = Timer();
    DAQmxStartTask (...);
    T2 = Timer();
    DAQmxErrChk (DAQmxWaitUntilTaskDone(*th,2));
    DAQmxErrChk (DAQmxStopTask(*th));
    }
    }
    DAQmxClearTask (...);

    Unfortunately, the time between t1 and t2 is at least 0.142ms and sometimes 2ms is there an elegant way to reduce this and do not have to call the StartTask again and again?

    Thank you

    Jonas

    You should get an improvement by committing to the task before your loop:

    ...
    DAQmxCreateCOPulseChanTime (...);
    DAQmxTaskControl (taskHandle, DAQmx_Val_Task_Commit);
    While (true)
    ...

    If this isn't good enough, you could try instead using a task of digital output (start the task before the loop, write twice inside the loop - high then low - whenever you need a pulse output).  If the pulse width needs any kind of accuracy at all you want to use the digital output task to trigger an output meter (start the meter before the loop task and configure it to be "redeclenchables" so you don't have to restart several times in the software).  I don't know whether or not it will actually run faster without benchmarking it.

    Best regards

Maybe you are looking for

  • can send but cannot receive e-mail

    Have 2 comcast email accounts. 5 days ago, that both has ceased to receive emails through Thunderbird on my laptop. They work on the comcast site. As if by magic one of the email accounts started getting yesterday - no problem. The other is still "st

  • resize the search bar and resize individually address bar in Firefox 4 beta

    Address bar and search bar are too big in Firefox 4.12 Beta. I can make one of them smaller, but he made a bigger to fill the space. A way to make the two smaller so I can gain a little more real estate to add one or two other icons? I already use "s

  • problem with the CD/DVD ROM device

    Windows nofified it is problem with my CD ROM havin - two of them! I tried Windows troubleshooting. He tried to reinstall the driver but it failed.Then I tried Windows Update to see if I can find an update of the driver but he could not find any upda

  • When I insert an image in the body of my email, it is replaced with an attachment when the recipient gets (also using OE).

    I use outlook express 6 on windows xp pro. When I Insert an image in the body of my email, it is replaced with an attachment when the recipient gets (also using OE).I did use the option of fixing , I used to Insert.  The reverse also occurs.  When so

  • IPSec VPN via UDP fails on WRT610N

    Hello Using a Cisco VPN, user can connect, but after have connected you to all stops internet connectivity.IPsec uses UDP (NAT/PAT).Anyway to turn it on? The router VPN Passthroughs are all enabled, I even turned on the UDP multicast filter...Nowhere