Getting CLOB fron Database then creating a CSV File

Hi,
I am trying to read a CLOB for the DB in my Backing Bean with the help of EJB.
The code in my backing bean is:
char[] strReportContent = reportObj.getReportText();The API where the accessors for getReportText() is;
  @Lob
  @Column(name="REPORT_TEXT")
  public char[] getReportText()
    return reportText;
  public void setReportText(char[] reportText)
    this.reportText = reportText;
  }The problem is that when I do a system out on strReportContent I get a garbage value and not what is in the DB.
Please Help.
Then to render it on the CSV the code is:
  // Init servlet response.
      response.reset();
      response.setContentType("plain/text");
      // response.setContentLength(input.available());
      response.setHeader("Content-disposition",
                         "inline; filename=\"" + selectedReportId.getReportName() + "\"");
      output =
          new BufferedOutputStream(response.getOutputStream(), DEFAULT_BUFFER_SIZE);
char[] strReportContent = reportObj.getReportText();
output.write(strReportContent.toString().getBytes(), 0, strReportContent.length);

Hi,
I am not removing any zeroes . I created the same file in .txt format and XI was able to write the value 008.2010 to the txt file.
I suppose this has somehting to do with excel file properties . By default when we add 008.2010 in the excel sheet , it takes only 8.201. We need to change the format to "text" manually in the excel file to take in zeroes as well.
So , i really dont know how to make sure that the excel file properties does not truncate zeroes while XI is creating the CSV file.
Regards
Vinay P.

