Parametrized query with output from sql

Hey all,
has anyone figure out how to use the database connectivity toolset to perform a parameterized query with outputs (SQL)? From the other threads that i have read it would seem that this issue is not resolved. The error i get is:
Error -2147467259 occurred at Cmd Execute.vi->getjobID.vi
Possible reason(s):
Exception occured in Microsoft OLE DB Provider for ODBC Drivers: [MySQL][ODBC 3.51 Driver][mysqld-5.0.50sp1a-enterprise-gpl-log]OUT or INOUT argument 3 for routine eln.lv_caperJob_create is not a variable or NEW pseudo-variable in BEFORE trigger in Rec Create - Command.vi->Cmd Execute.vi->getjobID.vi
However, In Toad for mysql the following call works:
set @outJobID=-999;
set @outMsg="";
call  lv_caperJob_create('TestJune30_2', '207', @outJobID, @outMsg);
select @outJobID, @outMsg
Attached is the LV code i am using. Thanks!
Attachments:
db code.JPG ‏50 KB

Your first approach gave you an error because it took the ? parameter inside the '%?%' string and treated it as whole string as '%?%'. As you set the parameter, it did not understood where it need to insert the parameter.
Your second approach is pretty much OK, only problem is you are trying to set the parameter with a string and aging creating the string while setting the parameter.
The solution will be to create the whole string before setting the parameter and set the created String as parameter on the query something like this.
String parameter = "%"+searchString+"%";
Then set the parameter string to the query.
Thanks

