Write records into a file

CREATE OR REPLACE PROCEDURE test IS
    cursor    cur is
      select dname||';'||loc dnlo
      from   dept;
  rec          cur%ROWTYPE;
  v_returncode number;
BEGIN
   open cur;
   loop
       fetch cur into rec;
       exit when cur%notfound;
       v_returncode:= write_file(rec.dnlo);
       dbms_output.put_line(rec.dnlo);
   end loop;
   close cur;
END test;
SQL> exec test
ACCOUNTING;NEW YORK
RESEARCH;DALLAS
SALES;CHICAGO
OPERATIONS;BOSTON
SALES;LAS VEGAS
PL/SQL-Prozedur wurde erfolgreich abgeschlossen.
SQL> The program wrote 5 records into the file.txt (5 calls). Normally i must write
at about 2 million records into the file. It is possible, to write the records into
the file with one call, like a array or a ref_cursor (input parameter of the function write_file) instead of calling the function 2 millon times in a loop?
Message was edited by:
mad

Couldn't help commenting cos that has got to be one of the best drive/folder name combinations I've seen in a long time. :))
v_FileHandle:= UTL_FILE.FOPEN('s:\hit', v_FileName, p_FileModus, C_MAXLINESIZE);Seriously though, when working with UTL_FILE you should use directory objects to ensure proper security... note...
The UTL_FILE_DIR parameter has been deprecated by oracle in favour of direcory objects because of it's security problems.
The correct thing to do is to create a directory object e.g.:
CREATE OR REPLACE DIRECTORY mydir AS 'c:\myfiles';Note: This does not create the directory on the file system. You have to do that yourself and ensure that oracle has permission to read/write to that file system directory.
Then, grant permission to the users who require access e.g....
GRANT READ,WRITE ON DIRECTORY mydir TO myuser;
Then use that directory object inside your FOPEN statement e.g.
fh := UTL_FILE.FOPEN('MYDIR', 'myfile.txt', 'r');Note: You MUST specify the directory object name in quotes and in UPPER case for this to work as it is a string that is referring to a database object name which will have been stored in uppercase by default.
;)

