How to load decimal values into a file using bcp in SQL Server 2000?

Hi everyone,
I'm trying to load data from a database table to a text file using bcp on SQL Server 2000. When I'm loading the decimal values, the values before the decimal are not being loaded into the file. How could I load the values before decimals?
Here are the DDLs and DMLs of what I'm trying to run:
CREATE TABLE [dbo].[Product_Sales](
[Year_of_Sale] [smallint] NOT NULL,
[Product_Type] [varchar](25) NOT NULL,
[Product_Group] [varchar](25) NOT NULL,
[Category_Type] [varchar](25) NOT NULL,
[Category_Group] [varchar](10) NOT NULL,
[Product_Count] [bigint] NOT NULL,
[Product_Amount] [decimal](19, 2) NOT NULL,
[Category_Count] [bigint] NOT NULL,
[Category_Amount] [decimal](19, 2) NOT NULL,
CONSTRAINT [PK_Product_Sales] PRIMARY KEY CLUSTERED
[Year_of_Sale] ASC,
[Product_Type] ASC,
[Product_Group] ASC,
[Category_Type] ASC,
[Category_Group] ASC
) ON [PRIMARY]
) ON [PRIMARY]
INSERT INTO [Yearly_Sales].[dbo].[Product_Sales]
VALUES(2010, 'Online', 'Web', 'Cameras', 'Electronics', 547, 0.00, 0, 0.00)
EXEC [master].[dbo].[xp_cmdshell] 'bcp "SELECT * FROM [Yearly_Sales].[dbo].[Product_Sales]" queryout D:\Yearly_Sales\Product_Sales.dat -c -T -S'
And the output I see in the file is:
2010 Online Web Cameras Electronics 547 .00 0 .00
The values before decimals are being truncated.
Thanks,
Bangaaram
Known is a DROP, Unknown is an OCEAN.

You can modify the decimal column(s) in the table to varchar type before export. But it does not look good.
alter table [dbo].[Product_Sales]
Alter column [Product_Amount] varchar(20)
alter table [dbo].[Product_Sales]
Alter column [Category_Amount] varchar(20)
Does that make any sense?
Known is a DROP, Unknown is an OCEAN.
Basically you modify the decimal column to a varchar type before you run the bcp command for export. You can modify your source table or you can modify them on the fly. It is just a workaround.
Modifying the source wouldn't be a good idea. Never do that if you can't get your desired output.
Known is a DROP, Unknown is an OCEAN.

