How to run a procedure with the object as OUTPUT parameter

Hello

I have a procedure and it composed of 2 parameters, there is an input parameter and it's some ID (NUMBER datatype) and 2nd parameter is an output parameter and it an object type. I want to run this procedure, but not able to do the same thing. Can someone please suggest me how to run a procedure that got the object as output parameter.

Thank you very much in advance for your support.

Example:

SQL> create or replace type t_obj as object (ename varchar2(10), deptno number);
  2  /

Type created.

SQL> ed
Wrote file afiedt.buf

  1  create or replace procedure myproc (p_empno in number, obj out t_obj) is
  2  begin
  3    select t_obj(ename, deptno)
  4    into obj
  5    from emp
  6    where empno = p_empno;
  7* end;
SQL> /

Procedure created.

SQL> set serverout on
SQL> declare
  2    v_obj t_obj;
  3  begin
  4    myproc(7788, v_obj);
  5    dbms_output.put_line(v_obj.ename||','||v_obj.deptno);
  6  end;
  7  /
SCOTT,20

PL/SQL procedure successfully completed.

Tags: Database

Similar Questions

  • Failed to create the stored procedure with the object as a parameter

    Hello

    No idea how to create procedures to the current data stored in SQLFire, try to run the command prompt "sqlf" per call "create_proc.sql" as give below error below

    C:\SQLFire10Beta>sqlf
    sqlf version 10.4
    sqlf> connect client 'localhost:1527';
    sqlf> run 'create_proc.sql';
    sqlf> CREATE PROCEDURE INSURANCE.SEARCHCUSTOMER (IN CUST OBJECT) DYNAMIC RESULT SETS 1 LANGUAGE JAVA PARAMETER STYLE JAVA READS SQ
    L DATA EXTERNAL NAME com.xxx.xxx.sqlfire.dao.CustomerSearchProcedure.searchCustomer;
    ERROR 42X01: Syntax error: Encountered "" at line 1, column 47.
    Caused by: SqlException: Syntax error: Encountered "" at line 1, column 47.
            at com.vmware.sqlfire.internal.client.am.Statement.completeSqlca(Statement.java:1838)
    sqlf> sqlf> 


    and I created a class Java as described below:

    public class CustomerSearchProcedure {
     
     public static void searchCustomer (BaseDTO[] customers, ResultSet[] outResults,
       ProcedureExecutionContext context) throws SQLException {
      BaseDTO searchCriteria = customers[0];
      StringBuilder sql = new StringBuilder();
      sql.append("SELECT * FROM INSURANCE.CUSTOMERS WHERE CUST_NAME LIKE '"+searchCriteria.getCustName().trim() + "%'");
      
      Connection cxn = context.getConnection();
      Statement stmt = cxn.createStatement();
      ResultSet rs = stmt.executeQuery(sql.toString());
      outResults[0] = rs;
     } //END OF METHOD
    }


    This procedure is called class using the class StoredProcedure Spring DAO

    You can let me know why am not able to create the procedure?

    FYI, pots can also can be dynamically installed in the system by using the SYS. Table client-side JARS to transport the jar bytes rather than by requiring that the pot be accessible side Server (http://pubs.vmware.com/vfabric5/index.jsp?topic=/com.vmware.vfabric.sqlfire.1.0/deploy_guide/Topics/sysjars_install.html)

  • 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 run a procedure with parameters in pl/sql collections?

    I created a procedure with parameter from the collection. Can somone help me how to run a procedure in passing the parameters in the collection.
    Package and how to create is successful. But I get the error message when executing the procedure.

    ORA-06550: line 3, column 19:
    PLS-00222: no function with name 'T_TAB' does exist in this scope

    I gave the example of code here. Can someone please help me solve this problem.

    -Spec package

    create or replace package pkg_dist is

    TABLE index IS THE NUMBER of t_tab_num TYPE of PLS_INTEGER;


    procedure prc_test (a t_tab_num IN,
    b IN t_tab_num,
    c IN OUT t_tab_num);
    end pkg_dist;

    -Package body

    create or replace package body is pkg_dist

    procedure prc_test (a t_tab_num IN,
    b IN t_tab_num,
    c IN OUT t_tab_num) is


    Start


    IF (a (16) = 0) then
    (16) c: = 0;
    c (17): = 0;
    c (18): = 0;
    end if;
    c (15): = (14)-(15)-a (16);
    (16) c: = b (16) /b (17);
    c (17): = 50;
    (18) c: = a (16) * 2;

    end prc_test;
    end pkg_dist;

    -executeing procedure

    declare
    TABLE index IS THE NUMBER of t_tab TYPE of PLS_INTEGER;
    x t_tab: = t_tab (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
    y t_tab: = t_tab (0,10,15,20,25,30,35,40,45,50,60,75,100,125,150,200,250,500);
    z t_tab;
    BEGIN
    pkg_dist.prc_test (x, y, z);
    dbms_output.put_line (z (18));
    END;

    Error:
    --------------------------------------------------------------------------------
    ORA-06550: line 3, column 19:
    PLS-00222: no function with name 'T_TAB' does exist in this scope

    My suggestion would be:

    CREATE OR REPLACE PACKAGE pkg_dist IS
    
       PROCEDURE prc_test (a IN SYS.odcinumberlist, b IN SYS.odcinumberlist, c IN OUT SYS.odcinumberlist);
    END pkg_dist;
    
    CREATE OR REPLACE PACKAGE BODY pkg_dist IS
       PROCEDURE prc_test (a IN SYS.odcinumberlist, b IN SYS.odcinumberlist, c IN OUT SYS.odcinumberlist) IS
       BEGIN
          IF (a (16) = 0) THEN
             c (16) := 0;
             c (17) := 0;
             c (18) := 0;
          END IF;
    
          c (15) := a (14) + a (15) + a (16);
          c (16) := b (16) / b (17);
          c (17) := 50;
          c (18) := a (16) * 2;
       END prc_test;
    END pkg_dist;
    /
    
    DECLARE
       x   SYS.odcinumberlist;
       y   SYS.odcinumberlist;
       z   SYS.odcinumberlist;
    BEGIN
       x := sys.odcinumberlist (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
       y := sys.odcinumberlist (0,10,15,20,25,30,35,40,45,50,60,75,100,125,150,200,250,500);
       z := sys.odcinumberlist (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
       pkg_dist.prc_test (x, y, z);
       DBMS_OUTPUT.put_line (z (18));
    END;
    /
    

    See you soon,.
    Manik.

  • How to run a procedure with refcursor to more

    an entry is User_id = CMSH_USER; p_Ot-num =-9999; p_ppst_flag = 'P' and I want to take the trace by running this procedure, and any1 help me, how to run this procedure below and how to use these 5 on refcursor...
     procedure Pr_get_mny(p_ot_Num      IN NUMBER,
                                     p_User_Id      IN VARCHAR2,
                                     p_Ppst_Flag IN VARCHAR2,
                                     Ref_Cur        OUT Ref_Cursor,
                                     CUR_OPT        OUT Ref_Cursor,
                                     CUR_TAXRATE    OUT Ref_Cursor,
                                     CUR_TAXHOLD    OUT Ref_Cursor,
                                     CUR_PENDGAACNT OUT Ref_Cursor
                                     ) IS

    If the goal is to Test, the best tool is SQL

    var ref_cur refcursor
    var cur_opt refcursor
    var cur_taxrate refcursor
    var cur_taxhold refcursor
    var cur_pendgaacnt refcursor 
    
    exec pr_get_mny(-9999,'CMSH_USER','P',:ref_cur,:cur_opt,:cur_taxrate,:cur_taxhold,:cur_pendgaacnt)
    
    print ref_cur
    print cur_opt
    print cur_taxrate
    print cur_taxhold
    print cur_pendgaacnt
    
  • Procedure with the collection as a parameter-help needed

    I have records like below:

    Add time of Rol
    ---------------
    A1 08:20
    A2 08:25
    A2 A1 08:29
    A2 A1 08:32
    A3 08:45
    A3 08:46
    A3 08:50

    I have a scenario where I have to calculate the average_time based on a scenario.
    The formulas that we have to calculate the average is:
    (min (next_address) - max (previous_address)) * 0.55
    that is, for example, form 5, (08:45 - 08:32) * 0.55.
    Here in my procedure I am passing the TDA and Rol as input parameters collection.
    How can I go and calculate the value of average_time is now.

    I tried with
    For I in Add.count
    loop
    v_avg_time: = (Add(I+1) - Add (I)) * 0.55;
    end loop;

    When I want to test this, I am not knowing how to pass values to the procedure.
    Please tell me how to run the procedure and how to get the results.

    Thanks in advance

    Concerning
    Rambeau

    Try like this.

    SQL> create or replace type my_num as table of number
      2  /
    
    Type created.
    
    SQL> create or replace procedure my_proc (pNum my_num)
      2  as
      3     lsum number;
      4     lavg number;
      5  begin
      6     select sum(column_value), avg(column_value)
      7       into lsum, lavg
      8       from table(cast(pNum as my_num));
      9
     10     dbms_output.put_line('SUM: ' ||lSum);
     11     dbms_output.put_line('AVG: ' ||lAvg);
     12  end;
     13  /
    
    Procedure created.
    
    SQL> declare
      2     lNum my_num := my_num(1,2,3,4,5,6,7,8,9,10);
      3  begin
      4     my_proc(lNum);
      5  end;
      6  /
    SUM: 55
    AVG: 5.5
    
    PL/SQL procedure successfully completed.
    

    Thank you
    knani.

  • How 2 call a procedure with the data type for the parameter Ftree.NODE

    Hello

    in this link
    http://Andreas.Weiden.ORCL.over-blog.de/article-29307730.html


    Down in the page after you run the package, I created the procedure and it compiled successfully but when call PR_WTNS in trigger WHEN-TREE-NŒUD-SELECTED

    PROCEDURE PR_WTNE (i_ndNode IN Ftree.NODE);

    as

    PR_WTNE (i_ndNode Ftree.NODE);


    I got the error message; A wrong number or types of argument in the call

    pls I'm stuck can help any one?


    Kind regards

    Abdetu...

    Published by: Abdetu on October 24, 2010 02:36

    Published by: Abdetu on October 24, 2010 02:36

    YKou have to give a variable of type Ftree.NODE when calling this function. If called fromm a WHEN-TREE-NODE-SELECTED-trigger, use: SYSTEM. TRIGGER_NODE

  • How the parameter of the procedure with the default table type?

    Hello!

    How the parameter of the procedure with the default table type?
    For example:
    type varchar2lType is table of varchar2(50) index by binary_integer;
    create or replace procedure test1
       (
        s1  varchar2(50)
        sa2 Varchar2Type
       )
    as
    begin
       dbms_output.put_line('yyxxyyy!');
    end;
    /
    Published by: bullbil on 16.01.2012 06:35

    If he should really be an associative array for some reason any (can't think why, but just for fun...) you could declare a dummy array in the packet header and specify as the default:

    create or replace package wr_test
    as
       type varchar2ltype is table of varchar2(50) index by pls_integer;
       g_dflt_varchar2l_tab varchar2ltype;
    
       procedure testit
          ( p_testarray varchar2ltype default g_dflt_varchar2l_tab );
    end wr_test;
    
    create or replace package body wr_test
    as
       procedure testit
          ( p_testarray varchar2ltype default g_dflt_varchar2l_tab )
       is
       begin
          dbms_output.put_line('p_testarray contains ' || p_testarray.count || ' elements');
       end testit;
    
    end wr_test;
    

    It is a bit of a hack, because it relies on a global variable that is exposed. A more orderly approach would overload the procedure so that a version does not have the table and another argument:

    create or replace package wr_test
    as
       type varchar2ltype is table of varchar2(50) index by pls_integer;
    
       procedure testit;
    
       procedure testit
          ( p_testarray varchar2ltype );
    
    end wr_test;
    
    create or replace package body wr_test
    as
    
       procedure testit
       is
          v_default_array varchar2ltype;
       begin
          testit(v_default_array);
       end testit;
    
       procedure testit
          ( p_testarray varchar2ltype )
       is
       begin
          dbms_output.put_line('p_testarray contains ' || p_testarray.count || ' elements');
       end testit;
    
    end wr_test;
    
  • How to run execute immediate with variables

    Hi friends,
    How to run execute immediate with variables in v_stmt below?
    I don't know how to declare value I have here.
    Set serveroutput on;
    DECLARE
       i        VARCHAR (20);
       v_stmt   VARCHAR2 (100);
    
       CURSOR c
       IS
          SELECT sqlid FROM temp1;
    
    
    BEGIN
       OPEN c;
    
       LOOP
          FETCH c INTO i;
          EXIT WHEN c%NOTFOUND;
          DBMS_OUTPUT.put_line (i);
          v_stmt := 'select * from table(dbms_xplan.display_cursor('&i',null))'
          execute immediate v_stmt;
       END LOOP;
    
       CLOSE c;
    END;
    /
    Regds,
    Kunwar.

    You must first use a variable binding (named ': v' in the SQL statement in my example):

    set serveroutput on;
    DECLARE
       i        VARCHAR (20);
       v_stmt   VARCHAR2 (100);
    
       CURSOR c
       IS
           -- modified for a quick test
          SELECT sql_id FROM v$sql where child_number > 2;
    
    BEGIN
       OPEN c;
    
       LOOP
          FETCH c INTO i;
          EXIT WHEN c%NOTFOUND;
          DBMS_OUTPUT.put_line (i);
          v_stmt := 'select * from table(dbms_xplan.display_cursor(:v,null))';
          execute immediate v_stmt using i;
       END LOOP;
    
       CLOSE c;
    END;
    /
    

    However because your SELECT statement returns multiple lines, you need to adapt your code to process all rows returned (as already suggested in first response to your message).

    Instead of using the PL/SQL, I recommend you to generate a SQL file using only SQL, and then run the generated SQL file.
    For example:

    spool edx.sql
    set serveroutput on
    declare
    v_stmt varchar2(100);
    v_q char(1):='''';
    begin
    dbms_output.put_line('spool edx.log');
    for s in (select sql_id from v$sql where child_number >2)
     loop
      dbms_output.put_line('select * from table(dbms_xplan.display_cursor(' || v_q || s.sql_id || v_q || ',null));');
     end loop;
     dbms_output.put_line('exit');
    end;
    /
    spool of
    

    This generates a file similar to:

    spool edx.log
    select * from table(dbms_xplan.display_cursor('5rygsj4dbw6jt',null));
    select * from table(dbms_xplan.display_cursor('5rygsj4dbw6jt',null));
    select * from table(dbms_xplan.display_cursor('5rygsj4dbw6jt',null));
    select * from table(dbms_xplan.display_cursor('fsbqktj5vw6n9',null));
    select * from table(dbms_xplan.display_cursor('6q42j0018w7t8',null));
    select * from table(dbms_xplan.display_cursor('a5mmhrrnpwjsc',null));
    select * from table(dbms_xplan.display_cursor('3c1kubcdjnppq',null));
    select * from table(dbms_xplan.display_cursor('3c1kubcdjnppq',null));
    select * from table(dbms_xplan.display_cursor('9gkq7rruycsjp',null));
    select * from table(dbms_xplan.display_cursor('f0wj261bm8snd',null));
    select * from table(dbms_xplan.display_cursor('ab3swhv5g138y',null));
    select * from table(dbms_xplan.display_cursor('6vgvyh4xw9c5g',null));
    select * from table(dbms_xplan.display_cursor('ak5crjygnpk60',null));
    select * from table(dbms_xplan.display_cursor('9p6bq1v54k13j',null));
    select * from table(dbms_xplan.display_cursor('19x1189chq3xd',null));
    select * from table(dbms_xplan.display_cursor('7sx5p1ug5ag12',null));
    select * from table(dbms_xplan.display_cursor('730vdzhng6m6g',null));
    select * from table(dbms_xplan.display_cursor('730vdzhng6m6g',null));
    select * from table(dbms_xplan.display_cursor('0v3dvmc22qnam',null));
    select * from table(dbms_xplan.display_cursor('0v3dvmc22qnam',null));
    select * from table(dbms_xplan.display_cursor('a1zv6wju3ftgv',null));
    select * from table(dbms_xplan.display_cursor('7ng34ruy5awxq',null));
    select * from table(dbms_xplan.display_cursor('7ng34ruy5awxq',null));
    select * from table(dbms_xplan.display_cursor('b2gnxm5z6r51n',null));
    select * from table(dbms_xplan.display_cursor('b2gnxm5z6r51n',null));
    select * from table(dbms_xplan.display_cursor('g4gp07gt2z920',null));
    select * from table(dbms_xplan.display_cursor('1gu8t96d0bdmu',null));
    select * from table(dbms_xplan.display_cursor('g00cj285jmgsw',null));
    select * from table(dbms_xplan.display_cursor('g00cj285jmgsw',null));
    select * from table(dbms_xplan.display_cursor('g00cj285jmgsw',null));
    select * from table(dbms_xplan.display_cursor('bn4b3vjw2mj3u',null));
    select * from table(dbms_xplan.display_cursor('38243c4tqrkxm',null));
    select * from table(dbms_xplan.display_cursor('2abjfnvy5rkyg',null));
    select * from table(dbms_xplan.display_cursor('350f5yrnnmshs',null));
    select * from table(dbms_xplan.display_cursor('350f5yrnnmshs',null));
    select * from table(dbms_xplan.display_cursor('3s1yukp05bzg6',null));
    select * from table(dbms_xplan.display_cursor('3s1yukp05bzg6',null));
    select * from table(dbms_xplan.display_cursor('1tgukkrqj3zhw',null));
    exit
    
    PL/SQL procedure successfully completed.
    

    Edited by: P. Forstmann March 20, 2013 19:06

    Edited by: P. Forstmann March 20, 2013 19:33

  • How to drag a desktop with the magic trackpad icon?

    How to drag a desktop with the magic trackpad icon? It is coupled with a Mac Mini El Capitan 10.11.4 running.

    Thank you.

    Place the cursor on the icon then press on and hold and drag your finger across the surface of the touchpad.

    If problem, then check your trackpad preferences.

    Note also you maybe isn't able to move them they will break again) if other that None is selected in the sort by if you hold with two fingers and choose

  • my audio syestem of beats went when I choose windows 8, how can I return it with the full version?

    my audio syestem of beats went when I choose windows 8, how can I return it with the full version? I have hp pavilion dv4 5110tx

    Hello

    Try the following.

    Download IDT Audio Installer on the link below and save it in your downloads folder.

    http://ftp.HP.com/pub/SoftPaq/sp59501-60000/sp59882.exe

    One time finished, open windows control panel, open Device Manager and open sound, video and game controllers.  Right click on the IDT device and select uninstall - also, you should get a command prompt to delete the current driver, check the box allow this and then proceed to uninstall.

    Then, download and reinstall the Chipset driver on the following link.

    Chipset Driver - Windows 8.

    After reinstalling, restart the laptop and let Windows load completely.  Open your download folder, right-click on the IDT Installer and select "Run as Administrator" to launch the installation.  When this has completed, restart the computer again before checking if the Beats Audio is now listed in the windows control panel.

    Kind regards

    DP - K

  • How to run JavaFX jar with JRE7 on MAC OS Lion 10.7.5?

    I created a jar of JavaFX application bundled with ANT on Windows 8 OS, 64-bit computer. I have 1.7.0_09 JavaFx2.0 and Java installed on my Windows O.S.
    <target name="CreatingJars" depends="Compiling" description="generate the distribution" >
                        <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"      
                                 uri="javafx:com.sun.javafx.tools.ant" classpath="${env.JAVA_HOME}/lib/ant-javafx.jar"/>
                                 
                              <mkdir dir="${WorkingFolder}/temp/libs"/>
                             <copy todir="${WorkingFolder}/temp/libs">
                             <fileset file="${WorkingFolder}/CustomJars/ProjectLib.jar">
                             </fileset>
                             </copy>
                             <copy todir="${WorkingFolder}/temp/libs">
                             <fileset dir="${WorkingFolder}/libs">
                             </fileset>
                        </copy>
                        
                        <fx:jar destfile="${WorkingFolder}/${app.name}.jar">
                        <fx:application mainClass="${main.class}"/>
                        <fx:resources>
                             <fx:fileset dir="${WorkingFolder}/temp/"/>
                        </fx:resources>
                             
                        <fileset dir="${WorkingFolder}/build"/>
                        <fileset dir="${WorkingFolder}/resources"/>
                        </fx:jar>
         </target> 
    When I am trying to run this JavaFX application pot on the use of MAC OS Lion 10.7.5

    java-jar application.jar

    He always shows a dialog box "application requires a newer version of Java Run-time" with the download link. Even I downloaded and successfully installed on my Mac, but it always shows me the same window.

    Java-version is still point to 1.6.

    Then I tried Java preferences to point to the current JRE 1.7, but I could find preferences Java Applications-> utilities-> Java-> Java Preferences.

    I would like to know - how to run JavaFX jar with JRE7 on MAC OS Lion 10.7.5? Is their another way to run the JavaFX JAR with JRE7 application?

    Read this article:
    http://blog.hgomez.net/blog/2012/07/20/understanding-Java-from-command-line-on-OSX/
    The article is excellent and you will understand how to set the java runtime for Mac environment.

    Try:

    export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
    java -version
    java -jar application.jar
    

    Also, it's lion not far away, although the lions like kidneys :-)

  • How to move from records in a procedure with Table Type as a parameter block

    Hello

    How can I move all records in a block of PL/SQL procedure with argument of Type Table or Refcursor.

    I created a procedure in the backend with a parameter of Type table. Of the form, I want to call this procedure with the argument that ALL of the records in BULK.

    Y at - it a simple method for it.


    Thanks in advance

    Rizly

    Rizly,
    I recently put in place a level of forms audit process that uses this method very - package of database, which takes an array of Records as a parameter. Forms 10 G supports this nicely. We have sought to implement this through a set of database triggers (update, insert, delete) but due to our requirements, it was not the best place to do so that we have implemented this in forms.

    Brief history on my form. The main block was based on a table, and the block has been marked NOT can, Insert and Delete. If the user wants to insert, update, or delete a record they clicked on Insert, Update, or Delete button that opens a popup form where they seized a reason Code and a Description of the transaction and then clicked a button Save.

    Here's what I did.
    Database side *.
    1 package database with a Record of PL/SQL and PL/SQL records in the Table variable declared in the Package specification.
    2. create INSERT_?, warning? and DELETE_? package procedures to manage integration, updates and deletions.
    Secondary forms *.
    1 create a table (control) Non-Base with all fields block
    2. create a button that performs a loop on the block and all values assigns to the variable of records in the Table (ToR) forms (typed off the DB package)
    3. pass the ToR to the appropriate database package procedure.

    Here is an example of the code I wrote:
    Database side *.
    Package specifications * (Note: replace with your database schema name) also note, I use PL/SQL Developer with the PLDoc plug-in so I documentation tags in my code.

    CREATE OR REPLACE PACKAGE .Transaction_Log_pkg IS
    -- Package Global Variables
    -- ------------------------
    TYPE rec_T_Log IS RECORD (
        table_name          .transaction_log.table_name%TYPE
       ,trans_type          .transaction_log.trans_type%TYPE
       ,trans_key           .transaction_log.trans_key%TYPE
       ,action              .transaction_log.action%TYPE
       ,column_name         .transaction_log.column_name%TYPE
       ,old_value           .transaction_log.old_value%TYPE
       ,new_value           .transaction_log.new_value%TYPE
       ,trans_date          .transaction_log.trans_date%TYPE
       ,user_id             .transaction_log.user_id%TYPE
       ,reason_code         .transaction_log.reason_code%TYPE
       ,comments            .transaction_log.comments%TYPE
       );
    
    TYPE tbl_T_Log IS TABLE OF rec_T_Log INDEX BY BINARY_INTEGER;
    
       -- Insert_Record --------------------------------------------------------------------------------
       /** Procedure adds "INSERT" audting records in to the CIR.TRANSACTION_LOG table
       %param      p_t_log      TABLE_OF_RECORDS
       %desc       You can pass a single record or a group of records.  Allows you to package up all of
                   the values inserted in a table and send them to the Insert_Record procedure as a
                   group rather than as individual transactions.
       -- ---------------------------------------------------------------------------------------------- */
       PROCEDURE Insert_Record (p_t_log tbl_T_Log );
    
       -- Update_Record --------------------------------------------------------------------------------
       /** Procedure adds a "UPDATE" record(s) in the CIR.TRANSACTION_LOG table
       %param      p_t_log      TABLE_OF_RECORDS
       %desc       You can pass a single record or a group of records if more than one value in a row is updated.
       -- ---------------------------------------------------------------------------------------------- */
       PROCEDURE Update_Record (p_t_log tbl_T_Log );
    
       -- Delete_Record --------------------------------------------------------------------------------
       /** Procedure adds "DELETE" records in to the CIR.TRANSACTION_LOG table
       %param      p_t_log      TABLE_OF_RECORDS
       %desc       You can pass a single record or a group of records.  Allows you to package up all of
                   the values inserted in a table and send them to the Delete_Record procedure as a
                   group rather than as individual transactions.
       -- ---------------------------------------------------------------------------------------------- */
       PROCEDURE Delete_Record (p_t_log tbl_T_Log );
    
    END Transaction_Log_pkg;
    

    Package body *.

    -- Beginning of Package Body -------------------------------------------------------------------------
    -- ---------------------------------------------------------------------------------------------------
    CREATE OR REPLACE PACKAGE BODY .Transaction_Log_pkg AS
       -- Package EXCEPTIONS
       -- ------------------
       null_table              EXCEPTION;
       null_table_name         EXCEPTION;
       null_trans_type         EXCEPTION;
       null_trans_key          EXCEPTION;
       null_action             EXCEPTION;
       null_column_name        EXCEPTION;
       null_value              EXCEPTION;
       null_user_Id            EXCEPTION;
       null_reason_code        EXCEPTION;
       null_comments           EXCEPTION;
    
       -- Package Variables
       -- -----------------
       vErrMsg                 VARCHAR2(1000);
       vSQL                    VARCHAR2(2000);
    
       -- ----------------------------------------------------------------------------------------------
       PROCEDURE Insert_Record (p_t_log tbl_T_Log ) IS
    
       BEGIN
          IF ( NVL(p_t_log.COUNT,0) = 0 ) THEN
             RAISE null_table;
          ELSE
    
             FOR i IN p_t_log.first .. p_t_log.last LOOP
                vSQL := 'INSERT INTO .transaction_log (seq_no,table_name,trans_type,trans_key,action'
                            ||',column_name,old_value,new_value,trans_date,user_id,reason_code,comments)'
                            ||' VALUES (.TRANSACTION_NO_SEQ.nextval';
    
                -- Build Insert Statement
                IF ( p_t_log(i).table_name IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).table_name||'''';
                ELSE
                   RAISE null_table_name;
                END IF;
                IF ( p_t_log(i).trans_type IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).trans_type||'''';
                ELSE
                   RAISE null_trans_type;
                END IF;
                IF ( p_t_log(i).trans_key IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).trans_key||'''';
                ELSE
                   RAISE null_trans_key;
                END IF;
                IF ( p_t_log(i).action IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).action||'''';
                ELSE
                   RAISE null_action;
                END IF;
                IF ( p_t_log(i).column_name IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).column_name||'''';
                ELSE
                   RAISE null_column_name;
                END IF;
                IF ( p_t_log(i).old_value IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).old_value||'''';
                ELSE
                   vSQL := vSQL||',NULL';
                END IF;
                IF ( p_t_log(i).new_value IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).new_value||'''';
                ELSE
                   RAISE null_value;
                END IF;
    
                --transaction_date
                vSQL := vSQL||',sysdate';
    
                IF ( p_t_log(i).user_id IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).user_id||'''';
                ELSE
                   RAISE null_user_id;
                END IF;
                IF ( p_t_log(i).reason_code IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).reason_code||'''';
                ELSE
                   RAISE null_reason_code;
                END IF;
                IF ( p_t_log(i).comments IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).comments||'''';
                ELSE
                   RAISE null_comments;
                END IF;
    
                vSQL := vSQL||')';
    
                dbms_output.put_line('vSQL = '||vSQL);
    
                EXECUTE IMMEDIATE vSQL;
    
                vSQL := NULL;
    
             END LOOP;
    
             -- The COMMIT is intentionally left out to force the calling
             -- application to perform the commit and complies with the
             -- basics of encapsulation.
             -- ---------------------------------------------------------
    
          END IF;
    
       EXCEPTION
          WHEN null_table THEN
             vErrMSg := 'The p_t_log Collection cannot be null!';
             RAISE_APPLICATION_ERROR(-20990,vErrMsg);
          WHEN null_table_name THEN
             vErrMSg := 'Table Name cannot be null!';
             RAISE_APPLICATION_ERROR(-20991,vErrMsg);
          WHEN null_trans_type THEN
             vErrMSg := 'Transaction Type cannot be null!';
             RAISE_APPLICATION_ERROR(-20992,vErrMsg);
          WHEN null_trans_key THEN
             vErrMSg := 'Transaction Key cannot be null!';
             RAISE_APPLICATION_ERROR(-20993,vErrMsg);
          WHEN null_action THEN
             vErrMSg := 'Action cannot be null!';
             RAISE_APPLICATION_ERROR(-20994,vErrMsg);
          WHEN null_column_name THEN
             vErrMSg := 'Column Name cannot be null!';
             RAISE_APPLICATION_ERROR(-20995,vErrMsg);
          WHEN null_value THEN
             vErrMSg := 'Value cannot be null!';
             RAISE_APPLICATION_ERROR(-20996,vErrMsg);
          WHEN null_user_Id THEN
             vErrMSg := 'User ID cannot be null!';
             RAISE_APPLICATION_ERROR(-20997,vErrMsg);
          WHEN null_reason_code THEN
             vErrMSg := 'Reason Code cannot be null!';
             RAISE_APPLICATION_ERROR(-20998,vErrMsg);
          WHEN null_comments THEN
             vErrMSg := 'Comments cannot be null!';
             RAISE_APPLICATION_ERROR(-20999,vErrMsg);
       END Insert_Record;
       -- ------------------------------------------------------------------------------------------------
    
       PROCEDURE Update_Record (p_t_log tbl_T_Log ) IS
    
       BEGIN
          IF ( NVL(p_t_log.COUNT,0) = 0 ) THEN
             RAISE null_table;
          ELSE
    
             FOR i IN p_t_log.first .. p_t_log.last LOOP
                vSQL := 'INSERT INTO .transaction_log (seq_no,table_name,trans_type,trans_key,action'
                            ||',column_name,old_value,new_value,trans_date,user_id,reason_code,comments)'
                            ||' VALUES (.TRANSACTION_NO_SEQ.nextval';
    
                -- Build Insert Statement
                IF ( p_t_log(i).table_name IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).table_name||'''';
                ELSE
                   RAISE null_table_name;
                END IF;
                IF ( p_t_log(i).trans_type IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).trans_type||'''';
                ELSE
                   RAISE null_trans_type;
                END IF;
                IF ( p_t_log(i).trans_key IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).trans_key||'''';
                ELSE
                   RAISE null_trans_key;
                END IF;
                IF ( p_t_log(i).action IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).action||'''';
                ELSE
                   RAISE null_action;
                END IF;
                IF ( p_t_log(i).column_name IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).column_name||'''';
                ELSE
                   RAISE null_column_name;
                END IF;
                IF ( p_t_log(i).old_value IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).old_value||'''';
                ELSE
                   vSQL := vSQL||',NULL';
                END IF;
                IF ( p_t_log(i).new_value IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).new_value||'''';
                ELSE
                   RAISE null_value;
                END IF;
    
                --transaction_date
                vSQL := vSQL||',sysdate';
    
                IF ( p_t_log(i).user_id IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).user_id||'''';
                ELSE
                   RAISE null_user_id;
                END IF;
                IF ( p_t_log(i).reason_code IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).reason_code||'''';
                ELSE
                   RAISE null_reason_code;
                END IF;
                IF ( p_t_log(i).comments IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).comments||'''';
                ELSE
                   RAISE null_comments;
                END IF;
    
                vSQL := vSQL||')';
    
                dbms_output.put_line('vSQL = '||vSQL);
    
                EXECUTE IMMEDIATE vSQL;
    
                vSQL := NULL;
    
             END LOOP;
    
             -- The COMMIT is intentionally left out to force the calling
             -- application to perform the commit and complies with the
             -- basics of encapsulation.
             -- ---------------------------------------------------------
    
          END IF;
    
       EXCEPTION
          WHEN null_table THEN
             vErrMSg := 'The p_t_log Collection cannot be null!';
             RAISE_APPLICATION_ERROR(-20990,vErrMsg);
          WHEN null_table_name THEN
             vErrMSg := 'Table Name cannot be null!';
             RAISE_APPLICATION_ERROR(-20991,vErrMsg);
          WHEN null_trans_type THEN
             vErrMSg := 'Table Name cannot be null!';
             RAISE_APPLICATION_ERROR(-20992,vErrMsg);
          WHEN null_trans_key THEN
             vErrMSg := 'Table Name cannot be null!';
             RAISE_APPLICATION_ERROR(-20993,vErrMsg);
          WHEN null_action THEN
             vErrMSg := 'Table Name cannot be null!';
             RAISE_APPLICATION_ERROR(-20994,vErrMsg);
          WHEN null_column_name THEN
             vErrMSg := 'Table Name cannot be null!';
             RAISE_APPLICATION_ERROR(-20995,vErrMsg);
          WHEN null_value THEN
             vErrMSg := 'Table Name cannot be null!';
             RAISE_APPLICATION_ERROR(-20996,vErrMsg);
          WHEN null_user_Id THEN
             vErrMSg := 'Table Name cannot be null!';
             RAISE_APPLICATION_ERROR(-20997,vErrMsg);
          WHEN null_reason_code THEN
             vErrMSg := 'Table Name cannot be null!';
             RAISE_APPLICATION_ERROR(-20998,vErrMsg);
          WHEN null_comments THEN
             vErrMSg := 'Table Name cannot be null!';
             RAISE_APPLICATION_ERROR(-20999,vErrMsg);
       END Update_Record;
       -- ------------------------------------------------------------------------------------------------
    
       PROCEDURE Delete_Record (p_t_log tbl_T_Log ) IS
    
       BEGIN
          IF ( NVL(p_t_log.COUNT,0) = 0 ) THEN
             RAISE null_table;
          ELSE
    
             FOR i IN p_t_log.first .. p_t_log.last LOOP
                vSQL := 'INSERT INTO .transaction_log (seq_no,table_name,trans_type,trans_key,action'
                            ||',column_name,old_value,new_value,trans_date,user_id,reason_code,comments)'
                            ||' VALUES (.TRANSACTION_NO_SEQ.nextval';
    
                -- Build Insert Statement
                IF ( p_t_log(i).table_name IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).table_name||'''';
                ELSE
                   RAISE null_table_name;
                END IF;
                IF ( p_t_log(i).trans_type IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).trans_type||'''';
                ELSE
                   RAISE null_trans_type;
                END IF;
                IF ( p_t_log(i).trans_key IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).trans_key||'''';
                ELSE
                   RAISE null_trans_key;
                END IF;
                IF ( p_t_log(i).action IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).action||'''';
                ELSE
                   RAISE null_action;
                END IF;
                IF ( p_t_log(i).column_name IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).column_name||'''';
                ELSE
                   RAISE null_column_name;
                END IF;
                IF ( p_t_log(i).old_value IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).old_value||'''';
                ELSE
                   vSQL := vSQL||',NULL';
                END IF;
                IF ( p_t_log(i).new_value IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).new_value||'''';
                ELSE
                   RAISE null_value;
                END IF;
    
                --transaction_date
                vSQL := vSQL||',sysdate';
    
                IF ( p_t_log(i).user_id IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).user_id||'''';
                ELSE
                   RAISE null_user_id;
                END IF;
                IF ( p_t_log(i).reason_code IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).reason_code||'''';
                ELSE
                   RAISE null_reason_code;
                END IF;
                IF ( p_t_log(i).comments IS NOT NULL ) THEN
                   vSQL := vSQL||','''||p_t_log(i).comments||'''';
                ELSE
                   RAISE null_comments;
                END IF;
    
                vSQL := vSQL||')';
    
                dbms_output.put_line('vSQL = '||vSQL);
    
                EXECUTE IMMEDIATE vSQL;
    
                vSQL := NULL;
    
             END LOOP;
    
             -- The COMMIT is intentionally left out to force the calling
             -- application to perform the commit and complies with the
             -- basics of encapsulation.
             -- ---------------------------------------------------------
    
          END IF;
    
       EXCEPTION
          WHEN null_table THEN
             vErrMSg := 'The p_t_log Collection cannot be null!';
             RAISE_APPLICATION_ERROR(-20990,vErrMsg);
          WHEN null_table_name THEN
             vErrMSg := 'Table Name cannot be null!';
             RAISE_APPLICATION_ERROR(-20991,vErrMsg);
          WHEN null_trans_type THEN
             vErrMSg := 'Table Name cannot be null!';
             RAISE_APPLICATION_ERROR(-20992,vErrMsg);
          WHEN null_trans_key THEN
             vErrMSg := 'Table Name cannot be null!';
             RAISE_APPLICATION_ERROR(-20993,vErrMsg);
          WHEN null_action THEN
             vErrMSg := 'Table Name cannot be null!';
             RAISE_APPLICATION_ERROR(-20994,vErrMsg);
          WHEN null_column_name THEN
             vErrMSg := 'Table Name cannot be null!';
             RAISE_APPLICATION_ERROR(-20995,vErrMsg);
          WHEN null_value THEN
             vErrMSg := 'Table Name cannot be null!';
             RAISE_APPLICATION_ERROR(-20996,vErrMsg);
          WHEN null_user_Id THEN
             vErrMSg := 'Table Name cannot be null!';
             RAISE_APPLICATION_ERROR(-20997,vErrMsg);
          WHEN null_reason_code THEN
             vErrMSg := 'Table Name cannot be null!';
             RAISE_APPLICATION_ERROR(-20998,vErrMsg);
          WHEN null_comments THEN
             vErrMSg := 'Table Name cannot be null!';
             RAISE_APPLICATION_ERROR(-20999,vErrMsg);
       END Delete_Record;
       -- ------------------------------------------------------------------------------------------------
    
    END Transaction_Log_pkg; -----------------------------------------------------------------------------
    -- ---------------------------------------------------------------------------------------------------
    

    Secondary forms * (all this coding was limited to the Insert, update or delete buttons.) The following example is the Insert button)

    /* When-Button-Pressed Trigger */
    DECLARE
         vBlockName     VARCHAR2(20) := 'REPORT_CATEGORIES';
         vBlockItem     VARCHAR2(61);
         vCurrItem      VARCHAR2(61);
         nRecCnt        NUMBER := 1;
    
         /* Here is where you create your Forms Variable TYPEd off the Package Table of Records (ToR) */
         /* Since it is a table of records, you could easily add multiple rows to the ToR if your form uses a multi-record block */
         p_tlog         cir.transaction_log_pkg.tbl_t_log;    
    
    BEGIN
         vCurrItem := vBlockName||'.'||Get_Block_Property(vBlockName,FIRST_ITEM);
    
         Go_Item(vCurrItem);
    
         -- 1. Endure each field if populated.
            -- 2. Check for Duplicates (Handled in W-V-I)
    
         IF ( Name_In(:system.Cursor_Item) IS NULL ) THEN
              --Fail the form at the field that is NULL
              send_alert.msg('s','All fields are required.  Please enter a unique value.');
              RAISE Form_Trigger_Failure;
         END IF;
    
         WHILE ( vCurrItem IS NOT NULL ) LOOP
              vBlockItem := :system.cursor_item;
    
              -- Loop through the block and CALL Insert_Record for each Block Item.
              /* 1 */ p_tlog(nRecCnt).table_name := vBlockName;
              /* 2 */ p_tlog(nRecCnt).trans_type := Name_In(vBlockName||'.CAT_TYPE');
              /* 3 */ p_tlog(nRecCnt).trans_key := Name_In(vBlockName||'.ID');
              /* 4 */ p_tlog(nRecCnt).action := 'INSERT';
              /* 5 */ p_tlog(nRecCnt).column_name := substr(vBlockItem,instr(vBlockItem,'.')+1,length(vBlockItem));
              /* 6 */ p_tlog(nRecCnt).old_value := NULL;
              /* 7 */ p_tlog(nRecCnt).new_value := Name_In(vBlockItem);
              /* 8 */ p_tlog(nRecCnt).trans_date := sysdate;
              /* 9 */ p_tlog(nRecCnt).user_id := :Global.userid;
              /*10 */ p_tlog(nRecCnt).reason_code := Name_In(vBlockName||'.REASON_CODE');
              /*11 */ p_tlog(nRecCnt).comments := Name_In(vBlockName||'.COMMENTS');
    
              vCurrItem := Get_Item_Property(vBlockItem,NEXTITEM);
              next_item;
              nRecCnt := nRecCnt + 1;
         END LOOP;
    
         -- 3. Insert
      -- Call TRANSACTION_LOG_PKG.Insert_Record
      -- --------------------------------------
      .transaction_log_pkg.insert_record(p_t_log => p_tlog);
    
         -- 4. Commit
         Commit;  
    
         -- 5. Clear Block
         Clear_Block(Ask_Commit);
    
         -- 6. Close Form
         Hide_Window('REPORT_CATEGORIES');
         -- 7. ReQuery RC_DISP Block
         Go_Block('REPORT_CATEGORIES_DISP');
         Clear_Block(No_Validate);
         Execute_Query;
         -- 8. Done
    END;
    

    I knew not when I started this process of forms if she was going to work because I tried to do something similar to this when I was working with Forms 6i and Oracle Enterprise Business Suite and Forms 6i supported not Ref Cursor and Table of documents very well so I didn't know at first if it would work. Search in forms documentation, I found that Forms 10 g has supported this type of functionality and this process works very well and it was surprisingly fast - at least in my usage, it is very fast. :)

    I hope this helps.
    Craig...

    If I or someone elses answer was useful, please mark accordingly

  • problem with writing a procedure with the name of the table as an input parameter

    Hi all

    I am writing a procedure with the table name as input parameter:
    Here is the code

    create or replace procedure CEP (in_tbl in varchar2)
    as
    Start

    run immediately 'truncate table tlb;

    Insert into tbl

    Select a, b, c of in_tbl;

    end;

    user579585 wrote:
    Hi all

    I am writing a procedure with the table name as input parameter:
    Here is the code

    create or replace procedure CEP (in_tbl in varchar2)
    as
    Start

    run immediately 'truncate table tlb;

    Insert into tbl

    Select a, b, c of in_tbl;

    end;

    You will also need to use dynamic sql for insert statements:

    execute immediate 'begin insert into tbl select a,b,c from '||in_tbl||'; end';
    
  • How can I restart firefox with the same tabs and windows?

    How can I restart firefox with the same tabs and windows?

    It is not in the file menu or tools. I get nothing when searching for help. FF still knows how to do it, say to update extensions.

    I know that I can do by saving my session, coming out, reboot and restore the session but is there a single command to do this?

    Thank you. -David

    I have attached a screenshot showing how to select restore automatic session just above the setting of the Home Page where it says "When Firefox starts".

    With this set, you can restart Firefox manually out using the menu-

    • "3-bar" menu button > button "power".
    • (menu bar) File > Exit

    -and then restart Firefox.

    If you want a real reboot with a click of button, you can check something on the Add-ons site: https://addons.mozilla.org/firefox/

Maybe you are looking for

  • Entire Internet sites showing that weird characters

    I tried to fix myself for several weeks, but some pages and Web sites appear like this and it's really bugging me. The same pages are very well on my laptop with Firefox. They work very well with Internet Explorer... Things I've tried: Following tuto

  • Images loading partially or completely, but appear truncated.

    Images on different sites, Twitter, Tumblr, and Polyvore appear completely distorted and not loading not all yet. Save the images doesn't help, as they appear distorted, as they did on the Web site. Internet Explorer has no problem, the same images f

  • Officejet 4500 G510n-z Software error: 4, [(3,42,0)]

    When I try to scan using the Solution Center I get the following error in the software: 4, [(3,42,0)] However, I CAN scan using the device utility, 1 page at a time.  I have Windows 7 64 bit with more than enough resourses of the pc.  I really need t

  • How to activate the load on my laptop USB ports

    ON MY BRAND-NEW LAPTOP DAUGHTER WITH WINDOWS 7 (64-BIT), ASKED HIM TO YOU YOU WANT TO USE THIS USB PORT TO CHARGE THIS DEVICE. WELL SHE SAID NO AND NOW WHEN SHE SOUND IPAD BRANCH KNOW IT PAD DON'T SE NOT CHARGING. The SEAMS of the USB TO WORK FINE, E

  • BlackBerry Smartphones BBM 6 (6.0.0.125) vs.111 (performed at betazone)

    Hello Anyone has the problem with the new BBM 6 (. 125) I used BBM6 (111) betazone then upgrade to BBM6 (. 125), well, I miss "to show what im listening to" in my profile. then downgrade again to BB6.111 (from offline files), and the problem now, I s