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.

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 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.
    
  • 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;
    
  • 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 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

  • Procedure with the DML statements that insert values from 1 to 100 in only one table and it is matching word equivalent in the other

    Can someone help me create a procedure with the DML statements that insert values from 1 to 100 in a table "abc" and the procedure must connect the numbers into words in another table "xyz" without doing a commit explicitly. "."

    Currently on trial...

    SQL > create table abc (num number);

    Table created.

    SQL > create table xyz (num varchar2 (100));

    Table created.

    SQL > ed
    A written file afiedt.buf

    1. insert all
    2 values of 1 = 1 then in abc (num) (l)
    3 when the values of 1 = 1 then in xyz (num) (to_char (to_date(l,'j'), 'jsp'))
    4 * Select the level from dual connect by level<=>
    SQL > /.

    200 rows created.

    And the result...

    SQL > select * from abc;

    NUM
    ----------
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    ..
    ..
    ..
    98
    99
    100

    100 selected lines.

    SQL > select * from xyz;

    NUM
    ----------------------------------------------------------------------------------------------------
    one
    two
    three
    four
    five
    six
    seven
    eight
    nine
    ten
    Eleven
    twelve
    ..
    ..
    ..
    98
    Nineteen eighty
    Cent

    100 selected lines.

  • What is the most trouble free Mac OS to use with the collection master CS6? (not CC)

    What is the most trouble free Mac OS to use with the collection master CS6? (not CC)

    Unless 10.10 has features you really need, a restore is logical. It's a pain, but if you can't do the job, this is what is needed.

    Roll back MacOS is outside these forums, but I don't know that apple Support you can get to the right help. That's all I can say.

    Gene

  • 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;
      }
    }
    
  • I bought Halo 2 for Vista, but who like OS Windows XP Pro, just can't launch the startup.exe, I search the community, there is a rumor that it won't work even with the patch. Can someone help, please?

    I bought Halo 2 for Vista, but who like OS Windows XP Pro, just can't launch the startup.exe, I search the community, there is a rumor that it won't work even with the patch. Can someone help, please?

    Unfortunately, Halo 2 does support Windows Vista and more.  Windows XP is not supported.  There may be 3 party hacks that can make it work, but they are not taken in charge and potentially dangerous.

    Paul Smith - MVP for Windows desktop experience... I crawled off NNTP - for now. Detachment Aldershot, United Kingdom. On the internet at windowsresource.net and dasmirnov.net. Please post back to let us know what works and what does not. :-)

  • In my laptop that is Explorer.exe does not load at startup on my account, his work with the guest account. Also it does not manually with the new process. Kindly help out me

    Remember - this is a public forum so never post private information such as numbers of mail or telephone!

    Ideas: in my laptop is Explorer.exe does not load at startup on my account, his work with the guest account. Also it does not manually with the new process. Kindly help me.

    I have seen at redistry Edit it's explorer.exe in winlogin sell attribute.

    Hi HiteshAstan,

    one) don't you recall making any changes to the computer before this happened?

    (b) what exactly happens when you sign in to your account?  You get a specific error message?

    Step 1: Let us check if the problem persists in safe mode

    Access the menu advanced startup options by turning on your computer and pressing the F8 key before Windows starts. In the advanced startup options select safe mode

    http://Windows.Microsoft.com/en-us/Windows-Vista/advanced-startup-options-including-safe-mode

     

    If the problem persists, you can deduct that the user account is corrupted

    Step 2: Create a new administrator account and then try to repair your user account

     

    Create-a-user account

    http://Windows.Microsoft.com/en-us/Windows-Vista/create-a-user-account

    Difficulty of a corrupted user profile

    http://Windows.Microsoft.com/en-us/Windows-Vista/fix-a-corrupted-user-profile

    After the back if you have any questions

    Thank you, and in what concerns:

    Ajay K

    Microsoft Answers Support Engineer

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Clear the cache in connection with the collection

    Hello

    I create a report by using the .one problem collection has to happen when I hide any column in the report.
    Enter the value in the report and press Add button line to add the new line to insert the new record, and the previous value is to clear the cache.

    How can I remove this problem.

    and another question

    could you send me a link or sample report where the collection is used with multiple cascading select list more then select three list.



    Thank you
    Maury

    Maury,

    Have you written a PL/SQL process that updates the data in the collection, whenever any button is clicked? A collection is not updated by the SUBMIT button or add a LINE unless you write the code to make - table normal function tabular forms can use the MRU deals, but it can not be used when you use a collection, so you must write code to update the collection every time that the page is sent.

    I sent a link to an application that uses three LOVs cascading - as I said in my other thread, this is not based on a collection, but the LOV is nothing to do with the collections. In addition, even if it is based on 3 lists, you can extend that to 4, or more, lists easily enough as it is still used for each list after the first principle.

    Andy

  • Sir, iam not at all satisfied with the functionality of windows vista, I need immediate upgrading to windows 7, please please give me this, I have the version of the license of vista,.

    Remember - this is a public forum so never post private information such as numbers of mail or telephone!

    Ideas:

    • Programs you are Sir, iam, not at all satisfied with the functionality of windows vista, I need immediate upgrading to windows 7, please please give me this, I have the version of the license for vista, problems with
    • Error messages
    • Recent changes to your computer
    • What you have already tried to solve the problem

    For any question on Windows 7:

    http://social.answers.Microsoft.com/forums/en-us/category/Windows7

    Link above is Windows 7 Forum for questions on Windows 7.

    Windows 7 questions should be directed to the it.

    You are in the Vista Forums.

    See you soon.

    Mick Murphy - Microsoft partner

  • problem with the collection and refcursor

    I have the 'ServerDisconnect2' function below. It should return as 'ref_cursor' on the parameter that is a data container of deleted rows slider, Java developers insist on using this type of data/collection. I don't know how to code to return the values of ID removed as 'ref_cursor '. See commented "open pDeleteList" - sentence, it is commented as does not compile.
    CREATE OR REPLACE PACKAGE oe_ctx AS
      TYPE gIntegerTable IS TABLE OF INTEGER INDEX BY BINARY_INTEGER;
      TYPE cursor_type IS REF CURSOR;
    ....
    
      PROCEDURE ServerDisconnect2(pCasinoCode NUMERIC, pCasinoServerCode NUMERIC, pChannelServerCode CurrentLogins.ChannelServerCode%TYPE, pDeleteList OUT cursor_type) 
      IS
        vDeleteList oe_ctx.gIntegerTable;
      BEGIN
        DELETE FROM
        (
           SELECT cl.* FROM CurrentLogins cl, Accounts a
           WHERE cl.CasinoCode = pCasinoCode
           AND cl.CasinoServerCode = pCasinoServerCode
           AND cl.ChannelServerCode = pChannelServerCode
           AND cl.Code = a.code
           AND a.Type = 'lplayer'
           ORDER BY a.code
        ) RETURNING Code
          BULK COLLECT INTO vDeleteList;
          
    /*    OPEN pDeleteList FOR
          SELECT * FROM TABLE(vDeleteList);*/
          
        COMMIT;
      END ServerDisconnect2;
    Is it possible to convert the variable 'vDeleteList' in ref_cursor?
    So my only solution would be to open the ref_cursor BEFORE delete-clause with the same query delete clause has. But I'm afraid that then after opening the instant cursor after a milliseconds the deletion clause removes different lines and the procedure would be data incorrect in pDeleteList.

    Published by: CharlesRoos on August 26, 2010 06:10

    You need a collection of sql (created with CREATE TYPE...):

    I'll use the predefined collection sys.odcivarchar2list demonstation purposes:

    SQL> var cur refcursor
    
    SQL> declare
       ret_coll       sys.odcivarchar2list;
    begin
       delete from emp
         returning ename
              bulk collect into ret_coll;
    
       open :cur for select * from table (ret_coll);
    end;
    /
    PL/SQL procedure successfully completed.
    
    SQL> print
    
    COLUMN_VALUE
    -----------------------------------------------------------------------------------------------------------------------------
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLER                                                                                                                       
    
    14 rows selected.
    
  • Problem with the Collection

    I have problems of filling of a collection.
    I created my collection on page load of the Page 7 for help
    BEGIN
    
    apex_collection.create_or_truncate_collection
      (p_collection_name => 'PEOPLE');
    
    END;
    The user then clicks on the "Copy" button that brings them to the Page 13.
    That's where I'm trying to complete my collection, by clicking on the link add to the report of the population.
    for x in (select * from gus_people_2 where id = :P13_ID)
    loop
      apex_collection.add_member(p_collection_name => 'PEOPLE', 
        p_c001 => x.id,
        p_c002 => x.rank,
        p_c003 => x.first_name,
        p_c004 => x.surname,
        p_c005 => x.dob,
        p_c006 => x.job,
        p_c007 => x.disp_seq);
    end loop;
    Once added, the Member of the collection should appear in the report of the full Collection.
    select c001, c002, c003, c004, c005, c006, c007, 'Remove' remove
    from apex_collections
    where collection_name = 'PEOPLE'
    I use Apex 4.1 on the Oracle website

    http://Apex.Oracle.com/pls/Apex/f?p=4550:1:0:

    Workspace: GUSCRIGHTON
    Username: ANGUS. [email protected]
    Password: terminator

    Application name: EXCEL_UPDATE_TEST

    Same username and password as described above.

    It's probably something really obvious, but I can't place it today.

    Any help appreciated.

    Gus

    Hi gUS,.
    Now, run your page, it will work.
    Thank you
    Loga

    Add the collection process
    Ask = exp1
    'ADD' - removed single quotes

    Remove the collection process

    Ask = exp1

    DEL - I gave this string.
    You will add later with link or a button.

    Published by: Logaa on May 18, 2012 06:04

Maybe you are looking for

  • You can underclock graphics card to get them to work with your power supply?

    I am looking to buy a NVIDIA Quadro graphics card, which consists of a two card graphics, said it requires 350W, but I have only a 300W PSU. I wonder if there are ways to underclock graphics cards, or in this case to get only one of the two works, wh

  • Clear explanation of the name of the channel on IVI Drivers

    Hello I'm using Labview 8.0 assessment to write a program which will include a 35 - 5 p Xantrex XDL DC Power Supply to automate a test. It has only one exit. I installed the drivers XDL and IVI Compliance Package. However, I'm still struggling with t

  • CLIP IS taken in charge by Xilinx Spartan3E driver for LabVIEW 8.6?

    CLIP IS taken in charge by Xilinx Spartan3E driver for LabVIEW 8.6? For the HDL interface node, enable and multi channel clock domain is difficult to understand

  • Photosmart C4585

    I've damaged my power connector for my all in one printer, Buy a new one? Thanks regards Magsx1

  • Screen unresponsive

    Recently started having a problem with my touchpad I consistantly work on it for a set time period (30 min) and the screen no longer responds to Tush.  I can click on the "Center" button and it will switch to map view, but click or drag around the sc