Similar Messages

  • Zero is getting truncated while XI is creating a CSV file

    Hi,
    Scenario is IDOC to File.
    in the IDOC i get some Serial number as 00000007856465 in the output CSV file i need this value as 07856465
    Here when i run this map in the ESR Message mapping i could see 07856465 this value fine but while posting at the output directory the values are dropped with zeros truncated.
    in the output CSV file -- the value is -- 7856465
    Could you please help me out in solving this issue.
    Thanks,
    --Sai.

    Hi Sai Krishna,
    As said by Bhaskar, use Formatnum function or UDF in your mapping. So that you would be able to get the 0's in the output.
    I would prefer to go with FormatNum function.
    Check the UDF provided by Raja Shekar in the below thread:
    UDF for leading zero's in message mapping
    Thanks,

  • Issue when creating a CSV file

    Stupid issue but I've tried to fix it all day and it's not working...
    I need to create a CSV file made up of 3 columns, 2 number and 1 char. The char column is a company name that has spaces in it. When I run the query in SQL Developer, the char column looks fine. When I run in in BiPub as a CSV, I get double-quotes around the char column. It looks fine if I would look at it as DATA or any other format.
    I can't use the REPLACE function because there's nothing wrong with the data.
    We're using BI Pub v.10.1.3.4.
    Any thoughts?
    Thanks!!
    Kris

    First I tried using a basic rtf file and just selected CSV as the type. Then I tried using the 'e-text template' and selecting CSV, same result. Now I'm trying to use an .xsl file instead of a .rtf to see if that works.
    Kris

  • How to create a csv file with NCS attributes?

    Hi
    i installed Cisco Prime NCS and trying to perform bulk update of device credentials with csv file.
    How to create a csv file with all required attributes?
    This is part of NCS online help talking about this topic:
    Bulk Update Devices—To update the device credentials in a bulk, select Bulk Update Devices from the Select a command drop-down list. The Bulk Update Devices page appears.You can choose a CSV file.
    Note        The CSV file contains a list of devices to be updated, one device per line. Each line is a comma separated list of device attributes. The first line describes the attributes included. The IP address attribute is mandatory.
    Bellow is test csv file i created but does not work:
    10.64.160.31,v2c,2,10,snmpcomm,ssh,zeus,password,password,enablepwd,enablepwd,60
    10.64.160.31,v2c,2,10,snmpcomm,ssh,zeus,password,password,enablepwd,enablepwd,60
    The error i am getting while importing this file:
    Missing mandatory field [ip_address] on header line:10.64.160.31,v2c,2,10,snmpcomm,ssh,zeus,password,password,enablepwd,enablepwd,60
    Assistance appreciated.

    It looks like the IP address field is incorrectly set.,
    It should be as follows
    {Device IP},{Device Subnet Mask}, etc etc
    so a practical example of the aboove could be (i dont know if this is completely correct after the IP address / Subnet Mask)
    10.64.160.31,255.255.255.0,v2c,2,10,snmpcomm,ssh,zeus,password,password,enablepwd,enablepwd,60
    below is a link to the documentation
    http://www.cisco.com/en/US/docs/wireless/ncs/1.0/configuration/guide/ctrlcfg.html#wp1840245
    HTH
    Darren

  • How do I get Lightroom 4 to automatically create an xmp file?*

    How do I get Lightroom 4 to automatically create an xmp file?*

    Assuming you have RAW photos
    Edit->Catalog Settings > Metadata then check “Automatically Write Changes to XMP”
    Not RAW photos ... the same setting causes the metadata to be written into the files, but does not create an xmp file

  • How to create a CSV file in java

    how to create a CSV file in java

    this is the code that I have used in a hp project:
    private static final String DELIMIT = ",";
    StringBuffer buf = new StringBuffer();
    public void addString(String str){
    buf.append(toEscapedStringLiteral(str.replaceAll(" ","").trim())).append(DELIMIT);
    public void sendFile( String strData ,
                                String strTitle,
                                String strContType,
                                HttpServletResponse res ) throws IOException {
              byte[] _filedata=strData.getBytes();
              res.setContentType( strContType );
              res.setHeader( "Content-Disposition", "attachment;filename="+ strTitle );     
                     DataOutputStream out = new DataOutputStream( res.getOutputStream() );
              out.write( _filedata, 0, _filedata.length );
              out.close();
    public void addStringWhithReturn(String str){
              buf.append(toEscapedStringLiteral(str.replaceAll(" ","").trim()));
              buf.append( "\n" );
    private String toEscapedStringLiteral( String charSeq ) {
              if ( null == charSeq ) {
                   charSeq = "";
              return "\"" + charSeq + "\"";
    ....hope its help
    kou

  • Create a csv file and send it in an email

    In coldfusion, is it possible to  create a csv file and send it in an email, without ever saving that file on the hard drive?

    Yes, you can create an email attachment without writing a file to disk.  This feature was introduced in CF 8.0.1.
    I've posted a sample to a previous thread on the forums.
    http://forums.adobe.com/message/2123297
    See the CFMAILPARAM section of CF 8.0.1 release notes for attachments without a file on disk.
    http://www.adobe.com/support/documentation/en/coldfusion/801/cf801releasenotes.pdf

  • How to create a .CSV file & place it  in Application server

    Hi All,
    I have a requirement like .
    1.Create a .CSV file by using report output data.
    2.The .csv file should be placed in application server.
    When user will execute the report,
    automatically a .csv has to generate and that should be available at application server.
    points will be rewarded.
    Thanks,
    Anil

    Hi,
      Whatever the final output internal table is there  loop that
    DATA : begin of i_final occurs 0,
                  field1(20),
                  field2(20),
                end of i_final.
    DATA : v_filepath (200) TYPE c Value '/data/sapdata/test.csv' .
    DATA : begin of i_file_data occurs 0,
                  Rec(500),
                end of i_file_data.
    LOOP AT i_final.
    CONCATENATE i_final-field1  i_final-field2  INTO i_file_data-rec SEPARATED BY ','.
    APPEND i_file_data.
    CLEAR  i_file_data.
    ENDLOOP.
    OPEN DATASET v_filepath IN OUTPUT  FOR TEXT MODE.
    LOOP AT i_file_data.
      TRANSFER  i_file_data-rec TO  v_filepath.
    ENDLOOP.
    CLOSE v_filepath.
    To check the file goto Tcode->AL11>data/sapdata/test.csv.

  • Uploading data to oracle database when a new CSV file arrives to a folder

    Hi,
    I am a student trying to learn oracle and right not working on an academic project. My problem scenario is as follows.
    I have a folder in my system.Whenever a new CSV file is pasted to that folder.The contents should be loaded to database using SQLLoader.The problem I am facing is.
    1) How to schedule this as to what should I write in batch file(for arrival of new file).
    2) How to tell SQL Loader to take contents from the new SQL file everytime an upload is scheduled by the batch file.
    I will be glad for any guidance on this.Thanks :)

    you have to do below steps:
    1. create a sqlloader control file according to your input data file
    2. write a shell script which will check is any new file came in the fiolder. If it came then load the file using above controlfile. once load is complete move file in some other folder.
    3. schedule the shell script using crontab to run every 10 second or so.
    Note: This is just one of the way. there can be many methods to solve above problem including using oracle schduler.

  • How to get sql query data and write into csv file?

    I am writing to seek help, in how can I create bat. script which can execute the following logic:
    connection to the database
    run sql query
    create CSV file
    output query data, into CSV file
    save the CSV file
    osql
    -S 84.18.111.111
    -U adw
    -P rem
    -i "c:\query.sql"
    send ""
    sed -e 's/,\s\+/,/g' MCI_04Dec2014.csv > localNoSpaces.csv
    -o "c:\MCI_04Dec2014.csv"
    This what i have so far, and I am little struggling with the logic after creating CSV file. I am unable to get the above script to work, please advice further, where I may be going wrong. 
    Can you create if statement logic within window's script, to check for null parameters or data feeds?
    Any hints would be most appreciated. 

    Thank you for your reply. 
    Apology for posting the code irrelevant to the forum, as I am still novice scripting user.  
    My goal is to create window's script which can compute the above logic and send the final output file (csv), to FTP folder. 
    Can this logic be implemented via bat. script, if so, is there a example or tutorial i could follow, in order to achieve my task. 
    Any help would be much appreciated. 

  • Creating a CSV file from a pl/sql procedure

    Hi Everyone,
    I would like to know how to write a procedure in pl/sql where i need to check if they are any records in a table say "Table A".
    If they are any records in the "Table A" then we need to write those records in the "Table A" to the CSV file.
    If they are no records then we need to insert a record into the CSV file that "No records are found in "Table A".
    Could anybody please help ?
    Thanks in advance

    see this
    ops$tkyte@8i> create or replace procedure dump_table_to_csv( p_tname in varchar2,
    2 p_dir in varchar2,
    3 p_filename in varchar2 )
    4 is
    5 l_output utl_file.file_type;
    6 l_theCursor integer default dbms_sql.open_cursor;
    7 l_columnValue varchar2(4000);
    8 l_status integer;
    9 l_query varchar2(1000)
    10 default 'select * from ' || p_tname;
    11 l_colCnt number := 0;
    12 l_separator varchar2(1);
    13 l_descTbl dbms_sql.desc_tab;
    14 begin
    15 l_output := utl_file.fopen( p_dir, p_filename, 'w' );
    16 execute immediate 'alter session set nls_date_format=''dd-mon-yyyy hh24:mi:ss''
    17
    18 dbms_sql.parse( l_theCursor, l_query, dbms_sql.native );
    19 dbms_sql.describe_columns( l_theCursor, l_colCnt, l_descTbl );
    20
    21 for i in 1 .. l_colCnt loop
    22 utl_file.put( l_output, l_separator || '"' || l_descTbl(i).col_name || '"'
    23 dbms_sql.define_column( l_theCursor, i, l_columnValue, 4000 );
    24 l_separator := ',';
    25 end loop;
    26 utl_file.new_line( l_output );
    27
    28 l_status := dbms_sql.execute(l_theCursor);
    29
    30 while ( dbms_sql.fetch_rows(l_theCursor) > 0 ) loop
    31 l_separator := '';
    32 for i in 1 .. l_colCnt loop
    33 dbms_sql.column_value( l_theCursor, i, l_columnValue );
    34 utl_file.put( l_output, l_separator || l_columnValue );
    35 l_separator := ',';
    36 end loop;
    37 utl_file.new_line( l_output );
    38 end loop;
    39 dbms_sql.close_cursor(l_theCursor);
    40 utl_file.fclose( l_output );
    41
    42 execute immediate 'alter session set nls_date_format=''dd-MON-yy'' ';
    43 exception
    44 when others then
    45 execute immediate 'alter session set nls_date_format=''dd-MON-yy'' ';
    46 raise;
    47 end;
    48 /
    Procedure created.
    ops$tkyte@8i> exec dump_table_to_csv( 'emp', '/tmp', 'tkyte.emp' );
    PL/SQL procedure successfully completed.

  • How do I create a .csv file on my mac?

    I am having issues doing some reporting.  I have a file that I pull from safari- I need to be able to put this into numbers.  Typically, in windows, I would paste the info onto a notepad and save as .csv, then open again in numbers. 
    So--I can't save in pages like that-- and I can't get it to past in numbers correctly.  Any suggestions would be great!
    Thanks

    Thanks-- I was really trying to get it to this point...   I just want to take the text and manipulate it in numbers. 
    So -- essentially-- I have text that is already comma separated, but can't figure out how to either save as a .csv file that i can import into numbers-- OR just save the text in numbers - where each comma separates the data into different collumns. 
    Any suggestions would be completely appreciated!!

  • CREATE DATABASE cannot create a control file

    I know, it's not supported. Please refrain from reminding me.
    I am trying to install a second database on an Oracle 8i installation (8.1.7.4) on a Windows 2003 server. I cannot use DBCA because it doesn't work, so I create the databases manually using the script produced by DBCA.
    So I run the following:
    connect INTERNAL@TEST
    startup nomount pfile="C:\oracle\admin\COHPTEST\pfile\initTEST.ora"
    CREATE DATABASE TEST
    LOGFILE 'D:\oracle\oradata\TEST\redo01.log' SIZE 1024K,
    'D:\oracle\oradata\TEST\redo02.log' SIZE 1024K,
    'D:\oracle\oradata\TEST\redo03.log' SIZE 1024K
    MAXLOGFILES 32
    MAXLOGMEMBERS 2
    MAXLOGHISTORY 1
    DATAFILE 'D:\oracle\oradata\TEST\system01.dbf' SIZE 264M REUSE AUTOEXTEND ON NEXT 10240K
    MAXDATAFILES 254
    MAXINSTANCES 1
    CHARACTER SET WE8ISO8859P1
    NATIONAL CHARACTER SET WE8ISO8859P1;
    I receive the following error:
    ORA-01501: CREATE DATABASE failed
    ORA-00200: controlfile could not be created
    ORA-00202: controlfile: 'D:\oracle\oradata\TEST\ctrl01.ctl'
    ORA-27040: skgfrcre: create error, unable to create file
    OSD-04002: unable to open file
    O/S-Error: (OS 3) The system cannot find the path specified.
    More information:
    1) Added the "Everyone" account to full control on the D: drive, to eliminate the possibility of access issues.
    2) The control files, the alertLog, and just about every other file do not exist before, or after the error.
    3) I cannot produce more detailed information other than what you see. I do not know of a trace that will track this, which would be helpful.
    4) I've tried from both SQLPLUS and SVRMGRL, as well as using INTERNAL, SYS accounts as well as adding sysdba privileges.
    I would love to upgrade this instance, but it has other databases on it, and only one box to run this DB on.
    SO, just to be sure, telling me to upgrade isn't what I am hoping to learn. I would appreciate some insight on how to display the account svrmgrl runs under, or how to get it to run under another user ID that would be great, or why it can't create the file, or a manual way to create the file (CREATE CONTROLFILE is for existing db's only right? )

    Hello, my name is stupid.
    I was using a remote file in my TNS_ADMIN environment value. It was pointing to the old database the whole time. The old database was up and down all day, but no one was on it to notice.
    Answer: Please check your TNS_ADMIN file, to make sure that you do not have any naming conflicts with the database you are creating, and another database with the same name in your collection of databases.
    What happened:
    The reason it could not create the files: There was another TEST database, which was what was connected to, and I tried to create the files on another server which did not have a D: Drive.
    When I switched to C: it stated the files were already in existence, which I knew wasn't true, and what led me to look at what I was connecting to.
    When I checked my TNSNames.Ora file, I noticed the 2nd entry for a database also named "TEST" that a previous DBA had left in there, I realized I was working on the wrong database because it connected to the first database in the TNSNames listed for that SID.
    I removed the entry from the TNSNames file, and the database was created successfully (Manually, DBCA still doesn't work).
    Thanks for all that tried to help, but introspection was the only solution.

  • Exchange PowerShell script to get mailbox properties of user from a CSV file

    Hi Team,
    I've a CSV file with alias of numerous users and I want to get their mailbox sizes and other properties. These users are dispersed in various databases of same Exchange organization.
    Need a Powershell Script, Any help?
    Muhammad Nadeem Ahmed Sr System Support Engineer Premier Systems (Pvt) Ltd T. +9221-2429051 Ext-226 F. +9221-2428777 M. +92300-8262627 Web. www.premier.com.pk

    You can use this and modify it to what you need. Output to a file (IE: Export-CSV "path to file"
    If you need more specifics let me know. This one is for one user at a time but can be used to read a CSV file.
    # Notifies the user a remote session needs to be started
    Write-Host "Get a users mailbox size" -fore yellow -back red;
    Write-Host "Please wait while a remote session started" -fore red -back yellow;
    # Import a remote session with exchange
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://exchangeservername/Powershell/ -Authentication Kerberos
    Import-PSSession $Session
    Do {
    # Prompts user for a name
    $name = Read-Host "Enter a username"
    # Get the mailbox statistics for that user
    Get-MailboxStatistics $name | fl totalitemsize, storagelimitstatus, totaldeleteditemsize | out-default
    # Give the user a choice to test another or EXIT
    $Output = Read-Host "Press Y to continue or ENTER to exit"
    # Ends the program if the user does not press Y
    Until ($Output -ne "Y")
    HossFly, Exchange Administrator

  • Trouble creating a csv file to bulk import users

    Hi Guys,
    I'm trying to put a .csv file together to bulk import users. I'm practicing with one user right now. This is my CSV header:
    GivenName,Name,SamAccountNAme,Description,Department,OU,Enabled,Accountpassword,PasswordNeverExpires,CannotChangePassword
    This is my first line:
    newuser,newuser,newuser,newuser,Group2,OU=Group2,DC=CONTOSO,DC=COM,$True,P@ssw0rd,$True,$True
    When I test my file this is the output:
    GivenName                      : newuser
    Name                               : newuser
    SamAccountNAme            : newuser
    Description                       : newuser
    Department                      : Group2
    OU                                    : OU=Group2
    Enabled                            : DC=CONTOSO
    Accountpassword             : DC=COM
    PasswordNeverExpires    : $True
    CannotChangePassword : P@ssw0rd
    I obviously need to state the OU in the csv otherwise because the values are not in the correct place right now. Putting OU=Group2,DC=CONTOSO,DC=COM between brackets "..." doesn't help. Then all values are stated at 'GivenName'.
    Please help:-)

    Thank you Mahdi,
    When I do that, I get this:
    GivenName            : newuser,newuser,newuser,newuser,Group2,"OU=Group2,DC=contoso,DC=com"$True,P@ssw0rd,$True,$True
    Name                 :
    SamAccountNAme       :
    Description          :
    Department           :
    Path                 :
    Enabled              :
    Accountpassword      :
    PasswordNeverExpires :
    CannotChangePassword :
    There is one (,) missing between path and $true. I tested it and it works fine. However I am glad you found your way.
    Mahdi Tehrani   |  
      |  
    www.mahditehrani.ir
    Please click on Propose As Answer or
    to mark this post as
    and helpful for other people.
    This posting is provided AS-IS with no warranties, and confers no rights.
    How to query members of 'Local Administrators' group in all computers?

Maybe you are looking for

  • 'back' not working in Calendar

    using 1.4...37 against 9.2.0.4 The 'BACK' button doesn't work but can go forward and today with no problem. http://ooug.oug-ottawa.org:7778/pls/htmldb/f?p=103:10:2450876552869646305 That's the URL for my site, will be launching it to the rest of the

  • Automatic Goods movement from CO11N for serialized materials

    Hello, I'm dealing with confirmation of discrete production orders. When I confirm last operation, the system has to post Good Receipt automatically but materials are serialized, so I know I cannot use flag "Automatic GR" in control key. My requireme

  • BPA - Measured Value = '0'

    Good Morning Experts Please can someone provide guidance on the following problem: i have a Idoc Monitoring object configure for a selection of Vendors when i run the BPA i get mesaured values of ZERO for some of the Partner Number how can exclude th

  • CA Harvest MSI via Zen 3

    Has anyone ever deployed a Harvest MSI app via Zenworks 3? Thanks!!!

  • Can I disable role "FS0000 - Financial Services BP" in CRM?

    Hi, I found every time when I create a BP, two roles "000000-Business Partner(Gen.)" and "FS0000 - Financial Services BP" are assigned to the new created BP. I know that "000000-Business Partner(Gen.)" is a default role for BP.  Is role "FS0000 - Fin