Similar Messages

  • Split records into two files based on lookup table

    Hi,
    I'm new to ODI and want to know on how I could split records into two files based on a value in one of the columns in the table.
    Example:
    Table:
    my columns are
    account name country
    100 USA
    200 USA
    300 UK
    200 AUS
    So from the 4 records I maintain list of countries in a lookup file and split the records into 2 different files based on values in the file...
    Say I have records AUS and UK in my lookup file...
    So my ODI routine should send all records with country into file1 and rest to file2.
    So from above records
    File1:
    300 UK
    200 AUS
    File2:
    100 USA
    200 USA
    Can you help me how to achieve this?
    Thanks,
    Sam

    1. where and how do i create filter to restrict countries? In source or target? Should I include some kind of filter operator in interface.
    You need to have the Filter on the Source side so that we can filter records accordingly the capture the same in the File. To have a Filter . In the source data store click and drag the column outside the data store and you will have Cone shaped icon and now you can click and type the Filter.
    Please look into this link for ODI Documentation -http://www.oracle.com/technetwork/middleware/data-integrator/documentation/index.html
    Also look into this Getting started guide - http://download.oracle.com/docs/cd/E15985_01/doc.10136/getstart/GSETL.pdf . You can find information as how to create Filter in this guide.
    2. If I have include multipe countries like (USA,CANADA,UK) to go to one file and rest to another file; Can I use some kind of lookup file...? Instead of modifying filter inside interface...Can i Update entries in the file?
    there are two ways of handling your situation.
    Solution 1.
    1. Create Variable Country_Variable
    2. Create a Filter in the Source datastore in the First Interface ( SOURCE.COLUMN = #Country_Variable)
    3. Create a new Package Country File Unload
    4. Call the Variable in Country_Variable in Set Mode and provide the Country (USA )
    5. Next call the First Interface
    6. Next call the Second Interface where the Filter condition will be ( SOURCE.COLUMN ! = #Country_Variable )
    7. Now run the package .
    Solution 2.
    If you need a solution to handle through Filer.
    1. Use this Method (http://odiexperts.com/how-to-refresh-odi-variables-from-file-%E2%80%93-part-1-%E2%80%93-just-one-value ) to call the File where you wish to create store the country name into the variable Country_Variable
    2. Pretty much the same Create a Filter in the Source datastore in the First Interface ( SOURCE.COLUMN = #Country_Variable)
    3.Create a new Package Country File Unload
    4.Next call the Second Interface where the Filter condition will be ( SOURCE.COLUMN ! = #Country_Variable )
    5. Now run the package .
    Now through this way using File you can control the File.
    Please try and let us know , if you need any other help.

  • How to add the records of 2 internal table records into one file

    hello experts,
    My scenario is...
    I am retrieving the data for the for the credit, debit and trailer records of the customer into 3 different internal tables and finally i have to append all those records into one file first debit records then credit records finally the trailer record.... how to do that can anyone give some idea plzzzzzzzzz..
    Plz its bit urgent..
    Thanks a lot for your anticipation
    SRI

    Hello,
    Do like this.
    " Assume u have three itab.
    "Itab1 - debit
    "Itab2 - credit
    "Itab3 - Credit.
    REPORT ZV_TEST_SERVER .
    *PARAMETERS: P_FILE TYPE STRING."RLGRAP-FILENAME.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
    *   BIN_FILESIZE                  =
        FILENAME                      = P_FILE
    *   FILETYPE                      = 'ASC'
       APPEND                        = 'X'  " Check here
    *   WRITE_FIELD_SEPARATOR         = ' '
    *   HEADER                        = '00'
    *   TRUNC_TRAILING_BLANKS         = ' '
    *   WRITE_LF                      = 'X'
    *   COL_SELECT                    = ' '
    *   COL_SELECT_MASK               = ' '
    *   DAT_MODE                      = ' '
    * IMPORTING
    *   FILELENGTH                    =
      TABLES
        DATA_TAB                      = ITAB1
    * EXCEPTIONS
    *   FILE_WRITE_ERROR              = 1
    *   NO_BATCH                      = 2
    *   GUI_REFUSE_FILETRANSFER       = 3
    *   INVALID_TYPE                  = 4
    *   NO_AUTHORITY                  = 5
    *   UNKNOWN_ERROR                 = 6
    *   HEADER_NOT_ALLOWED            = 7
    *   SEPARATOR_NOT_ALLOWED         = 8
    *   FILESIZE_NOT_ALLOWED          = 9
    *   HEADER_TOO_LONG               = 10
    *   DP_ERROR_CREATE               = 11
    *   DP_ERROR_SEND                 = 12
    *   DP_ERROR_WRITE                = 13
    *   UNKNOWN_DP_ERROR              = 14
    *   ACCESS_DENIED                 = 15
    *   DP_OUT_OF_MEMORY              = 16
    *   DISK_FULL                     = 17
    *   DP_TIMEOUT                    = 18
    *   FILE_NOT_FOUND                = 19
    *   DATAPROVIDER_EXCEPTION        = 20
    *   CONTROL_FLUSH_ERROR           = 21
    *   OTHERS                        = 22
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
    *   BIN_FILESIZE                  =
        FILENAME                      = P_FILE
    *   FILETYPE                      = 'ASC'
       APPEND                        = 'X'  " Check here
    *   WRITE_FIELD_SEPARATOR         = ' '
    *   HEADER                        = '00'
    *   TRUNC_TRAILING_BLANKS         = ' '
    *   WRITE_LF                      = 'X'
    *   COL_SELECT                    = ' '
    *   COL_SELECT_MASK               = ' '
    *   DAT_MODE                      = ' '
    * IMPORTING
    *   FILELENGTH                    =
      TABLES
        DATA_TAB                      = ITAB2  " Check here
    * EXCEPTIONS
    *   FILE_WRITE_ERROR              = 1
    *   NO_BATCH                      = 2
    *   GUI_REFUSE_FILETRANSFER       = 3
    *   INVALID_TYPE                  = 4
    *   NO_AUTHORITY                  = 5
    *   UNKNOWN_ERROR                 = 6
    *   HEADER_NOT_ALLOWED            = 7
    *   SEPARATOR_NOT_ALLOWED         = 8
    *   FILESIZE_NOT_ALLOWED          = 9
    *   HEADER_TOO_LONG               = 10
    *   DP_ERROR_CREATE               = 11
    *   DP_ERROR_SEND                 = 12
    *   DP_ERROR_WRITE                = 13
    *   UNKNOWN_DP_ERROR              = 14
    *   ACCESS_DENIED                 = 15
    *   DP_OUT_OF_MEMORY              = 16
    *   DISK_FULL                     = 17
    *   DP_TIMEOUT                    = 18
    *   FILE_NOT_FOUND                = 19
    *   DATAPROVIDER_EXCEPTION        = 20
    *   CONTROL_FLUSH_ERROR           = 21
    *   OTHERS                        = 22
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
    *   BIN_FILESIZE                  =
        FILENAME                      = P_FILE
    *   FILETYPE                      = 'ASC'
       APPEND                        = 'X'  " Check here
    *   WRITE_FIELD_SEPARATOR         = ' '
    *   HEADER                        = '00'
    *   TRUNC_TRAILING_BLANKS         = ' '
    *   WRITE_LF                      = 'X'
    *   COL_SELECT                    = ' '
    *   COL_SELECT_MASK               = ' '
    *   DAT_MODE                      = ' '
    * IMPORTING
    *   FILELENGTH                    =
      TABLES
        DATA_TAB                      = ITAB3 " Check here
    * EXCEPTIONS
    *   FILE_WRITE_ERROR              = 1
    *   NO_BATCH                      = 2
    *   GUI_REFUSE_FILETRANSFER       = 3
    *   INVALID_TYPE                  = 4
    *   NO_AUTHORITY                  = 5
    *   UNKNOWN_ERROR                 = 6
    *   HEADER_NOT_ALLOWED            = 7
    *   SEPARATOR_NOT_ALLOWED         = 8
    *   FILESIZE_NOT_ALLOWED          = 9
    *   HEADER_TOO_LONG               = 10
    *   DP_ERROR_CREATE               = 11
    *   DP_ERROR_SEND                 = 12
    *   DP_ERROR_WRITE                = 13
    *   UNKNOWN_DP_ERROR              = 14
    *   ACCESS_DENIED                 = 15
    *   DP_OUT_OF_MEMORY              = 16
    *   DISK_FULL                     = 17
    *   DP_TIMEOUT                    = 18
    *   FILE_NOT_FOUND                = 19
    *   DATAPROVIDER_EXCEPTION        = 20
    *   CONTROL_FLUSH_ERROR           = 21
    *   OTHERS                        = 22
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    If useful reward.
    Vasanth

  • Saving multiple records into text file

    Can I save multiple records into a text file at one go?
    My application has a list of data displayed there and when the user clicks on the save button it will save all the records on the screen.
    It works but it only saves the last record.
    Here are my codes
    // this is to display the list of data
    private JLabel[] subjects=new JLabel[20];
    private JLabel[] subTotal=new JLabel[20];
    private JLabel[] codes=new JLabel[20];
    private JLabel[] getTotal=new JLabel[20];
    String moduleCodes;
    String getPrice;
    double price;
    int noOfNotes;
    public testapp(Subjects[] subList)
    int j=0;
                double CalTotal=0;
              for (int i=0; i<subList.length; i++)
                   subjects[i] = new JLabel();
                   subTotal[i] = new JLabel();
                   codes=new JLabel();
                   getTotal[i]=new JLabel();
                   if (subList[i].isSelected)
                        System.out.println(i+"is selected");
                        subjects[i].setText(subList[i].title);
                        subjects[i].setBounds(30, 140 + (j*30), 400, 40);
                        subTotal[i].setText("$"+subList[i].price);
                        subTotal[i].setBounds(430,140+(j*30),100,40);
                        codes[i].setText(subList[i].code);
                        getTotal[i].setText(subList[i].price+"");
                        CalTotal+=subList[i].price;
                        contain.add(subjects[i]);
                        contain.add(subTotal[i]);
                        j++;
                        moduleCodes=codes[i].getText();                              
                        getPrice=getTotal[i].getText();
                        noOfNotes=1;
    // this is where the records are saved
         public void readRecords(String moduleCodes,String getPrice,int notes)throws IOException
              price=Double.parseDouble(getPrice);
              String outputFile = "testing.txt";
              FileOutputStream out = new FileOutputStream(outputFile, true);      
         PrintStream fileOutput = new PrintStream(out);
              SalesData[] sales=new SalesData[7];
              for(int i=0;i<sales.length ;i++)
                   sales[i]=new SalesData(moduleCodes,price,notes);
                   fileOutput.println(sales[i].getRecord());
              out.close();

    I suggest writing a method that takes a SalesData[]
    parameter and a filename. Example:
    public void writeRecords(SalesData[] data,
    String filename) throws IOException
    BufferedWriter out = new BufferedWriter(new
    FileWriter(filename, true));
    for (int i = 0; i < data.length; i++)
    out.write(data.getRecord());
    out.newLine();
    out.close();
    And it's good to get in the habit of doing things like closing resources in finally blocks.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to write data into a file

    Hi
    I want to write data from a string into a file. I am created a directory and a .doc file . But when i write this data from a string into .doc file , its give an error : File not found exception
    But, when i check in my directory, a file is created with blank.
    My code is:
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    class createFile {
         public static void main(String[] args) {
    try {
         String mss = "This is for dedo";
         FileInputStream fis;
         FileOutputStream fos;
    File file = new File("C:\\JD\\m4.rtf");
    // Create file if it does not exist
    boolean success = file.createNewFile();
         success = true;
    if (success) {
                   System.out.println("suc");     
                   fis = new FileInputStream(mss);
                   System.out.println(fis);
              fos = new FileOutputStream(file);
              int c;
                   while ((c = fis.read()) != -1) {
         fos.write(c);
                   System.out.println("mss");
              fis.close();
              fos.close();
         System.out.println("created");
    // File did not exist and was created
    } else {
    // File already exists
    } catch (IOException e) {
         System.out.println(e);
    regards
    madhu

    InputStream inputStream = new ByteArrayInputStream(mss.getBytes());Use this to push into the file>
    Ummm.... no. InputStreams are for reading, not for writing.
    Anyway, OP, you're making a mistake. You're trying to open a stream to a file called "This is for dedo". Use FileOutputStream(File file) constructor or FileOutputStream(String pathToFile). You can then wrap that stream with a PrintWriter or whatever you need.

  • Unable to read E$ table records into excel file in linux machine

    Hi
    I am using below code in ODI procedure to read E$ table record and store it in excel file
    ODI Procedure: Technology=Java Beanshall and Command on Target I written below code and placed it in CKM Oracle KM
    <@
    String OS = System.getProperty("os.name").toLowerCase();
    String v_path="";
    if((OS.indexOf("win") >= 0))
    v_path="D:\Unload_Dir\<%=snpRef.getSession("SESS_NO")%>.xlsx";
    else if (OS.indexOf("mac") >= 0)
    v_path="path details";
    else if (OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0 )
    v_path="/odi_a/oracle/Middleware/logs/wcds/odi_logs/<%=snpRef.getSession("SESS_NO")%>.xlsx";
    else if (OS.indexOf("sunos") >= 0)
    v_path="soliaris path";
    @>
    OdiSqlUnload "-FILE=<@=v_path@>" "-DRIVER=<%=odiRef.getInfo("DEST_JAVA_DRIVER")%>" "-URL=<%=odiRef.getInfo("DEST_JAVA_URL")%>" "-USER=<%=odiRef.getInfo("DEST_USER_NAME")%>" "-PASS=<%=odiRef.getInfo("DEST_ENCODED_PASS")%>" "-FILE_FORMAT=VARIABLE" "-ROW_SEP=\r\n" "-DATE_FORMAT=yyyy/MM/dd HH:mm:ss" "-CHARSET_ENCODING=ISO8859_1" "-XML_CHARSET_ENCODING=ISO-8859-1"
    select * from <%=odiRef.getTable("L","ERR_NAME", "W")%>
    But is not reading the data into .xlsx file ,
    Please help me it is very urgent
    Can I use below code
    String os = "";
    if (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1) {
    os = "windows";
    } else if (System.getProperty("os.name").toLowerCase().indexOf("linux") > -1) {
    os = "linux";
    } else if (System.getProperty("os.name").toLowerCase().indexOf("mac") > -1) {
    os = "mac";
    T
    his is high priority, please help me urgent
    Regards,
    Phanikanth
    Edited by: Phanikanth on Feb 28, 2013 5:43 AM
    Edited by: Phanikanth on Feb 28, 2013 6:00 AM
    Edited by: Phanikanth on Feb 28, 2013 7:42 AM

    Hi,
    can you describe what is happening when you run the ODI procedure described below:
    - Does the procedure fail with an error, if yes, which error(full details)?
    - Does the procedure pass but no xslx file is been created?
    - Does the procedure pass and an xslx file is been created, but Excel can't read it? If yes, what is the structure of the xslx file when read in an editor?
    What I can see from your code below is that you have choosen -FILE_FORMAT=VARIABLE, but the XSLX format is supposed to be XML.
    Regards,
    Alex

  • Unable to write data into excel file when it's close

    Hi,
    I'm facing this problem and it's a bit weird. I'm using the following method to insert data into excel file. But when excel file is close, it unable to write data into the excel sheet. But it was able to write the data into the excel sheet if i open the excel file when running the program.
    Can anyone please tell me what's wrong to the code?
    public int updateLog(String sheet, String no, String cpId, String CatId, String rbtCode, String rbt, String rbtName, String artistName, String price, String rbtFileName, String songId, String msg){
            int result = -1;
            try{
                SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss",Locale.ENGLISH);
                String actionDate = formatter.format(new Date());
                rbtName = rbtName.replaceAll("'", "''");
                artistName = artistName.replaceAll("'", "");
                String sql = "insert into [Sheet3$] (Code, CpID, CategoryID, RBTCode, RBT, RBTName, ArtistName, Price, RBTFileName, SongID, UploadStatus, FileUploadedDateTime) ";
                sql = sql + " values ('" + no + "', '" + cpId + "', '" + CatId + "', '" + rbtCode + "', '" + rbt + "', '" + rbtName + "', '" + artistName + "', '" + price + "', '" + rbtFileName + "', '" + songId + "', '" + msg + "', '" + actionDate + "')";
                System.out.println(sql);
                log.writeLog(sql);
                result = stmnt.executeUpdate(sql);
            } catch(Exception e){
                e.printStackTrace();
                log.printStackTrace(e);
            return result;
        public int openConnection(){
            int result = -1;
            try{
                Class.forName(dbDriver);
                c = DriverManager.getConnection(conStr + excelFilePath+";ReadOnly=0;");
                stmnt = c.createStatement();
            } catch(Exception e){
                e.printStackTrace();
                log.printStackTrace(e);
                return -1;
            return 1;
        }Thanks

    HI,
    i hv a doubt regarding reading / opening of a
    password protected Excel file using jxl( java ) .
    How to read / open a password protected Excel file
    thro Java (jxl ) program .plz let me know some
    example also .
    Regards,
    Ramesh P
    845935822cross posting !! answered here
    http://forum.java.sun.com/thread.jspa?threadID=710466&messageID=9507085#9507085

  • Function module for move internal table records into MSexcel file

    Hi all,
    Tell me the function module which is used to
    move internal table records in to MSexcel file.
    Give the sample program...

    Please search the forum for FM  "GUI_DOWNLOAD" You will get tons of threads with sample code.
    Also take a look into SAP_CONVERT_TO_XLS_FORMAT
    Thanks

  • How to specify path to read E$ tab records into .xls file using odisqlunlod

    Hi
    Can any one help me how to specify specific path in odisqlunload tools which is useful for both windows and linux.
    I am developing and testing in windows and moving generated scenario into linux box to test for testing people
    If in case any error out records are populated in E$ table then how that records will populated on xls file, later I am sending that attachement for email notification to concern people
    Below code is present in odisqlunload tool
    OdiSqlUnload "-FILE=d:\ODI_Error_Out_Files\Notification_Error_Records.xls" "-DRIVER=oracle.jdbc.OracleDriver" "-URL=jdbc:oracle:thin:@10.75.114.146:1521:POCWCDS" "-USER=wcds" "-PASS=h2yXeih4hFlXXV,QaMeRR2Fy" "-FILE_FORMAT=VARIABLE" "-ROW_SEP=\r\n" "-DATE_FORMAT=yyyy/MM/dd HH:mm:ss" "-CHARSET_ENCODING=ISO8859_1" "-XML_CHARSET_ENCODING=ISO-8859-1"
    select * from E$_notification
    Please help how to make a single code which is useful and work on both windows and linux
    Any sugession willl help me
    Thanks in advance
    Regards,
    Phanikanth

    Hi Bhabani,
    I have written below code in KM itself and select technology as Java BeanShall
    Code:
    <@
    String OS = System.getProperty("os.name").toLowerCase();
    String v_path="";
    if((OS.indexOf("win") >= 0))
    v_path="D:\Unload_Dir\<%=snpRef.getSession("SESS_NO")%>.xlsx";
    else if (OS.indexOf("mac") >= 0)
    v_path="path details";
    else if (OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0 )
    v_path="/odi_a/Middleware/logs/wcds/odi_logs/<%=snpRef.getSession("SESS_NO")%>.xlsx";
    else if (OS.indexOf("sunos") >= 0)
    v_path="soliaris path";
    @>
    OdiSqlUnload "-FILE=<@=v_path@>" "-DRIVER=<%=odiRef.getInfo("DEST_JAVA_DRIVER")%>" "-URL=<%=odiRef.getInfo("DEST_JAVA_URL")%>" "-USER=<%=odiRef.getInfo("DEST_USER_NAME")%>" "-PASS=<%=odiRef.getInfo("DEST_ENCODED_PASS")%>" "-FILE_FORMAT=VARIABLE" "-ROW_SEP=\r\n" "-DATE_FORMAT=yyyy/MM/dd HH:mm:ss" "-CHARSET_ENCODING=ISO8859_1" "-XML_CHARSET_ENCODING=ISO-8859-1"
    select * from <%=odiRef.getTable("L","ERR_NAME", "W")%>
    It was executed well and below is the Execution code of the above code
    Execution Code:
    <@
    String OS = System.getProperty("os.name").toLowerCase();
    String v_path="";
    if((OS.indexOf("win") >= 0))
    v_path="D:\Unload_Dir\1341360.xlsx";
    else if (OS.indexOf("mac") >= 0)
    v_path="path details";
    else if (OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0 )
    v_path="/odi_a/Middleware/logs/wcds/odi_logs/1341360.xlsx";
    else if (OS.indexOf("sunos") >= 0)
    v_path="soliaris path";
    @>
    OdiSqlUnload "-FILE=<@=v_path@>" "-DRIVER=oracle.jdbc.OracleDriver" "-URL=jdbc:oracle:thin:@10.75.114.146:1521:POCWCDS" "-USER=wcds" "-PASS=<@=snpRef.getInfo("DEST_ENCODED_PASS") @>" "-FILE_FORMAT=VARIABLE" "-ROW_SEP=\r\n" "-DATE_FORMAT=yyyy/MM/dd HH:mm:ss" "-CHARSET_ENCODING=ISO8859_1" "-XML_CHARSET_ENCODING=ISO-8859-1"
    select * from WCDS.E$_CDS_COMPANY
    Please confirm me if the above Code is correct or not, if Not, please correct it and DESC_ENCODE_PASS is not encoding the password
    Regards
    Phanikanth
    Edited by: Phanikanth on Feb 18, 2013 1:09 AM

  • Write array into txt file

    Hi Guys!
    I need a VI which writes the content of an array into a txt file.
    I have an array like this:
    Peti    Teri
    Zoli    Hajni
    Tomi    Heni
    Pali    Robi
    In the file the first line should be a full timestamp (date, time), and then would come the content of the array. The name of the file would also be a timestamp.
    Thank you for your help in advance!

    Hi Victronica and welcome to NI Forums!
    If you have some custom data, then it is up to ou to tell excel how to interpret said data (what information to put where, etc.) A simple solution would be to flatten your cluster elements into strings, and write those strings into an excel sheet using ActiveX. An example on how to write a table of strings is available in the example finder, and I also have it attached here in LabVIEW 2013.
    Kind regards:
    Andrew Valko
    National Instruments Hungary
    Attachments:
    Excel - Write Table.vi ‏17 KB

  • Inserting Record into CSV file from BizTalk Orchestration

    Scenario:
    1.Receive file from Source system via RecvPipeline
    2.In Orchestration  extracting some values like ENO,Ename,Salary etc.these values to be added in to CSV file from Expression Shape.How to append/add emp records in to CSV with out overriding the rows.
    Ex:If we submitted 10 files then the CSV file should contain 10 rows in CSV.
    Let me know how to create CSV file from Orchestration and how to add rows into that csv value
    Regards BizTalkWorship

    Simple.
    Receive the message through a Receive Port/Location.
    Create a flat-file schema representing the CSV file structure. Ensure each row is delimited by “{CR}{LF}”. 
    This flat-file schema should only contain the element which you want to see in the destination CSV file like ENO,Ename,Salary etc.
    Have a map where the source schema should be the one which represents the received file and destination schema should be the one which is above created flat-file schema.
    Map the source schema to the destination schema mapping the filed 
    ENO,Ename,Salary etc.
    Have a custom send pipeline with flat-file assembler component it. Use this send pipeline in the send port.
    In send port, configure the send filter like “BTS.ReceivePortName == YourReceivePortName”. Configure the send port’s “Outbound Maps” to the map which you have created in
    above step
    Key Point. In your send port, set the “Copy Mode” property to “Append” from default “Create New”
    With your send port’s, “Copy Mode” property configured to “Append” this will append the value of the output to the existing file. Since in your flat-file schema, each record
    is delimited by “{CR}{LF}” and since you’re overwriting the output file you will have one file with records appended. So if 10 files received, instead of 10 output files, you will have 1 CVS file with 10 rows.
    If you want to construct the message in Orchestration as do, you do as opposed to map in send port at outbound map you can still do.
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • DOWNLOAD HEADER & ITEM RECORD INTO EXCEL FILE

    I WANT TO KNOW THE LOGIC TO POPULATE HEADER DATA AND ITEM DATA INTO SAME INTERNAL TABLE AND AGAIN DOWNLOAD THE SAME TO EXCEL FILE .
    Header structure : rectyp ,hdnum ,sbank ,bankl ,accnr , paytp , crda ,iso.
    Item  structure    : rectyp ,valut ,cknum ,amount,bankl,accnr,pdate,bnktc.
    Final internal table : Combination of these 2 fields. i need to populate these and download.

    Hi,
    fill at first your ITAB with header-date and append it. Then append your items.
    Do not SORT after appending.
    Regards Mario

  • Help Export TABLE Records into Flat File with INSERTs - error

    Hi,
    When i'm trying to run this procedure I got this error:
    ORA-00932:inconsistent datatypes: expected - got -
    Can anybody tell me why?
    Thanks
    CREATE OR REPLACE PROCEDURE generate_stmt(prm_table_name IN VARCHAR2,
    prm_where_clause IN VARCHAR2,
    prm_output_folder IN VARCHAR2,
    prm_output_file IN VARCHAR2) IS
    TYPE ref_cols IS REF CURSOR;
    mmy_ref_cols ref_cols;
    mmy_column_name VARCHAR2(100);
    mmy_column_data_type VARCHAR2(1);
    mmy_col_string VARCHAR2(32767);
    mmy_query_col_string VARCHAR2(32767);
    V_FILE_HNDL UTL_FILE.file_type;
    begin
    OPEN mmy_ref_cols FOR
    SELECT LOWER(column_name) column_name
    FROM user_tab_columns
    WHERE table_name = UPPER(prm_table_name)
    ORDER BY column_id;
    LOOP
    FETCH mmy_ref_cols
    INTO mmy_column_name;
    EXIT WHEN mmy_ref_cols%NOTFOUND;
    mmy_col_string := mmy_col_string || mmy_column_name || ', ';
    mmy_query_col_string := mmy_query_col_string || ' ' || mmy_column_name || ',';
    END LOOP;
    CLOSE mmy_ref_cols;
    V_FILE_HNDL := UTL_FILE.FOPEN('TEST','TESST.TXT', 'W');
    mmy_col_string := 'INSERT INTO ' || LOWER(prm_table_name) || ' (' ||
    CHR(10) || CHR(9) || CHR(9) || mmy_col_string;
    mmy_col_string := RTRIM(mmy_col_string, ', ');
    mmy_col_string := mmy_col_string || ')' || CHR(10) || 'VALUES ( ' ||
    CHR(9);
    mmy_query_col_string := RTRIM(mmy_query_col_string,
    ' || ' || '''' || ',' || '''' || ' || ');
    dbms_output.put_line(mmy_column_name);
    OPEN mmy_ref_cols
    FOR ' SELECT ' || mmy_query_col_string ||
    ' FROM ' || prm_table_name ||
    ' ' || prm_where_clause;
    loop
    FETCH mmy_ref_cols
    INTO mmy_query_col_string;
    EXIT WHEN mmy_ref_cols%NOTFOUND;
    mmy_query_col_string := mmy_query_col_string || ');';
    UTL_FILE.PUT_LINE(V_FILE_HNDL, mmy_col_string);
    UTL_FILE.PUT_LINE(V_FILE_HNDL, mmy_query_col_string);
    end loop;
    end;

    Buddy,
    Try this..
    CREATE OR REPLACE PROCEDURE generate_stmt
    (prm_table_name IN VARCHAR2,
    prm_where_clause IN VARCHAR2,
    prm_output_folder IN VARCHAR2,
    prm_output_file IN VARCHAR2) IS
    TYPE ref_cols IS REF CURSOR;
    mmy_ref_cols ref_cols;
    mmy_column_name VARCHAR2(100);
    mmy_column_data_type VARCHAR2(1);
    mmy_col_string VARCHAR2(32767);
    mmy_query_col_string VARCHAR2(32767);
    V_FILE_HNDL UTL_FILE.file_type;
    begin
    OPEN mmy_ref_cols FOR
    SELECT LOWER(column_name) column_name
    FROM user_tab_columns
    WHERE table_name = UPPER(prm_table_name)
    ORDER BY column_id;
    LOOP
    FETCH mmy_ref_cols
    INTO mmy_column_name;
    EXIT WHEN mmy_ref_cols%NOTFOUND;
    mmy_col_string := mmy_col_string || mmy_column_name || ', ';
    mmy_query_col_string := mmy_query_col_string || ' ' || mmy_column_name || ',';
    END LOOP;
    CLOSE mmy_ref_cols;
    mmy_col_string := 'INSERT INTO ' || LOWER(prm_table_name) || ' (' ||CHR(10) || CHR(9) || CHR(9) || mmy_col_string;
    mmy_col_string := RTRIM(mmy_col_string, ', ');
    mmy_col_string := mmy_col_string || ')' || CHR(10) || 'VALUES ( ' ||CHR(9);
    mmy_query_col_string := RTRIM(mmy_query_col_string,' || ' || '''' || ',' || '''' || ' || ');
    V_FILE_HNDL := UTL_FILE.FOPEN('TEST','TESST.TXT', 'W');
    OPEN mmy_ref_cols FOR 'SELECT ' || mmy_query_col_string ||' FROM ' || prm_table_name ||' ' || prm_where_clause;
    loop
    FETCH mmy_ref_cols INTO mmy_query_col_string;
    EXIT WHEN mmy_ref_cols%NOTFOUND;
    mmy_query_col_string := mmy_query_col_string || ');';
    UTL_FILE.PUT_LINE(V_FILE_HNDL, mmy_col_string);
    UTL_FILE.PUT_LINE(V_FILE_HNDL, mmy_query_col_string);
    end loop;
    UTL_FILE.FCLOSE(V_FILE_HNDL);
    END;
    This would work for table with one and only one column.
    Look at the line below:
    FETCH mmy_ref_cols INTO mmy_query_col_string;
    mmy_query_col_string has been declared as string...So it would hold single value only.That's the reason when you try this block on table with more than one column,mmy_query_col_string would've to hold a table row type data which it would not...
    Good luck!!
    Bhagat

  • Write string array into cfg file

    Hi, everybody.
    I faced the problem to write array into cfg file. I am trying to put many items in a key. It should look like
    [Section1]
    Key1=el_1, el_2,el_3,.............el_n.
    each element is string of 105 characters. Everything works fine when I save the only one el_1 or multiple for the  first time, however, when I am trying to update values in a key section some extra strings appear in a file. My VI is attached.
    Thanks in advance

    Do you realize that your spreadsheet string only writes the following:
    1111111111
      2222222222222222
     33333333333333333333
    The way you wrote your VI, it sends the entire string above to the value for Write Key.vi.
    Do you realize that value is for the data type only?  So I'm not sure what you want to do....
    Without describing the problem you are having, can you describe what you actually want to do?
    R
    Message Edited by JoeLabView on 07-22-2008 11:49 AM
    Attachments:
    confused.PNG ‏26 KB

  • I want to write record type variable in ult file.How to i can write record type varable without column name.

    I want to write record type variable in ult file.How to i can write record type varable without column name.
    type rec_format_type is record
         format1  VARCHAR(3),
         format2  VARCHAR(3),
    my_record     rec_format_type;
    UTL_FILE.PUT_LINE(file_out, my_record);

    ibney wrote:
    I have below requirement.
    DECLARE
         emp_data UTL_FILE.FILE_TYPE;
    BEGIN
        emp_data := UTL_FILE.FOPEN ('EXDATAPUMP','TEST_BC_NN_PARALLEL.csv','W',32000);
        FOR TEST1 IN (SELECT /*+ PARALLEL(TEST_BC_NN,4) */  * FROM TEST_BC_NN) LOOP
            UTL_FILE.PUT_LINE (emp_data, TEST1);---Here i want to write record in utl file.without knowing the structure of table
        END LOOP;
        UTL_FILE.FCLOSE (emp_data);
    END;
    Why all the ugly upper case? You do realise that NO programming standard, ranging from Java and .Net, to C/C++ and Ada (of which PL/SQL is an implementation of), use upper-case-for-reserved-words as a standard.
    The easiest and simplest way to address your requirement is as follows:
    SQL> create or replace type TStringArray is table of varchar2(4000);
      2  /
    Type created.
    SQL>
    SQL>
    SQL> begin
      2          for c in(
      3                  select
      4                          TStringArray(
      5                                  to_char(empno,'000000'),
      6                                  ename,
      7                                  to_char(hiredate,'yyyy-mm-dd')
      8                          ) as COLS
      9                  from    emp
    10                  order by empno
    11          ) loop
    12                  for i in 1..c.Cols.Count loop
    13                          dbms_output.put( c.Cols(i) );   -- write column
    14                          if i < c.Cols.Count then
    15                                  dbms_output.put( '|' ); -- write column separator
    16                          end if;
    17                  end loop;
    18                  dbms_output.put_line( ' *end*' );               -- write record terminator
    19          end loop;
    20  end;
    21  /
    007369|SMITH|1980-12-17 *end*
    007499|ALLEN|1981-02-20 *end*
    007521|WARD|1981-02-22 *end*
    007566|JONES|1981-04-02 *end*
    007654|MARTIN|1981-09-28 *end*
    007698|BLAKE|1981-05-01 *end*
    007782|CLARK|1981-06-09 *end*
    007788|SCOTT|1987-04-19 *end*
    007839|KING|1981-11-17 *end*
    007844|TURNER|1981-09-08 *end*
    007876|ADAMS|1987-05-23 *end*
    007900|JAMES|1981-12-03 *end*
    007902|FORD|1981-12-03 *end*
    007934|MILLER|1982-01-23 *end*
    PL/SQL procedure successfully completed.
    SQL>

Maybe you are looking for

  • "character conversion error" while parsing xml files

    Hello, I'm trying to parse MusicXML (Recordare) files, but I'm getting an exception. I'm using the SAX parser (javax.xml.parsers.SAXParser). Here is the code I use to instantiate it: final javax.xml.parsers.SAXParserFactory saxParserFactory = javax.x

  • Repititive manufacturing flow

    If i want to implement sap for repetitive manufacturing type, can u please give typical process flow.

  • How to stream with the player strobe media playback videos using http dynamic streaming?

    Hi.. please could i have some help about the player strobe media playback? i would like to know how to stream with the player strobe media playback videos using http dynamic streaming. I have already installed the server,i put my own video in the vid

  • Sign reversal not working in Web Template

    Hello, I have created a web template with the web application designer containing an "Analysis" web item. The query that I use as the dataprovider has toggled the property "Reverse sign" for all key figures. When I execute the query in the BEx all mi

  • Throttling in OSB

    Hi, We are looking for Throttling in OSB, where in an OSB service should process only x requests at any given point of time. Work Manager maximum thread constraint is one way we found which enables throttling and can limit the number of threads proce