Similar Messages

  • Create Fiat File Using Trigger in SQL Server

    Dear All,
        How to Create a Flat File using Trigger in SQL Server?

    Take a look at osql/sqlcmd, bcp, COM calls, xp_cmdshell, etc.  Here are a few links with code examples:
    https://www.simple-talk.com/sql/t-sql-programming/reading-and-writing-files-in-sql-server-using-t-sql/
    http://www.nigelrivett.net/SQLTsql/WriteTextFile.html
    http://stackoverflow.com/questions/8132663/creating-a-text-file-on-local-machine-using-sql-server-2008
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • How to update the value in xml file using transformer after setNodeValue

    Hi,
    This is my code
    I want to set update the values in xml file using transformer..
    Any one can help me
    This is my Xml file
    <?xml version="1.0" encoding="UTF-8"?>
    <place>
    <name>chennai</name>
    </place>
    Jsp Page
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@ page import="javax.xml.parsers.DocumentBuilderFactory,
    javax.xml.parsers.DocumentBuilder,org.w3c.dom.*,org.w3c.dom.Element"
    %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    </head>
    <body>
    <% String str="";
    String str1="";
    try
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.parse("http://localhost:8084/XmlApplication1/sss.xml");
    out.println("Before change");
    NodeList n11 = doc.getElementsByTagName("name");
    Node n22= n11.item(0).getFirstChild();
    str1 = n22.getNodeValue();
    out.println(str1);
    out.println("After change");
    String name = "Banglore";
    NodeList nlst = doc.getElementsByTagName("name");
    Node node= nlst.item(0).getFirstChild();
    node.setNodeValue(name);
    NodeList n1 = doc.getElementsByTagName("name");
    Node n2= n1.item(0).getFirstChild();
    str = n2.getNodeValue();
    out.println(str);
    catch(Exception e)
    out.println(e) ;
    %>
    <h1><%=str%></h1>
    <%--
    This example uses JSTL, uncomment the taglib directive above.
    To test, display the page like this: index.jsp?sayHello=true&name=Murphy
    --%>
    <%--
    <c:if test="${param.sayHello}">
    <!-- Let's welcome the user ${param.name} -->
    Hello ${param.name}!
    </c:if>
    --%>
    </body>
    </html>

    hi check this exit...
    IWO10012

  • How to load data dynamically into target tables using files as a source

    Hi ,
    My scenario needs a single interface to load the data of 5 different files into five target tables using a single interface. All target tables have the same structure. It is possible to point to variable source files using ODI. But the same approach is not working with Database tables. I am getting errors while trying to make my target /source table as a dynamic one.
    Can anybody suggest anything. The last option would be writing a dynamic PL/SQL block in the KM. Any other suggestions friends ?
    Regards,
    Atish

    After creating a pair of identical source and target tables, I have carried out the following steps:
    I am trying just keeping the target as variable
    a)created a one to one interface,
    b)tested that it is running.
    c)created a variable(type =text),
    d)used the variable as #v_name in the resource of the target table datastore.
    e)in a package used the variable in a set variable step (first step).
    f) used the interface as the second step.
    g)executed the same in my context.
    the <project_code>.variable_name is not getting substituted in the sql_code that is generated by the KM. My KM is SQL Control Append and following is the code that it generates in the Insert into I$ step:
    /* DETECTION_STRATEGY = NOT_EXISTS */
    insert /*+ APPEND */ into HR.I$_JOBS_COPY1
         JOB_ID,
         JOB_TITLE,
         MIN_SALARY,
         MAX_SALARY,
         IND_UPDATE
    select      
         JOBS.JOB_ID     JOB_ID,
         JOBS.JOB_TITLE     JOB_TITLE,
         JOBS.MIN_SALARY     MIN_SALARY,
         JOBS.MAX_SALARY     MAX_SALARY,
         'I' IND_UPDATE
    from     HR.JOBS JOBS
    where     (1=1)
    and not exists (
         select     'X'
         from     HR.#PLAYGROUND."v_tab_name" T
         where     T.JOB_ID     = JOBS.JOB_ID
              and     ((JOBS.JOB_TITLE = T.JOB_TITLE) or (JOBS.JOB_TITLE IS NULL and T.JOB_TITLE IS NULL))
              and     ((JOBS.MIN_SALARY = T.MIN_SALARY) or (JOBS.MIN_SALARY IS NULL and T.MIN_SALARY IS NULL))
              and     ((JOBS.MAX_SALARY = T.MAX_SALARY) or (JOBS.MAX_SALARY IS NULL and T.MAX_SALARY IS NULL))
         )

  • How to load this value into the master data display attribute

    Hi ,
    Please share me the knowldege how to load this kind of data into master data display attribtes ..
    Raj + Ravi Ltd (PCG: 13592)
    While loading this data ,i got the error message stating that '+' should not be part of the attributes and () should not be part of the attribute ..but i need all the information as it is available in the example data .
    Do i need to maintain RSKC Settings else some other things required ..
    Please guide me ..
    Regards,
    Raj

    HI,
    Maintain these symbols in RSKC and try to reload the data....

  • How to load dynamically String into a VI using LabVIEW Run-time Engine Version 7.0?

    I would like to be able to traduce string into my application using import string method. I create an program with my VI to translate. When I use the import method, I get this error: the VI is locked. WHY ? because it works well in the edit mode but not using LabVIEW Run-time Engine Version 7.0 .

    Hello loup,
    If you call dynamically a VI in your LabVIEW application you must add this VI when you build the .exe file.
    To add this VI, go to the Tab "Source Files" when you build application and click on "Add Dynamic VI..." then chose the VI you call.
    It should solve your problem.
    In the attached file you can found an example of LV program that translate front panel.
    Try to build exe file and add "Languages.vi" as dynamic VI and .txt files as "Support files".
    I test it, it works.
    I hope that this will help you.
    Best Regards,
    Sanaa T
    National Instruments
    Attachments:
    Translation.zip ‏69 KB

  • How to read a spread sheet ( .xls ) file using a pl/sql procedure or func

    Hello All,
    Is it possible to read a spread sheet using Oracle pl.sql .
    I know their is a util package that is read a file but how to read a spread sheet ... ?
    thanks
    kumar

    hi kumar,
    Here is an example of how i read an excel file
    DECLARE
    l_start_file_name varchar2(50) := 'invoice_excel_c';
    l_end_file_name varchar2(50)   := '.csv';
    l_file_name varchar2(100);
    l_sql varchar(32767);
    refresh_cdc varchar2(5) := '00304';
    begin
    l_file_name := l_start_file_name||REFRESH_CDC||l_end_file_name;
    l_sql :=
    'create table exter_invoice_excel               '||
    '(                                              '||
    'Product_name                varchar2(255),     '||
    'Net_Sales                   Number,            '||
    'Net_Adjustments             Number,            '||
    'Cancels_Count               Number,            '||
    'Cancels_Amount              Number,            '||
    'Cashes_Count                Number,            '||
    'Cashes_Amount               Number,            '||
    'Claims_Count                Number,            '||
    'Claims_Amount               Number,            '||
    'Returns_Count               Number,            '||
    'Returns_Amount              Number,            '||
    'Free_Prize_Count            Number,            '||
    'Free_Prize_Amount           Number,            '||
    'Free_Promo_Count            Number,            '||
    'Free_Promo_Amount           Number,            '||
    'Promo_Credit_Count          Number,            '||
    'Promo_Credit_Amount         Number,            '||
    'Return_Commission           Number,            '||
    'Net_Discounts               Number,            '||
    'Total_Fees                  Number,            '||
    'Sales_Commission            Number,            '||
    'Cash_Commission             Number,            '||
    'Tkt_Charge                  Number,            '||
    'Subscription_Commission     Number,            '||
    'Interim_Sweeps              Number,            '||
    'Net_Due                     Number,            '||
    'Retailer_id                 Number,            '||
    'Retailer_Name               varchar2(255)      '||
    ')                                              '||
                  'ORGANIZATION EXTERNAL (                 '||
                  ' TYPE oracle_loader                     '||
                   ' DEFAULT DIRECTORY GTECHFILES          '||
                   ' ACCESS PARAMETERS (                   '||
                   '   RECORDS DELIMITED BY NEWLINE        '||
                   '      CHARACTERSET WE8MSWIN1252        '||
                   '   BADFILE ''invoice_excel.bad''       '||
                   '   DISCARDFILE ''invoice_excel.dis''   '||
                   '   LOGFILE ''invoice_excel.log''       '||
                   '   FIELDS TERMINATED BY '','' RTRIM      '||
                   '  MISSING FIELD VALUES ARE NULL        '||
                   '   )                                   '||
                   '   LOCATION ('''||l_file_name||''')    '||
                   ' )                                     '||
                   'PARALLEL                               '||
                   'REJECT LIMIT UNLIMITED ';
            execute immediate l_sql;
          l_sql:=  'INSERT INTO INVOICE_EXCEL_TEMP                '||
                      ' ( Product_name               ,            '||
                      '  Net_Sales                   ,            '||
                      '  Net_Adjustments             ,            '||
                      '  Cancels_Count               ,            '||
                      '  Cancels_Amount              ,            '||
                      '  Cashes_Count                ,            '||
                      '  Cashes_Amount               ,            '||
                      '  Claims_Count                ,            '||
                      '  Claims_Amount               ,            '||
                      '  Returns_Count               ,            '||
                      '  Returns_Amount              ,            '||
                      '  Free_Prize_Count            ,            '||
                      '  Free_Prize_Amount           ,            '||
                      '  Free_Promo_Count            ,            '||
                      '  Free_Promo_Amount           ,            '||
                      '  Promo_Credit_Count          ,            '||
                      '  Promo_Credit_Amount         ,            '||
                      '  Return_Commission           ,            '||
                      '  Net_Discounts               ,            '||
                      '  Total_Fees                  ,            '||
                      '  Sales_Commission            ,            '||
                      '  Cash_Commission             ,            '||
                      '  Tkt_Charge                  ,            '||
                      '  Subscription_Commission     ,            '||
                      '  Interim_Sweeps              ,            '||
                      '  Net_Due                     ,            '||
                      '  Retailer_id                 ,            '||
                      '  Retailer_Name               ,            '||
                      '  SOURCE                      ,            '||
                      '  INSERTED_DATE               ,            '||
                      '  CDC                         ,            '||
                      '  UPLOADED                                 '||
                      ')                                          '||
    '              select                                         '||
                      '  ltrim(rtrim(product_name)) ,             '||
                      '  Net_Sales                   ,            '||
                      '  Net_Adjustments             ,            '||
                      '  Cancels_Count               ,            '||
                      '  Cancels_Amount              ,            '||
                      '  Cashes_Count                ,            '||
                      '  Cashes_Amount               ,            '||
                      '  Claims_Count                ,            '||
                      '  Claims_Amount               ,            '||
                      '  Returns_Count               ,            '||
                      '  Returns_Amount              ,            '||
                      '  Free_Prize_Count            ,            '||
                      '  Free_Prize_Amount           ,            '||
                      '  Free_Promo_Count            ,            '||
                      '  Free_Promo_Amount           ,            '||
                      '  Promo_Credit_Count          ,            '||
                      '  Promo_Credit_Amount         ,            '||
                      '  Return_Commission           ,            '||
                      '  Net_Discounts               ,            '||
                      '  Total_Fees                  ,            '||
                      '  Sales_Commission            ,            '||
                      '  Cash_Commission             ,            '||
                      '  Tkt_Charge                  ,            '||
                      '  Subscription_Commission     ,            '||
                      '  Interim_Sweeps              ,            '||
                      '  Net_Due                     ,            '||
                      '  Retailer_id                 ,            '||
                      '  Retailer_Name               ,            '||               
                      ' '''||l_file_name                           ||''', '||
                      '   sysdate                    ,            '||
                      ' '''||    REFRESH_CDC                       ||''', '||
                      '''N'''                                      || 
                      'FROM                                       '||
                      'exter_invoice_excel                        '||
                      'WHERE retailer_id is not null and ltrim(rtrim(product_name)) in (''Loto'',''Inst Tk'')';
            execute immediate l_sql;   
            l_sql :='drop table exter_invoice_excel';
            execute immediate l_sql;
    exception
    when others then
    rollback;
    l_sql :='drop table exter_invoice_excel';
    execute immediate l_sql;
    debug_message('INVOICE_EXCEL_UPLOAD/'||REFRESH_CDC,'Unexpected Error '||sqlerrm);
    END;
    --truncate table invoice_excel_tempjust go through the code, it would help u for sure
    cheers

  • How to import data from a text file through DTS to Sql Server

    Please don't mistake me as i'm a new comer to sql server,please help me.
    how to import the data present in a plain text file through DTS into sql server and store the data in a temporary table.
    How far the temporary table is stored in the database.
    Please reply me as soon as possible.
    Thank you viewers.

    >
    I can say that anybody with
    no experience could easily do an export/import in
    MSSQLServer 2000.
    Anybody with no experience should not mess up my Oracle Databases !

  • How to Load Arabic Data from flat file using SQL Loader ?

    Hi All,
    We need to load Arabic data from an xls file to Oracle database, Request you to provide a very good note/step to achieve the same.
    Below are the database parameters used
    NLS_CHARACTERSET AR8ISO8859P6
    nls_language american
    DB version:-10g release 2
    OS: rhel 5
    Thanks in advance,
    Satish

    Try to save your XLS file into CSV format and set either NLS_LANG to the right value or use SQL*Loader control file parameter CHARACTERSET.
    See http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_control_file.htm#i1005287

  • How to insert a picture into excel file using ALE AUTOMATION

    Hi every body,
    I have to write report that export data from abap to exel the data contain a logo but I don't know how to insert picture to excel using ALE AUTOMATION.
    Please help me!
    Thank you!

    Hi,
    you have to join into SAP Code Exchange and download this zip:
    [ABAP2XLSX_daily.nugg.zip|http://code.sdn.sap.com/spaces/abap2xlsx/documents/btFzHQ3vKr36tCeJe7bhNc/download/btFzHQ3vKr36tCeJe7bhNc]
    Regards,
    Ivan

  • Query on text file using Openrowset in Sql server 2012

    Hi,
    I am using below query on Sql server 2008 and sql server 2012.It is working find in 2008 but giving error in 2012.
    below is query and error on sql 2012
    select * from OpenRowset('MSDASQL', 'Driver={Microsoft Access Text Driver (*.txt, *.csv)};DefaultDir=D:\MSSQL;',
     'select * from employee1.txt')
    OLE DB provider "MSDASQL" for linked server "(null)" returned message "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified".
    Msg 7303, Level 16, State 1, Line 1
    Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "(null)".
    I have read some document on msdn and install microsoft access database engine 2010, but still it not working.
    Can anyone suggest resolution of this problem.
    Thanks
    Shitalkumar kasliwal

    Read this link
    http://calyansql.blogspot.co.il/2013/02/fix-cannot-initialize-data-source.html
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • How we write into properties file using get class method

    Hi
    I want to set some value into properties file using given code
    can any one please tell me how i can do this.
    property file
    setting.properties
    Name     =     abc
    and code I use is
    java.io.InputStream oInputStream = this.getClass().getResourceAsStream("Setting.properties");
                   Properties obj = new Properties();
                   obj.load(oInputStream);
                   String myName = obj.getProperty("Name");
                   System.out.println("myName :"+myName);
                   obj.setProperty("Name","def");
                   FileOutputStream oOutput= new FileOutputStream("Setting.properties");
                   obj.store(oOutput, "");
    thanks.

    You can't.
    If you have properties that change dynamically, you should not be using a properties file that sits in the classpath, you should be using Preferences, or a properties file that sits in some application or possibly even user directory, but not one in the classpath. The proper way to do this, would be to have a properties file in your jar (or otherwise in your classpath) that contains the defaults, and another one outside of the classpath in one of the twwo above mentioned areas, then, you read the default one only if the other doesn't exist, or you read the default one first, then read the other overwriting the values from the defaults.
    Don't forget to save the properties again (right after loading if you loaded, or always load, the defaults) after every change.

  • How to get JDev 10.1.2/ADF working with MS SQL Server Identity Column

    Hello JDevTeam & JDevelopers,
    I want to use JDev/ADF with a MS SQL Server 2005 database that contains tables employing IDENTITY Columns.
    Using JDev/ADF and DBSequence with an Oracle database employing before triggers/sequences accomplishes what I am trying to do except I want to accomplish the same thing using a MSSQL Server 2005 database. Unfortunately I cannot change the database.
    I have been able to select records but I am unable to insert records (due to my lack of knowledge) when using MS/SQL Server Identity Columns with JDev/ADF.
    The following are the steps taken thus far.
    Step1: Create table named test in the 2005 MSSQL Server (see script below).
    Step2: Register 3rd Party JDBC Driver with JDeveloper; Using use Tools/Manage Libraries. Create a new entry in User Libraries with the following;
         Library Name     = Ms2005Jdbc
         Class Path     = C:\dev\Ms2005Jdbc\sqljdbc_1.0\enu\sqljdbc.jar
         (note: Latest TYPE 4 JDBC driver for Microsoft SQL Server 2005 - free at http://msdn.microsoft.com/data/ref/jdbc/)
    Step3:Create New Database Connection;
         Connection Name = testconn1
         Type = Third Party JDBC Driver
         Authentication Username = sa, Password = password, Check Deploy Password
         Connection
              Driver Class = com.microsoft.sqlserver.jdbc.SQLServerDriver     
              Library = Ms2005Jdbc     
              Classpath = C:\dev\Ms2005Jdbc\sqljdbc_1.0\enu
              URL = jdbc:sqlserver://192.168.1.151:1433;instanceName=sqlexpress;databaseName=test
         Test Connection = Success!
    Step5: Create a new application workspace using Web Application default template
    Step6: In Model project, Create new Business Components Diagram.
    Step7: Create new Entity Object. Goto to connections/testconn1, open tables and drag table test onto the diagram.
    Step8: Generate Default Data Model Components by right-clicking on Entity Object. Except all the defaults.
    When I test the Appmodule I select the view object and can scroll through all the records without error. If I try to insert a record, I get JBO-27014: Attribute testid in test is required.
    Going back to the EntityObject I deselect the Mandatory attribute and re-run the test. Now when I try to insert it accepts the value for testname but it does not update the PK testid like it would using an "JDev/ADF/DBSequence/Oracle database/before trigger/sequence" solution.
    Going back to the EntityObject and selecting refresh on insert does not solve this problem either. Changing the URL connection string and adding "SelectMethod=cursor" did not help and changing the SQl Flavor to SQLServer produced errors in the Business Components Browser. I've tried overriding isAttributeChanged() and other things as well.
    I am totally stuck! Can anyone provide a solution?
    Thanks for you help,
    BG...
    Create table named test
    use [testdb]
    go
    set ansi_nulls on
    go
    set quoted_identifier on
    go
    create table [test](
         [testid] [int] identity(0,1) not null,
         [testname] [nvarchar](50) collate sql_latin1_general_cp1_ci_as not null,
    constraint [pk_test] primary key nonclustered
         [testid] asc
    )with (pad_index = off, ignore_dup_key = off) on [primary]
    ) on [primary]

    Figured it out!
    When using the MS SQL Server 2000 Database with the MS JDBC 2000 Driver you specify the SQL Flavor to SQLServer. However setting the SQL Flavor to SQLServer with MS SQL Server 2005 Database and the MS JDBC 2005 Driver will *** fail ***.
    When working with the MS SQL Server 2005 Database and the MS JDBC 2005 Driver you set the SQL Flavor to SQL92 and the Type Map to Java.
    If using a named instance like I am you would specify the URL = jdbc:sqlserver://<db host ip address>:<listening port>;instanceName=<your instance name>;selectMethod=cursor;databaseName=<your database name> (note: leave out the < >)
    The 2005 Driver Class is different then the 2000 and is specified as com.microsoft.sqlserver.jdbc.SQLServerDriver
    Note: In a default MS SQL Server 2005 installation the listening port will change *** everytime *** the host is restarted! You can override this though.
    For the primary key you need to deselect the Mandatory attribute in the EntityObject editor.
    Set Refresh on insert/update = no.
    Set Updateable = never.
    Now my Primary Keys which get their values from the Identity Column are working with ADF in a predictable way.
    Simple enough but I have been away from this stuff for awhile.
    BG...

  • How to Load the data from excel file(Extension is .CSV) into the temp.table

    Hi
    How to Load the data from excel file(Extension is .CSV) into the temporary table of oracle in Forms11g.
    My Forms Version is - Forms [64 Bit] Version 11.1.2.0.0 (Production)
    Kindly Suggest the Solution.
    Regards,
    Sachin

    Hello Sachin,
    You can use the following metalink note:How to Read Data from an EXCEL Spreadsheet into a Form Using Webutil Client_OLE2 (Doc ID 813535.1) and modify it a little bit.
    Instead of copy values into forms you can save them in your temporary table.
    Kind regards,
    Alex
    If someone's helpful or correct please mark it accordingly.

  • How to load the data from excel file into temprory table in Forms 11g?

    Hi
    How to Load the data from excel file(Extension is .CSV) into the temporary table of oracle in Forms11g.
    My Forms Version is - Forms [64 Bit] Version 11.1.2.0.0 (Production)
    Kindly Suggest the Solution.
    Regards,
    Sachin

    Declare
        v_full_filename         varchar2(500);
        v_server_path           varchar2(2000);
        v_separator             VARCHAR2(1);
        v_filename              VARCHAR2(400);
        filename                VARCHAR2 (100);
        v_stop_load             varchar2 (2000);
        v_rec_error_log         varchar2(4000);
        v_error_log             varchar2(4000);
        ctr                     NUMBER (12);
        cols                    NUMBER (2);
        btn                     number;
        RES                     BOOLEAN;   
        application             ole2.obj_type;
        workbooks               ole2.obj_type;
        workbook                ole2.obj_type;
        worksheets              ole2.obj_type;
        worksheet               ole2.obj_type;
        cell                    ole2.obj_type;
        cellType                ole2.OBJ_TYPE;
        args                    ole2.obj_type;
        PROCEDURE olearg
        IS
        args   ole2.obj_type;
        BEGIN
        args := ole2.create_arglist;
        ole2.add_arg (args, ctr);                                
        ole2.add_arg (args, cols);                                   
        cell := ole2.get_obj_property (worksheet, 'Cells', args);
        ole2.destroy_arglist (args);
        END;
    BEGIN
    v_full_filename := client_get_file_name(directory_name => null
                                     ,file_name      => null
                                     ,file_filter    => 'Excel  files (*.xls)|*.xls|'  
                                                                            ||'Excel  files (*.xlsx)|*.xlsx|'                                                                 
                                     ,message        => 'Choose Excel file'
                                     ,dialog_type    => null
                                     ,select_file    => null
    If v_full_filename is not null Then
    v_separator := WEBUTIL_CLIENTINFO.Get_file_Separator ;
    v_filename := v_separator||v_full_filename ;
    :LOAD_FILE_NAME := substr(v_filename,instr(v_filename,v_separator,-1) + 1);                                
    RES := Webutil_File_Transfer.Client_To_AS(v_full_filename,"server_path"||substr(v_filename,instr(v_filename,v_separator,-1) + 1));     
    --Begin load data from EXCEL
    BEGIN
        filename := v_server_path||substr(v_filename,instr(v_filename,v_separator,-1) + 1); -- to pick the file
        application := ole2.create_obj ('Excel.Application');
        ole2.set_property (application, 'Visible', 'false');
        workbooks := ole2.get_obj_property (application, 'Workbooks');
        args := ole2.create_arglist;
        ole2.add_arg (args, filename); -- file path and name
        workbook := ole2.get_obj_property(workbooks,'Open',args);
        ole2.destroy_arglist (args);
        args := ole2.create_arglist;
        ole2.add_arg (args, 'Sheet1');
        worksheet := ole2.get_obj_property (workbook, 'Worksheets', args);
        ole2.destroy_arglist (args);
        ctr := 2;                                                     --row number
        cols := 1;                                                -- column number
        go_block('xxx');
        FIRST_RECORD;  
        LOOP       
                --Column 1 VALUE --------------------------------------------------------------------
            olearg;
            v_stop_load := ole2.get_char_property (cell, 'Text'); --cell value of the argument
            :item1 := v_stop_load;
            cols := cols + 1;                                                      
              --Column 2 VALUE --------------------------------------------------------------------
            olearg;
            :item2 := ole2.get_char_property (cell, 'Text'); --cell value of the argument
            cols := cols + 1;
            --<and so on>
        ole2.invoke (application, 'Quit');
        ole2.RELEASE_OBJ (cell);
        ole2.RELEASE_OBJ (worksheet);
        ole2.RELEASE_OBJ (worksheets);
        ole2.RELEASE_OBJ (workbook);
        ole2.RELEASE_OBJ (workbooks);
        ole2.RELEASE_OBJ (application);
    END;
    --End load data from EXCELPlease mark it as answered if you helped.

Maybe you are looking for

  • Transferring iphoto's from my old imac to my new Christmas imac

    How do I transfer all the photos? The 'library' does not want to be dragged anywhere

  • Generate SOAP Template

    The SOAP Message functionality show in error at the time of SOAP Response Message. can u plz guide me ... SOAP Response Message <?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body> <SOAP

  • Unable to open a custom form. FRM-47023 error.

    Hello experts, I am currently in a 11i to R12.1.3 upgrade and trying to open a custom form in R12. I compiled the form in forms builder 10.1.2.3.0 and in the db with no errors. When I try to open it in the apps it displays the following error message

  • I don't know how to USE my remote control on my AUDIGY 2 ZS Platinum

    I followed the instructions on this page: http://support.creative.com/kb/showa....aspx?sid=2965 about activating my remote control for my AUDIGY 2 ZS Platinum but mediasource did not have a remote control option tab as you can see here... Untitled.jp

  • Need Help on connecting 8i to Microsoft Active Directory.

    Some one can point me all the following documents 1) Setup MS active directory 2) How to connect oracle 8i with MS active directory. 3) How to create the database users with MS active directory password maintenance. Please help me with example. null