Similar Messages

  • I want to query oracle database from sql server can anyone tell steps 2 fo

    i want to query oracle database from sql server can anyone tell steps 2 followed
    i tried with linked servers but it is throwing errors can anyone hepl in this regard
    The operation could not be performed because the OLE DB provider 'MSDAORA' was unable to begin a distributed transaction.
    OLE DB error trace [OLE/DB Provider 'MSDAORA' ITransactionJoin::JoinTransaction returned 0x8004d01b].

    First of all - you are in the wrong forum.
    Look either for the Database general or search for Transparant / Heterogenous Gateways.
    cu
    Andreas

  • I want to query oracle database from sql server can anyone tell steps 2 fol

    i want to query oracle database from sql server can anyone tell steps 2 followed
    i tried with linked servers but it is throwing errors can anyone hepl in this regard
    The operation could not be performed because the OLE DB provider 'MSDAORA' was unable to begin a distributed transaction.
    OLE DB error trace [OLE/DB Provider 'MSDAORA' ITransactionJoin::JoinTransaction returned 0x8004d01b].

    First of all - you are in the wrong forum.
    Look either for the Database general or search for Transparant / Heterogenous Gateways.
    cu
    Andreas

  • Problem Calling MaxDB stored procedure with output from MII Query template

    Hi,
    I am using Max DB Database studio to write stored procedure, I am calling stored procedure from MII Query using CALL statement.
    Can anyone guide me how to pass output values of stored procedure.
    Examlpe::
    call ProcName('[Param.1]','[Param.2]','[Param.3]','[Param.4]','[Param.5]', :isSuccess, :Trace)
    In the above line of code I am not able to get the output values of stored procedure that is isSuccess and Trace values in Query template when executed. But same thing I get when executed in Database studio.
    How do I call with outputs for any stored procedure in MII.
    Any help would be appriciated.
    Thanks,
    Padma

    My call statement is like this
    call RESULTDATA_INSERT('[Param.1]','[Param.2]','[Param.3]', :isSuccess, :Trace)
    I am able to insert record in DB, But I am not getting output values in Query template.I have done this in Fixed Query, when I execute it throws me "Fatal error as Loaded content empty".
    I tried giving select below call but it dont work.
    Regards,
    Rao

  • Save output from sql

    Is it possible to save the output from a sql query which returns 260,000 rows? I can't save it with sqldeveloper. Five thousand lines were saved as a LST file in sqlplus and I cannot open it. How can I get the output from a sqlplus query saved as a csv file? What is the best method for saving the output?

    Spool it to a file
    http://www.oracle.com/pls/db102/search?remark=quick_search&word=spool&tab_id=&format=ranked
    or
    UTL_FILE
    http://www.oracle.com/pls/db102/search?word=UTL_FILE&partno=
    or
    APEX
    Edited by: hoek on Jun 12, 2009 7:50 PM

  • Creating a Query with Data from 4 Tables.

    Hey guys. I'm having a small problem figuring out the best way for me to handle this query.
    I'm trying to make a query which outputs the amount of appointments a GP has furfilled, and the total amount allowed.
    I have 4 tables, for each I'm just gonna list the relevent columns:
    Appointment: ID, Patient_ID.
    Patient: ID, GP_ID.
    GP: ID, Trust_ID.
    Trust: ID, Quota.
    Appointment table has 400 entries (2 per patient atm).
    Patient table has 200 entries.
    GP Table has 30 entries (GP's can be assigned to more than one person) .
    Trust table has 6 entries.
    What I need to do is, look at the appointment table and get the number of times each patient has an appointment.
    Go through the patient table, and find out which GP the patient in the appointment belongs to.
    Add each occurance to the correct GP.
    Find out which Trust each GP belongs to, and add the total for each GP to the correct Trust.
    Check the quota in the Trust table, to see if the total is more than the allowed.
    I can't seem to think of an easy or simple way for me to do this. Can anyone help please? Many thanks.

    Hi,
    That sounds like a job for JOIN.
    To check the quotas against the total, use the SUM function; either the aggregate SUM or the analytic SUM, depending on your requirements.
    Sorry this answer is so vague, but that's the bes I can do with the information provided so far.
    Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved. In this case, between 2 and 10 rows of data per table should be enough to show what you need to do.
    Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
    Always say which version of Oracle you're using.

  • BEx query with variant from ABAP

    Hello,
    I'm looking for possibility to start BEx query with variant (variant is created with tx RSRT) from ABAP. There are some funktion modules, which start queries (launch excel), for example RSAH_LAUNCH_EXCEL or RSSEM_QUERY_LAUNCH, but they are ending with short dump, when there are variables in the query. Is there any standard FM, which starts the query with variant or accepts parameters?
    regards,
    Krzysztof

    Hi,
    the short dump was my fault, I've passed query name instead of genuniid to the RSAH_LAUNCH_EXCEL.
    What I'm trying to do is to I'll start BEx query with parameters (I don't want to get selection-screen from the query, I need to fill it from ABAP).
    Here is my example, which is not working.
    DATA:
      lv_query(30) TYPE c,
      lv_genuniid  TYPE rsrrepdir-genuniid,
      ls_var       TYPE rrx_var,
      lt_var       TYPE TABLE OF rrx_var.
    lv_query = 'YB_MAKLER_DETAIL'.
    CALL FUNCTION 'CONVERSION_EXIT_GENID_INPUT'
      EXPORTING
        input  = lv_query
      IMPORTING
        output = lv_genuniid.
    IF lv_genuniid = ''.
      WRITE: / 'There is no Query', lv_query.
    ELSE.
      ls_var-vnam = 'YS_MKLE'.
      ls_var-sign = 'I'.
      ls_var-opt  = 'EQ'.
      ls_var-low  = '0000005100'.
      APPEND ls_var TO lt_var.
      ls_var-vnam = 'YS_VTGJ'.
      ls_var-sign = 'I'.
      ls_var-opt  = 'EQ'.
      ls_var-low  = '1999'.
      APPEND ls_var TO lt_var.
      CALL FUNCTION 'RSAH_LAUNCH_EXCEL'
        EXPORTING
          i_genuniid                       = lv_genuniid
          I_OBJVERS                        = 'A'
          i_hide_sapgui                    = 'X'
        TABLES
          I_T_VAR                          = lt_var.
    ENDIF.
    If parameter 'i_hide_sapgui' is empty, I'm getting empty selection-screen,
    If parameter 'i_hide_sapgui' equals 'X' I'm getting selection-screen filled with values, which were used last time manualy, not with values from the internal table 'lt_var'.
    Do you have any idea how to pass parameters to the query with this function module?
    Regards,
    Krzysztof

  • Query with 'different from' clause in Sqlite

    My question is very simple:
    How can I submit a query with a 'different from' clause into a table.
    In AIR, I would like to query :
    "select * from myTable where myField <> 'value' ";
    but it does'nt work !
    Nor
    "select * from myTable where myField != 'value' ";
    nor
    "select * from myTable where myField is not 'value' ";
    is it impossible to query with a 'different from' clause in Sqlite wih Adobe Air

    Hello,
    SQLite in AIR does support 'different from' and '<>' is the correct operator. Take the following emp table for example:
    id
    name
    age
    1
    A
    26
    2
    B
    30
    3
    C
    28
    If you want to query the records whose name isn't A. The following SQL is correct:
    select * from emp where name <> 'A'
    Thanks,
    Yang

  • Query with variant from ABAP

    Hello!
    I need to execute a BW-query from an Abap-report.
    I tried it already with function module 'RRW3_GET_QUERY_VIEW_DATA' and with classes / objects 'CL_RSR_REQUEST' resp. 'CL_RSR_DATA', but:
    I want to use the query with a variant, which could be found in table RSRPARAMETRIZA.
    (Btw: even with a variant in table RSRVARIANTDIR  I don't get the results wanted...)
    Is there a direct way to call a BW-query with a variant from Abap?
    Alternatively: How do I get the variant-contents? Is there a 'universal' way to work with both kinds of variants? (RSRVARIANTDIR / RSRPARAMETRIZA) 
    Thanks in advance.

    Thanks for the link.
    Well, I already read that document and I followed the links to the former blogs on this subject.
    But this solution doesn't work for me: CL_RSR_QUERY_VARIABLES is unknown.
    I read the pdf and the function-module-code, but I still don't have an idea how to work with query- variants . The example-coding includes a line
    DATA: wf_variant TYPE variant .
    but that's not used, or is it?
    (I don't have a set of variables and conditions, but just a variant-name. The variant will be created by other people, who would start my report.)
    Greetings

  • Set value in af:query with value from method

    hello all
    i have problem, when they want set value in af:query (inputText) with value from method, how to do that?
    anyone help..?
    thx
    agungdmt

    Hi,
    are you facing this issue when you try to show few values on right side (selected list) of shuttle component.
    what is your usecase exactly ?

  • Query with Tables from another Database

    Hi.
    I have a problem with a Query that executes a stored procedure that inserts data in a Table from another DataBase. The problem is when I try to execute a Query with the data related of that table using the user parameters of SBO ('[%0]'....'[%3]'). I use the following parameters for reference to the Table:
    "....FROM [-BDName-].[dbo].[-TableName-] T1..... "
    Any suggestions? Thanks a lot....
    (Suggestions in English or Spanish)

    None

  • Creating JTree with results from SQL Query

    I have the following source in SQLJ:
    String temp=null;
    iter1 it1;
    iter2 it2;
    #sql it1={select id,fdn,level from groups connect by prior fdn=parent_fdn start with fdn='/' };
    while(it1.next())
    System.out.println(it1.id()); // Display Parent
    temp=it1.fdn();
    #sql it2= {select clli from nes where parent_fdn=:temp order by clli };
    while(it2.next())
    System.out.println(it2.clli());//Display Child of above Parent if any
    My problem is to construct a Tree GUI using JTree from the above
    code with the same hierarchy of parent-child relationship.
    I have tried every possible solution using Vectors,Hashtables,String Arrays etc but have not come up with a successful solution so far
    IF ANYONE HAS A SOLUTION PLEASE HELP ME WITH AN EXAMPLE.
    Thank You
    Sharath

    sharathkv,
    Your issue seems to be in figuring out an algorithm to convert row-based SQL resultsets to a hierarchical data structure suitable for display in a tree.
    Run the jython (www.jython.org) app below: it simulates doing just that. jython is indentation-sensitive, so you'll need to exercise care when copying. If copy-paste to a text editor doesn't work, copy-paste to a HTML-aware editor (even Outlook Express, if on Windows), then copy from there and paste in a text editor.
    --A
    This is a jython (www.jython.org) app that illustrates
    converting row-based data (eg. a SQL resultset) to a custom
    hierarchical data structure, and displaying it in a JTree.
    from javax.swing import *
    from javax.swing.tree import *
    import java
    def getSQLRows():
        Simulates a SQL resultset.
        Columns fdn and parent-fdn indicate parent/child relationships.
        rows = [
            # id, fdn, parent-fdn, level
              [1, '/', None, 1]
            , [2, '/fruits', '/', 2]
            , [3, '/colors', '/', 2]
            , [4, '/sports', '/', 2]
            , [5, '/fruits/apples', '/fruits', 3]
            , [6, '/fruits/oranges', '/fruits', 3]
            , [7, '/colors/red', '/colors', 3]
            , [8, '/colors/blue', '/colors', 3]
            , [9, '/sports/petanc', '/sports', 3]
            , [10, '/sports/rugby', '/sports', 3]
        return rows
    def convertRowsToHierarchy(rows):
        Converts row-based results to hierarchical structure.
        Uses known parent/child relations present in rows.
        root = None
        for row in rows:
            fdn, parentfdn = row[1], row[2]
            node = SQLTreeNode(fdn, parentfdn)
            if root:
                root.addEx(node)
            else:
                root = node
        return root
    class SQLTreeNode(java.lang.Object):
        '''Custom tree node; displayed in JTree'''
        def __init__(self, fdn, parentfdn):
            self.fdn = fdn
            self.parentfdn = parentfdn
            self.nodes = []
        def add(self, node):
            '''Adds node as immediate child'''
            self.nodes.append(node)
        def addEx(self, node):
            '''Adds-with-search.  NOTE: naive implementation'''
            if self.fdn == node.parentfdn:
                self.add(node)
            else:
                for child in self.nodes:
                    child.addEx(node)
        def toString(self):
            return self.fdn
        def dump(self):
            '''Debug routine to dump hierarchy'''
            print 'fdn=%s, parentfdn=%s' % (self.fdn, self.parentfdn)
            for node in self.nodes:
                node.dump()
    class SQLTreeModelAdapter(TreeModel):
        '''Tree model adapter: adapts custom data structure to TreeModel'''
        def __init__(self, root):
            self.__root = root
        def getChild(self, parent, index):
            return parent.nodes[index]
        def getChildCount(self, parent) :
            return len(parent.nodes)
        def getIndexOfChild(self, parent, child):
            return parent.nodes.index(child)
        def getRoot(self) :
            return self.__root
        def isLeaf(self, node):
            return len(node.nodes) == 0
        def addTreeModelListener(self, l):
            pass
        def removeTreeModelListener(self, l):
            pass
        def valueForPathChanged(self, path, newValue):
            pass
    class SQLTreeDemo(JFrame):
        Tree demo UI
        Displays a tree displaying [hierarchical] results
        of a BOM-type SQL query
        def __init__(self):
            # Get matrix simulating SQL resultset
            rows = getSQLRows()
            # Convert to custom hierarchical data structure
            root = convertRowsToHierarchy(rows)
            model = SQLTreeModelAdapter(root)
            tree = JTree(model)
            sp = JScrollPane(tree)
            self.contentPane.add(sp)
            self.size = 200, 300
    if __name__ == '__main__':
        s = SQLTreeDemo()
        s.visible = 1

  • How to get the desire output from sql query

    Consider an Order Table: ...
    Order Table:
    Order Id Item Qty
    O1 A1 5
    O2 A2 1
    O3 A3 3
    Please provide SQL which will explode the above data into single unit level records as shown below
    Desired Output:
    Order Id Order Id Qty
    O1 A1 1
    O1 A1 1
    O1 A1 1
    O1 A1 1
    O1 A1 1
    O2 A2 1
    O3 A3 1
    O3 A3 1
    O3 A3 1

    How do I ask a question on the forums?
    SQL and PL/SQL FAQ

  • Need help with writing a query with dynamic FROM clause

    Hi Folks,
    I need help with an query that should generate the "FROM" clause dynamically.
    My main query is as follows
    select DT_SKEY, count(*)
    from *???*
    where DT_SKEY between 20110601 and 20110719
    group by DT_SKEY
    having count(*) = 0
    order by 1; The "from" clause of the above query should be generated as below
    select 'Schema_Name'||'.'||TABLE_NAME
    from dba_tables
    where OWNER = 'Schema_Name'Simply sticking the later query in the first query does not work.
    Any pointers will be appreciated.
    Thanks
    rogers42

    Hi,
    rogers42 wrote:
    Hi Folks,
    I need help with an query that should generate the "FROM" clause dynamically.
    My main query is as follows
    select DT_SKEY, count(*)
    from *???*
    where DT_SKEY between 20110601 and 20110719
    group by DT_SKEY
    having count(*) = 0
    order by 1; The "from" clause of the above query should be generated as below
    select 'Schema_Name'||'.'||TABLE_NAME
    from dba_tables
    where OWNER = 'Schema_Name'
    Remember that anything inside quotes is case-sensitive. Is the owner really "Schema_Name" with a capital S and a capital N, and 8 lower-case letters?
    Simply sticking the later query in the first query does not work.Right; the table name must be given when you compile the query. It's not an expression that you can generate in the query itself.
    Any pointers will be appreciated.In SQL*Plus, you can do something like the query bleow.
    Say you want to count the rows in scott.emp, but you're not certain that the name is emp; it could be emp_2011 or emp_august, or anything else that starts with e. (And the name could change every day, so you can't just look it up now and hard-code it in a query that you want to run in the future.)
    Typically, how dynamic SQL works is that some code (such as a preliminary query) gets some of the information you need to write the query first, and you use that information in a SQL statement that is compiled and run after that. For example:
    -- Preliminary Query:
    COLUMN     my_table_name_col     NEW_VALUE my_table_name
    SELECT     table_name     AS my_table_name_col
    FROM     all_tables
    WHERE     owner          = 'SCOTT'
    AND     table_name     LIKE 'E%';
    -- Main Query:
    SELECT     COUNT (*)     AS cnt
    FROM     scott.&my_table_name
    ;This assumes that the preliminary query will find exactly one row; that is, it assumes that SCOTT has exactly one table whose name starts with E. Could you have 0 tables in the schema, or more than 1? If so, what results would you want? Give a concrete example, preferably suing commonly available tables (like those in the SCOTT schema) so that the poepl who want to help you can re-create the problem and test their ideas.
    Edited by: Frank Kulash on Aug 11, 2011 2:30 PM

  • Problem with output from  report to excel, calling the report from form 10g

    Hi everyone, I'm having a problem generating a excel from a report, which is called from a form, I'm using Forms 10g. The problem is this: My report has a variable number of columns. These columns appear according to data obtained from the database, these columns are dates, In vesion 6 excel file generated shows the columns one after another starting in column A1 to column CP. I mean that the dates are correlative. But in version 10g the excel file generated shows the same report starting in column A to column T, only shows the 20 dates correlative corresponding to this columns, the rest of the dates are down the excel sheet in groups of 20 dates, it's something, the file in 6i grows across and in 10g grows down the excel sheet. The report (rdf file) is the same in 6i and 10g, I compiled the 6i version to obtain the 10g version. The excel sheet generated in 10g looks like the report was in pdf format, because PDF format, cuts the report in pages and the file grows down, if I generate the report in PDF format it has the same structure excel file in 10g has. I hope yo can help because I have days trying to solve this but I have no succes. If someone could help I could email the excel files generated in two versions. Here I put the code I use to generate the files in 6i and 10g. I have tried with DESFORMAT=SPREADSHEET in 10g but the result is the same. Thanks for your help. Greetings for all.
    Code for version 6i (Works Very well)
    PROCEDURE GUARDAREXCEL IS
    pl_id ParamList;
    nom_rep varchar2(20);
    cla_rep varchar2(20);
    cod_dis varchar2(4);
    nom_arch varchar2(100);
    fec date;
    BEGIN
    pl_id := Get_Parameter_List('tmpdata');
    IF NOT Id_Null(pl_id) THEN
    Destroy_Parameter_List( pl_id );
    END IF;
    pl_id := Create_Parameter_List('tmpdata');
    IF :BK_PARAMETROS.LI_COD_DIS IS NOT NULL THEN
    cod_dis := :BK_PARAMETROS.LI_COD_DIS;
    END IF;
    IF :BK_PARAMETROS.TI_COD_CLI IS NOT NULL THEN
    Add_Parameter(pl_id,'P_COD_CLI',TEXT_PARAMETER,:BK_PARAMETROS.TI_COD_CLI||'%');
    ELSE
    Add_Parameter(pl_id,'P_COD_CLI',TEXT_PARAMETER,'%');
    :BK_PARAMETROS.TI_COD_CLI:='%';
    END IF;
    IF :BK_PARAMETROS.CLAS_REP=1 THEN
    cla_rep := '001';
    ELSE
         IF :BK_PARAMETROS.CLAS_REP=2 THEN
              cla_rep := '002';
         ELSE
              IF :BK_PARAMETROS.CLAS_REP=3 THEN
              cla_rep := '003';
         ELSE
              cla_rep := '004';
         END IF;
         END IF;
    END IF;
    Add_Parameter(pl_id,'P_COD_DIS',TEXT_PARAMETER, cod_dis);
    Add_Parameter(pl_id,'P_FECHA',TEXT_PARAMETER,to_char(:BK_PARAMETROS.FECFIN, 'DD/MM/YYYY'));
    Add_Parameter(pl_id,'P_CLASE',TEXT_PARAMETER, cla_rep);
    Add_Parameter(pl_id,'PARAMFORM',TEXT_PARAMETER,'NO');
    Add_Parameter(pl_id,'DESTYPE',TEXT_PARAMETER,'File');
    Add_Parameter(pl_id,'MODE',TEXT_PARAMETER,'Character');
    Add_Parameter(pl_id,'DESFORMAT',TEXT_PARAMETER,'DELIMITED' );
    select sysdate into fec from dual;
    IF :BK_PARAMETROS.TIPO_REP=1 THEN
         BEGIN
    nom_rep := 'tdvenrli1577.rep';
    nom_arch := 'c:\windows\temp\RepCobranzaPlanos' || TO_CHAR(fec, 'ddmmyyyy') || '.xls';
    END;
    ELSIF :BK_PARAMETROS.TIPO_REP=2 THEN
              BEGIN
              nom_rep := 'tdvenrli1578.rep';
              nom_arch := 'c:\windows\temp\RepCobranzaLargos' || TO_CHAR(fec, 'ddmmyyyy') || '.xls';
              END;
    ELSIF :BK_PARAMETROS.TIPO_REP=3 THEN
         BEGIN
                        Add_Parameter(pl_id,'P_XLS',TEXT_PARAMETER, '1');           
              nom_rep := 'tdvenrli1576.rep';
              nom_arch := 'c:\windows\temp\RepCobranzaDetallados' || TO_CHAR(fec, 'ddmmyyyy') || '.xls';      
              END;
    ELSE
              BEGIN
                        nom_rep := 'TDVENRLI1545.REP';
              nom_arch := 'c:\windows\temp\RepCobranzaTodos' || TO_CHAR(fec, 'ddmmyyyy') || '.xls';
              END;
    END IF;
    --Add_Parameter(pl_id,'DESNAME',TEXT_PARAMETER,nom_arch );
    Add_Parameter(pl_id,'DESNAME',TEXT_PARAMETER, nom_arch);
    standard.commit;
    Run_Product(REPORTS, nom_rep, SYNCHRONOUS, runtime, FILESYSTEM, pl_id,'');
    EXCEPTION WHEN Run_Product_Failure THEN
    message('Error');
    END;
    Code for version 10g
    PROCEDURE GUARDAREXCEL IS
    pl_id ParamList;
    nom_rep varchar2(20);
    cla_rep varchar2(20);
    cod_dis varchar2(4);
    nom_arch varchar2(100);
    fec date;
    --byt12122007.sn
    repid REPORT_OBJECT;
         vURL VARCHAR2(500);
         rep_status VARCHAR2(20);
         vJobID VARCHAR2(100);
         v_rep VARCHAR2(100);
    VAR NUMBER;
    w_name_repserv VARCHAR2(30);
    --byt1212007.en
    BEGIN
         --w_name_repserv:=F_OBTIENE_SERVREP;
    w_name_repserv:='repserv';     
    pl_id := Get_Parameter_List('mytmp_params');
    IF NOT Id_Null(pl_id) THEN
    Destroy_Parameter_List( pl_id );
    END IF;
    pl_id := Create_Parameter_List('mytmp_params');
    IF :BK_PARAMETROS.LI_COD_DIS IS NOT NULL THEN
         cod_dis := :BK_PARAMETROS.LI_COD_DIS;
    END IF;
    IF :BK_PARAMETROS.TI_COD_CLI IS NOT NULL THEN
    Add_Parameter(pl_id,'P_COD_CLI',TEXT_PARAMETER,:BK_PARAMETROS.TI_COD_CLI||'%');
    ELSE
    Add_Parameter(pl_id,'P_COD_CLI',TEXT_PARAMETER,'%');
    :BK_PARAMETROS.TI_COD_CLI:='%';
    END IF;
    IF :BK_PARAMETROS.CLAS_REP=1 THEN
    cla_rep := '001';
    ELSE
         IF :BK_PARAMETROS.CLAS_REP=2 THEN
              cla_rep := '002';
         ELSE
              IF :BK_PARAMETROS.CLAS_REP=3 THEN
              cla_rep := '003';
         ELSE
              cla_rep := '004';
         END IF;
         END IF;
    END IF;
    Add_Parameter(pl_id,'P_COD_DIS',TEXT_PARAMETER, cod_dis);
    Add_Parameter(pl_id,'P_FECHA',TEXT_PARAMETER,to_char(:BK_PARAMETROS.FECFIN, 'DD/MM/YYYY'));
    Add_Parameter(pl_id,'P_CLASE',TEXT_PARAMETER, cla_rep);
    Add_Parameter(pl_id,'PARAMFORM',TEXT_PARAMETER,'NO');
    /*Add_Parameter(pl_id,'DESTYPE',TEXT_PARAMETER,'File');
    Add_Parameter(pl_id,'MODE',TEXT_PARAMETER,'Character');
    Add_Parameter(pl_id,'DESFORMAT',TEXT_PARAMETER,'DELIMITED' );*/
    select sysdate into fec from dual;
    IF :BK_PARAMETROS.TIPO_REP=1 THEN
    BEGIN
         repid := find_report_object('tdvenrli1577');
    --nom_rep := 'tdvenrli1577.rep';
    nom_arch := 'c:\windows\temp\RepCobranzaPlanos' || TO_CHAR(fec, 'ddmmyyyy') || '.xls';
    SET_REPORT_OBJECT_PROPERTY(repid, REPORT_FILENAME,'tdvenrli1577');
    END;
    ELSIF :BK_PARAMETROS.TIPO_REP=2 THEN
    BEGIN
         repid := find_report_object('tdvenrli1578');      
              --nom_rep := 'tdvenrli1578.rep';
              nom_arch := 'c:\windows\temp\RepCobranzaLargos' || TO_CHAR(fec, 'ddmmyyyy') || '.xls';
              SET_REPORT_OBJECT_PROPERTY(repid, REPORT_FILENAME,'tdvenrli1578');
              END;
    ELSIF :BK_PARAMETROS.TIPO_REP=3 THEN
    BEGIN
         repid := find_report_object('tdvenrli1576');
                        Add_Parameter(pl_id,'P_XLS',TEXT_PARAMETER, '1');           
              --nom_rep := 'tdvenrli1576.rep';
              nom_arch := 'c:\windows\temp\RepCobranzaDetallados' || TO_CHAR(fec, 'ddmmyyyy') || '.xls';
              SET_REPORT_OBJECT_PROPERTY(repid, REPORT_FILENAME,'tdvenrli1576');     
              END;
    ELSE
    BEGIN
         repid := find_report_object('tdvenrli1545');
                        --nom_rep := 'TDVENRLI1545.REP';
              nom_arch := 'c:\windows\temp\RepCobranzaTodos' || TO_CHAR(fec, 'ddmmyyyy') || '.xls';
              SET_REPORT_OBJECT_PROPERTY(repid, REPORT_FILENAME,'tdvenrli1545');     
              END;
    END IF;
    --Add_Parameter(pl_id,'DESNAME',TEXT_PARAMETER,nom_arch );
    --Add_Parameter(pl_id,'DESNAME',TEXT_PARAMETER, nom_arch);
    standard.commit;
    SET_REPORT_OBJECT_PROPERTY(repid, REPORT_DESNAME,nom_arch);
    SET_REPORT_OBJECT_PROPERTY(repid, REPORT_COMM_MODE, SYNCHRONOUS);
         SET_REPORT_OBJECT_PROPERTY(repid, REPORT_EXECUTION_MODE, RUNTIME);
         SET_REPORT_OBJECT_PROPERTY(repid, REPORT_DESTYPE, 'File');
         SET_REPORT_OBJECT_PROPERTY(repid, REPORT_DESFORMAT, 'DELIMITED');
         SET_REPORT_OBJECT_PROPERTY(repid, REPORT_SERVER, w_name_repserv);
         SET_REPORT_OBJECT_PROPERTY(repid, REPORT_OTHER, 'paramform=no');
         v_rep := RUN_REPORT_OBJECT(repid, pl_id);
         rep_status := REPORT_OBJECT_STATUS(v_rep);
         WHILE rep_status IN ('RUNNING','OPENING_REPORT','ENQUEUED')     LOOP
              rep_status:= report_object_status(v_rep);
         END LOOP;
         IF rep_status = 'FINISHED' THEN
              vJobID := SUBSTR(v_rep, INSTR(v_rep, '_', -1)+1);
              vURL:='/reports/rwservlet/getjobid'||vJobID||'?'||'server='||w_name_repserv;
         END IF;
         WEB.SHOW_DOCUMENT(vURL, '_blank');
         IF NOT form_success THEN
              MESSAGE('Error: PL/SQL held against Button failed to execute');
              RAISE FORM_TRIGGER_FAILURE;
         END IF;
    /*Run_Product(REPORTS, nom_rep, SYNCHRONOUS, runtime, FILESYSTEM, pl_id,'');
    EXCEPTION WHEN Run_Product_Failure THEN
    message('Error');*/
    END;

    There are two problems with your VI.  First, the basic logic of writing/appending to a file (Excel, TDMS, anything) should go something like this:  Open the file, position yourself at the end of the file, then, in the loop, acquire data and write it to the file until you are finished with data acquisition.  When you exit the acquire/write to file loop, then close the file.  In particular, the opening and the closing of the file should not be inside the loop.
    As others have pointed out, writing to Excel might not be optimal, particularly if you are acquiring data at a high rate (and would therefore be writing a lot of data). We actually use Excel in our data acquisition routine, mainly reading from a WorkSheet to get the parameters of a particular stimulus, but also writing the outcome of the response to the stimulus.  As it happens, our "acquisition rate" in this example is on the order of several samples per minute, so there's no problem using Excel (we also sample 16 channels of analog data at 1 KHz -- this gets written as a binary file).
    Second, if you really do want to use Excel, use the (existing) Excel file to which you want to append as the "template" argument of the New Report function.  Then use the Excel Get Last Row function to position yourself at "end of file", as noted above.
    Good Luck.
    Bob Schor

Maybe you are looking for