Is it possible to pass a TXT file as an input of a SQL script?

Dear all,
I have a question about SQL scripts running in SQL*Plus. I have a table including a list of SAP UserIDs. I would like to check for several people whether their
ID already exists. Here is how I proceed in my script file.
SELECT sap_userid
FROM SAPREF_USERS
WHERE (sap_userid
IN
     'user1',
     'user2',
     'user3',
     'user4',
     'user5',
       .          /*  So here I write one by one each userid. Consequently if a user already exists, the script will print his/her UserID */
GROUP BY sap_userid
ORDER BY sap_useridWell, this works, but I'm sure there should be a more intelligent method to do the job. If I put all UserIDs in a let's say a TXT file (one userid per line) is there
any way to pass this text file as an input for the script so I may get rid of the very long IN clause in my SQL query?
Thanks in advance,
Kind Regards,
Dariyoosh

Yet Another Post Without Version.
Typing 4 digits and 3 dots, or running select * from v$version and paste the result here
Qualifies as work, and the very reason you post here is you want to avoid to work, or to earn as much as possible by doing as little as possible.
In 9i and higher, the file is best treated as an external table, so the whole list of userids is replaced by
in (select * from external_table)
But this requires reading documentation, which again qualifies as ... work.
Ahh, most 'DBA's here are quite hopeless.
Sybrand Bakker
Senior Oracle DBA

Similar Messages

  • Send mails with csv file as an attachment through oracle(SQL SCripts / Stor

    Hello Everybody,
    I have recently come across a requirement in which I am supposed to send mails with csv file as an attachment through oracle(SQL SCripts / Stored Procedure) .
    The contents of the csv file are to be retreived from the Database as well as the content of the mail and to whom it needs to be sent has also to be picked up from the database.
    Can somebody suggest me with a suitable code for the same?
    Would be of great help..!!
    Thanks & Regards,
    - VR
    Edited by: user646716 on Dec 18, 2009 10:44 AM

    read below links
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:255615160805
    http://www.orafaq.com/wiki/Send_mail_from_PL/SQL#Send_mail_with_UTL_TCP_-withattachments
    How to send csv file as an attachment

  • How do I add a txt file to read from in the following script

    First thanks for the help, PS newbie. 
    I need to add a txt file that has the Exchange aliases listed to the below file. So if the .txt file is sitting in c:\temp\readme.txt how do I incorporate into the following script. Given, I only want the outcome to read from only the txt file. 
    $mailboxes = Get-Mailbox -RecipientTypeDetails UserMailbox
    ForEach ($mailbox in $mailboxes) {
      $FilePath = "\\server\folder\" + $mailbox.PrimarySmtpAddress.Local + "@" + $mailbox.PrimarySmtpAddress.Domain + ".pst"
      New-MailboxExportRequest -mailbox $mailbox -FilePath $FilePath
    Thank you for your time. 
    Chris

    Thank you - 
    You're welcome.
    I need to make sure that when the user from the list is exported to .pst it is named with their primary smtp address? Will the above code do so?
    No, it won't. This adjustment will take that into account:
    $aliasList = Get-Content .\aliasList.txt
    foreach ($alias in $aliasList) {
    $mbx = Get-Mailbox $alias
    $filePath = "\\server\folder\$($mbx.PrimarySmtpAddress).pst"
    New-MailboxExportRequest -Mailbox $alias -FilePath $filePath -WhatIf
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • Creating txt file to store input username and password

    Hi everyone,
    I'm new to java, and have been having a hard time with this code.
    My goal is to allow the user to enter in their username and password which should be concatentated as a string and stored into a text file. I am unable to link the two input fields as one string of characters. I know i'm approaching this wrong, but am uncertain of where i need to begin.
    Code is as follows:
    /*Purpose: To allow the user to input their desired username and password
    *which will be stored in a data structure for later use; for instance when
    *the user wants to use the application again their username and password
    *will be assigned the same/linking locations, hence they will be validated.
    *inputed username and password should be stored in a text field for later use
    *of validating login possbily using a search method
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    import java.util.*;
    import java.lang.String.*;
    public class TextFieldTest1 extends JFrame {
    private JTextField userName;
    private JPasswordField password;
    private JLabel textFieldLabel, passwordFieldLabel;
    // set up GUI
    public TextFieldTest1()
    super( "Please Login to AutoSync" );
    Container container = getContentPane();
    container.setLayout( new FlowLayout() );
    // construct textfield with default sizing
    userName = new JTextField( 10 );
    //creating textfield label
    textFieldLabel = new JLabel("Username");
    container.add(textFieldLabel);
    container.add( userName);
    // construct passwordfield with default text
    password = new JPasswordField( "Hidden text" );
    passwordFieldLabel = new JLabel("Password");
    container.add(passwordFieldLabel);
    container.add( password );
    // register event handlers
    TextFieldHandler handler = new TextFieldHandler();
    userName.addActionListener( handler );
    password.addActionListener( handler );
    setSize( 325, 100 );
    setVisible( true );
    }// end constructor TextFieldTest
    //ADDED TO CREATE TEXT FILE OF USER INPUTS
    //Code actually doesn't work, but i was thinking that where i have brooke
    //if i should create another actionlistner to concatenate the userName and password nputs into one field, perhaps a login button which hold both those arrays then i can do writer.write("combinedfields")      
    public static void main( String args[] )throws IOException
    TextFieldTest1 application = new TextFieldTest1();
    application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    // private inner class for event handling
    private class TextFieldHandler implements ActionListener {
         String fileName = "SENIOR.txt" ;
    FileWriter writer = new FileWriter( fileName );
    writer.write(userName.addActionListener);
    writer.write(password.addActionListener);
    writer.close();
    // process textfield events
    public void actionPerformed( ActionEvent event )
    String string = "";
    // user pressed Enter in JTextField textField1
    if ( event.getSource() == userName )
    string = "userName: " + event.getActionCommand();
    // user pressed Enter in JTextField passwordField
    else if ( event.getSource() == password ) {
    string = "password: " +
    new String( password.getPassword() );
    JOptionPane.showMessageDialog( null, string );
    } // end method actionPerformed
    } // end private inner class TextFieldHandler
    //private class users to link username/password input with Array locations
    private class Users{
              public String userCheck[] = new String[10];     
              public String passCheck[] = new String[10];     
    private boolean validateUser(String usr, String pwd)throws IOException {
         for (int i = 0; i < userCheck.length; i++)
    if (userCheck.equals(usr) && passCheck[i].equals(pwd))
    return true;
                   return false;
         }     //end method validateUser
    }     //end class users
    } // end class TextFieldTest}

    Double Post
    http://forum.java.sun.com/thread.jspa?threadID=631685&tstart=0

  • How to Send a .txt file through FTPTARGET connector of Integration Broker

    Hi,
    Is it possible to send a .txt file(infact anyfile other than xml format) to a host server using FTP Target connector of Integration Broker. If so can someone explain the steps to achieve it.
    Regards,
    Uday

    Yes, you can do that. I've done exactly that couple years ago.
    If I remember currently, below is a high level of how I did it.
    Read the file you want to send into the buffer using GetString function like:
    +/*A single string containing the entire contents of the file including line terminator.+
    +     After this method completes successfully, the temp file is deleted.*/+
    +&FileData = &FiletoRead.GetString();+
    The function deletes the file so I had to create a temp copy of what i want to send and read that copy instead of the original file. Also, IB will have issues if you are trying to send an empty file. so i did a basic check, if the file is empty then put something in it.
    rem -- IB message will fail if we are trying to send an empty file;
    If None(&FileData) Or
    +&FileData = "" Or+
    +&FileData = " " Then+
    MessageBox(0, "", 0, 0, ("File " | &sTargetFileName | " is empty."));
    +&FileData = "No Data Found!";+
    End-If;
    Next, you need to load the file data that are now in &FileData to IB:
    +&MSG = CreateMessage(@&sServiceOperation);+
    +/* Generate the XML doc. */+
    +&dFtp = CreateXmlDoc("");+
    rem -- &bReturn = &dFtp.LoadIBContent("Some text inside of a file to send through IB!");
    +&bReturn = &dFtp.LoadIBContent(&FileData);+
    Then put XML into the message and publish it:
    +/*put the XML in the message*/+
    +&MSG.SetXmlDoc(&dFtp);+
    +%IntBroker.Publish(&MSG);+
    You might need to load some IBConnectorInfo and override them using your PC. I had to do that to get the password for the FTP transmission encrypted:
    /* Encrypt the password */
    &pscipher = CreateJavaObject("com.peoplesoft.pt.integrationgateway.common.EncryptPassword");
    &encPassword = &pscipher.encryptPassword(&sPassword);
    &pscipher = Null;
    Good luck and hope this helps.

  • Problem about writing txt file and  utl_put_line

    After some research on the internet I found the way how to writre files from Oracle 11g to a txt file.
    I read that utl_put_line only holds 32k per line and adds a new line at the end of each row but my problem it´s that if I want to open the file with SQL Server :D it doesn't recognize the CRLF so there is no end line and the last column has the data from the next row. The files are created on Linux so if I open them on Windows i have to convert into DOS format but if I try to open that file with Excel everything works fine, so I was wondering if there is a limit of columns or number of characters that can be on a txt file.
    There is my pl sql that I used to create my txt files:
    -------------------CODE-----------------------------
    declare
    cursor r1 is
    select * from dqstage.st_nomdetalle
    where sistema = 'NOR'
    and procesar = 0
    and identidad=02;
    cursor r2 ( p_parid number) is
    select * from dqstage.st_nomsubdetalle
    where par_id = p_parid
    and procesar = 0
    and sistema = 'NOR'
    and substr(nombrearchivo,6,2)=02;
    vcadena varchar2(4000);
    --vcadena1 varchar2(4000);
    vcadena1 clob;
    vcadena2 long;
    c number:=0;
    vencabezados long;
    archivo sys.utl_file.file_type;
    begin
    archivo:= SYS.UTL_FILE.FOPEN(location=>'UPEPE_DIR',filename=>'nor02.txt',open_mode=>'w',max_linesize=>32767);
    vencabezados :='FILEID|NOMBREARCHIVO|TIPOREGISTRO|IDENTIFICADORREGISTRO|FECHAEMISIONPAGO|CLAVETIPONOMINA|CLAVECT|TURNOCT|RFC|CURP|NUMEMPLEADOESTATAL'
    ||'|NUMSEGURIDADSOCIAL|NOMBRECOMPLETO|NOMBRES|PRIMERAPELLIDO|SEGUNDOAPELLIDO|CODIGOPAGADURIA|IDORIGENPRESUPUESTALPLAZA|CLAVEPRESUPUESTAL|'
    ||'PARTIDAPRESUPUESTAL|CODIGOPAGO|CLAVEUNIDAD|CLAVESUBUNIDAD|CLAVECATEGORIA|HSM|NUMEROPLAZA|CLAVENIVELPUESTO|CLAVENIVELSUELDO|ZONAECONOMICA|'
    ||'PERCEPCIONNETA|CLABECUENTA|NUMEROCHEQUE|CLAVEMOTIVOPAGORETROACTIVO|NUMTOTALPERDED|ERRORES|'
    ||'TIPOCONCEPTO1|CONCEPTOPAGO1|MONTO1|PERIODODEL1|PERIODOAL1|FUENTEFINANCIAMIENTO1|ORIGEN1|ERRORES1|'
    ||'TIPOCONCEPTO2|CONCEPTOPAGO2|MONTO2|PERIODODEL2|PERIODOAL2|FUENTEFINANCIAMIENTO2|ORIGEN2|ERRORES2|'
    ||'TIPOCONCEPTO3|CONCEPTOPAGO3|MONTO3|PERIODODEL3|PERIODOAL3|FUENTEFINANCIAMIENTO3|ORIGEN3|ERRORES3|'
    ||'TIPOCONCEPTO4|CONCEPTOPAGO4|MONTO4|PERIODODEL4|PERIODOAL4|FUENTEFINANCIAMIENTO4|ORIGEN4|ERRORES4|'
    ||'TIPOCONCEPTO5|CONCEPTOPAGO5|MONTO5|PERIODODEL5|PERIODOAL5|FUENTEFINANCIAMIENTO5|ORIGEN5|ERRORES5|'
    ||'TIPOCONCEPTO6|CONCEPTOPAGO6|MONTO6|PERIODODEL6|PERIODOAL6|FUENTEFINANCIAMIENTO6|ORIGEN6|ERRORES6|'
    ||'TIPOCONCEPTO7|CONCEPTOPAGO7|MONTO7|PERIODODEL7|PERIODOAL7|FUENTEFINANCIAMIENTO7|ORIGEN7|ERRORES7|'
    ||'TIPOCONCEPTO8|CONCEPTOPAGO8|MONTO8|PERIODODEL8|PERIODOAL8|FUENTEFINANCIAMIENTO8|ORIGEN8|ERRORES8|'
    ||'TIPOCONCEPTO9|CONCEPTOPAGO9|MONTO9|PERIODODEL9|PERIODOAL9|FUENTEFINANCIAMIENTO9|ORIGEN9|ERRORES9|'
    ||'TIPOCONCEPTO10|CONCEPTOPAGO10|MONTO10|PERIODODEL10|PERIODOAL10|FUENTEFINANCIAMIENTO10|ORIGEN10|ERRORES10|'
    ||'TIPOCONCEPTO11|CONCEPTOPAGO11|MONTO11|PERIODODEL11|PERIODOAL11|FUENTEFINANCIAMIENTO11|ORIGEN11|ERRORES11|'
    ||'TIPOCONCEPTO12|CONCEPTOPAGO12|MONTO12|PERIODODEL12|PERIODOAL12|FUENTEFINANCIAMIENTO12|ORIGEN12|ERRORES12|'
    ||'TIPOCONCEPTO13|CONCEPTOPAGO13|MONTO13|PERIODODEL13|PERIODOAL13|FUENTEFINANCIAMIENTO13|ORIGEN13|ERRORES13|'
    ||'TIPOCONCEPTO14|CONCEPTOPAGO14|MONTO14|PERIODODEL14|PERIODOAL14|FUENTEFINANCIAMIENTO14|ORIGEN14|ERRORES14|'
    ||'TIPOCONCEPTO15|CONCEPTOPAGO15|MONTO15|PERIODODEL15|PERIODOAL15|FUENTEFINANCIAMIENTO15|ORIGEN15|ERRORES15|'
    ||'TIPOCONCEPTO16|CONCEPTOPAGO16|MONTO16|PERIODODEL16|PERIODOAL16|FUENTEFINANCIAMIENTO16|ORIGEN16|ERRORES16|'
    ||'TIPOCONCEPTO17|CONCEPTOPAGO17|MONTO17|PERIODODEL17|PERIODOAL17|FUENTEFINANCIAMIENTO17|ORIGEN17|ERRORES17|'
    ||'TIPOCONCEPTO18|CONCEPTOPAGO18|MONTO18|PERIODODEL18|PERIODOAL18|FUENTEFINANCIAMIENTO18|ORIGEN18|ERRORES18|'
    ||'TIPOCONCEPTO19|CONCEPTOPAGO19|MONTO19|PERIODODEL19|PERIODOAL19|FUENTEFINANCIAMIENTO19|ORIGEN19|ERRORES19|'
    ||'TIPOCONCEPTO20|CONCEPTOPAGO20|MONTO20|PERIODODEL20|PERIODOAL20|FUENTEFINANCIAMIENTO20|ORIGEN20|ERRORES20|'
    ||'TIPOCONCEPTO21|CONCEPTOPAGO21|MONTO21|PERIODODEL21|PERIODOAL21|FUENTEFINANCIAMIENTO21|ORIGEN21|ERRORES21|'
    ||'TIPOCONCEPTO22|CONCEPTOPAGO22|MONTO22|PERIODODEL22|PERIODOAL22|FUENTEFINANCIAMIENTO22|ORIGEN22|ERRORES22|'
    ||'TIPOCONCEPTO23|CONCEPTOPAGO23|MONTO23|PERIODODEL23|PERIODOAL23|FUENTEFINANCIAMIENTO23|ORIGEN23|ERRORES23|'
    ||'TIPOCONCEPTO24|CONCEPTOPAGO24|MONTO24|PERIODODEL24|PERIODOAL24|FUENTEFINANCIAMIENTO24|ORIGEN24|ERRORES24|'
    ||'TIPOCONCEPTO25|CONCEPTOPAGO25|MONTO25|PERIODODEL25|PERIODOAL25|FUENTEFINANCIAMIENTO25|ORIGEN25|ERRORES25|'
    ||'TIPOCONCEPTO26|CONCEPTOPAGO26|MONTO26|PERIODODEL26|PERIODOAL26|FUENTEFINANCIAMIENTO26|ORIGEN26|ERRORES26|'
    ||'TIPOCONCEPTO27|CONCEPTOPAGO27|MONTO27|PERIODODEL27|PERIODOAL27|FUENTEFINANCIAMIENTO27|ORIGEN27|ERRORES27|'
    ||'TIPOCONCEPTO28|CONCEPTOPAGO28|MONTO28|PERIODODEL28|PERIODOAL28|FUENTEFINANCIAMIENTO28|ORIGEN28|ERRORES28|'
    ||'TIPOCONCEPTO29|CONCEPTOPAGO29|MONTO29|PERIODODEL29|PERIODOAL29|FUENTEFINANCIAMIENTO29|ORIGEN29|ERRORES29|'
    ||'TIPOCONCEPTO30|CONCEPTOPAGO30|MONTO30|PERIODODEL30|PERIODOAL30|FUENTEFINANCIAMIENTO30|ORIGEN30|ERRORES30|'
    ||'TIPOCONCEPTO31|CONCEPTOPAGO31|MONTO31|PERIODODEL31|PERIODOAL31|FUENTEFINANCIAMIENTO31|ORIGEN31|ERRORES31|'
    ||'TIPOCONCEPTO32|CONCEPTOPAGO32|MONTO32|PERIODODEL32|PERIODOAL32|FUENTEFINANCIAMIENTO32|ORIGEN32|ERRORES32|'
    ||'TIPOCONCEPTO33|CONCEPTOPAGO33|MONTO33|PERIODODEL33|PERIODOAL33|FUENTEFINANCIAMIENTO33|ORIGEN33|ERRORES33|'
    ||'TIPOCONCEPTO34|CONCEPTOPAGO34|MONTO34|PERIODODEL34|PERIODOAL34|FUENTEFINANCIAMIENTO34|ORIGEN34|ERRORES34|'
    ||'TIPOCONCEPTO35|CONCEPTOPAGO35|MONTO35|PERIODODEL35|PERIODOAL35|FUENTEFINANCIAMIENTO35|ORIGEN35|ERRORES35|'
    ||'TIPOCONCEPTO36|CONCEPTOPAGO36|MONTO36|PERIODODEL36|PERIODOAL36|FUENTEFINANCIAMIENTO36|ORIGEN36|ERRORES36|'
    ||'TIPOCONCEPTO37|CONCEPTOPAGO37|MONTO37|PERIODODEL37|PERIODOAL37|FUENTEFINANCIAMIENTO37|ORIGEN37|ERRORES37|'
    ||'TIPOCONCEPTO38|CONCEPTOPAGO38|MONTO38|PERIODODEL38|PERIODOAL38|FUENTEFINANCIAMIENTO38|ORIGEN38|ERRORES38|'
    ||'TIPOCONCEPTO39|CONCEPTOPAGO39|MONTO39|PERIODODEL39|PERIODOAL39|FUENTEFINANCIAMIENTO39|ORIGEN39|ERRORES39|'
    ||'TIPOCONCEPTO40|CONCEPTOPAGO40|MONTO40|PERIODODEL40|PERIODOAL40|FUENTEFINANCIAMIENTO40|ORIGEN40|ERRORES40|'
    ||'TIPOCONCEPTO41|CONCEPTOPAGO41|MONTO41|PERIODODEL41|PERIODOAL41|FUENTEFINANCIAMIENTO41|ORIGEN41|ERRORES41|'
    ||'TIPOCONCEPTO42|CONCEPTOPAGO42|MONTO42|PERIODODEL42|PERIODOAL42|FUENTEFINANCIAMIENTO42|ORIGEN42|ERRORES42|'
    ||'TIPOCONCEPTO43|CONCEPTOPAGO43|MONTO43|PERIODODEL43|PERIODOAL43|FUENTEFINANCIAMIENTO43|ORIGEN43|ERRORES43|'
    ||'TIPOCONCEPTO44|CONCEPTOPAGO44|MONTO44|PERIODODEL44|PERIODOAL44|FUENTEFINANCIAMIENTO44|ORIGEN44|ERRORES44|'
    ||'TIPOCONCEPTO45|CONCEPTOPAGO45|MONTO45|PERIODODEL45|PERIODOAL45|FUENTEFINANCIAMIENTO45|ORIGEN45|ERRORES45|'
    ||'TIPOCONCEPTO46|CONCEPTOPAGO46|MONTO46|PERIODODEL46|PERIODOAL46|FUENTEFINANCIAMIENTO46|ORIGEN46|ERRORES46|'
    ||'TIPOCONCEPTO47|CONCEPTOPAGO47|MONTO47|PERIODODEL47|PERIODOAL47|FUENTEFINANCIAMIENTO47|ORIGEN47|ERRORES47|'
    ||'TIPOCONCEPTO48|CONCEPTOPAGO48|MONTO48|PERIODODEL48|PERIODOAL48|FUENTEFINANCIAMIENTO48|ORIGEN48|ERRORES48|'
    ||'TIPOCONCEPTO49|CONCEPTOPAGO49|MONTO49|PERIODODEL49|PERIODOAL49|FUENTEFINANCIAMIENTO49|ORIGEN49|ERRORES49|'
    ||'TIPOCONCEPTO50|CONCEPTOPAGO50|MONTO50|PERIODODEL50|PERIODOAL50|FUENTEFINANCIAMIENTO50|ORIGEN50|ERRORES50';
    --||'TIPOCONCEPTO51|CONCEPTOPAGO51|MONTO51|PERIODODEL51|PERIODOAL51|FUENTEFINANCIAMIENTO51|ORIGEN51|ERRORES51';
    sys.utl_file.put_line(archivo, vencabezados);
    for i in r1 loop
    c:=c+1;
    vcadena := i.fileid||'|'||i.nombrearchivo||'|'||i.tiporegistro||'|'||i.identificadorregistro||'|'||i.fechaemisionpago||'|'||i.clavetiponomina||'|'||i.clavect||'|'||i.turnoct||'|'||i.rfc
    ||'|'||i.curp||'|'||i.numempleadoestatal||'|'||i.numseguridadsocial||'|'||i.nombrecompleto||'|'||i.nombres||'|'||i.primerapellido||'|'||i.segundoapellido||'|'||i.codigopagaduria
    ||'|'||i.idorigenpresupuestalplaza||'|'||i.clavepresupuestal||'|'||i.partidapresupuestal||'|'||i.codigopago||'|'||i.claveunidad||'|'||i.clavesubunidad||'|'||i.clavecategoria||'|'||i.hsm
    ||'|'||i.numeroplaza||'|'||i.clavenivelpuesto||'|'||i.clavenivelsueldo||'|'||i.zonaeconomica||'|'||i.percepcionneta||'|'||i.clabecuenta||'|'||i.numerocheque||'|'||i.clavemotivopagoretroactivo
    ||'|'||i.numtotalperded||'|'||i.errores;
    vcadena1:=null;
    for j in r2 (i.fileid) loop
    vcadena1 := vcadena1||'|'|| j.tipoconcepto||'|'||j.conceptopago||'|'||j.monto||'|'||j.periododel||'|'||j.periodoal||'|'||j.fuentefinanciamiento ||'|'||j.origen||'|'||j.errores;
    end loop;
    sys.utl_file.put_line(archivo, vcadena2);
    end loop;
    sys.utl_file.fclose(archivo);
    end;
    As you can see I write the column names first and with a loop I add the data, so I can have a very large column at the end.
    How can I add the CRLF at the end of each line to have it working with Windows?

    user2068122 wrote:
    After some research on the internet I found the way how to writre files from Oracle 11g to a txt file.
    I read that utl_put_line only holds 32k per line and adds a new line at the end of each row but my problem it´s that if I want to open the file with SQL Server :D it doesn't recognize the CRLF so there is no end line and the last column has the data from the next row. The files are created on Linux so if I open them on Windows i have to convert into DOS format but if I try to open that file with Excel everything works fine, so I was wondering if there is a limit of columns or number of characters that can be on a txt file.
    <snip>
    Oracle is simply passing a string of characters to the OS to be written to a file in the host OS's native text format. That format is different from Windows and nix.  Windows will append a CR-LF pair to the end of the provided character string, as its end-of-record delimiter.  nix will append only a CR (or is it LF?) as its end-of-record delimiter. This is purely and OS issue that Oracle knows or cares nothing about. It is also something that must always be kept in mind when passing files between *nix and Windows.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Import txt file

    Hi all.
    I'm on SQL Developer 3.1.07.
    I have a little question: is it possible to import a txt file using sql developer?
    When I try it, it gives me this error:
    no process reading recorded for the type txt
    How can I load data into my database, txt file in particular, using sql developer??
    Thanks all for collaboration,
    Fabrizio Delli Priscoli

    You may be able to import a text file if it is formatted in a way that meets the requirements of a delimited file. You can try renaming the file to have a .dsv extension (delimiter separated value). This will allow you to open the file with the import wizard. On the first page, select a delimiter that seems appropriate depending on the contents of the file (space, tab?).
    However, you may find that the columns can not be detected correctly by the import wizard because the fields are not marked by a fixed delimiter, which is a requirement of the import wizard.
    Good luck.
    Joyce Scapicchio
    SQL Developer Team

  • Uploading .txt file to z table

    Hai Friends,
    I want to upload a .txt file to Z table which contains around 27 fields. but .txt file contains data in two lines by as follows.
    4.5  2.36  21.56 25  36.14  47.00  145.3  1247.6
    10.2  4.6  23.5 589.1  20.1  45.6
    Is it possible to upload the .txt file.

    Hi,
      It is possible to upload txt file to ztable. You need to write small program for that.
       Please see the example code below. Here from excel they are converting to internal table, use 'GUI_UPLOAD' to convert text file data to internal table and use this internal table to upload data into ztable. use MODIFY ZTABLE FROM TABLE ITAB.
    Also maintain the internal table structure and structure of the ZTABLE should match.
    **& Report  Z_DEMO_FILL_TABLE
    report  z_demo_fill_table no standard page heading line-size 255.
    selection-screen begin of block b1 with frame title text-003.
    selection-screen skip.
    *File Name
    selection-screen begin of line.
    selection-screen comment 5(28) text-001 for field p_file.
    parameters: p_file type  rlgrap-filename.
    selection-screen end of line.
    selection-screen skip.
    selection-screen end of block b1.
    data declarations.
    *data: get_po_header type standard table of BAPIEKKOC,
         get_PO_HEADER_ADD_DATA type standard table of BAPIEKKOA,
         get_PO_ITEMS type standard table of BAPIEKPOC,
         get_PO_ITEM_ADD_DATA type standard table of BAPIEKPOA,
    data:   get_poheader type standard table of bapimepoheader,
            get_poitem type standard table of bapimepoitem,
            it_data type table of alsmex_tabline initial size 0.
    data: wa_poheader like line of get_poheader,
          wa_poitem like line of get_poitem,
          wa_data like line of it_data,
    *tables used for catching messages returned by bapi
          gt_return   type standard table of bapiret2,
          gt_return1   type standard table of bapiret2.
    types: begin of x_po_tab,
      doc_date type bapimepoheader-doc_date,
      comp_code type bapimepoheader-comp_code,
      purch_org type bapimepoheader-purch_org,
      pur_group type bapimepoheader-pur_group,
      vendor type bapimepoheader-vendor,
      po_number type bapimepoheader-po_number,
      pmnttrms type bapimepoheader-pmnttrms,
      po_item type bapimepoitem-po_item,
      material type bapimepoitem-material,
      plant type bapimepoitem-plant,
      stge_loc type bapimepoitem-stge_loc,
      tax_code type bapimepoitem-tax_code,
    end of x_po_tab.
                    Search help for file                                 *
    at selection-screen on value-request for p_file.
      call function 'F4_FILENAME'
       exporting
      PROGRAM_NAME        = SYST-CPROG
      DYNPRO_NUMBER       = SYST-DYNNR
         field_name          = 'P_FILE'
       importing
         file_name           = p_file.
                    START-OF-SELECTION                                   *
    start-of-selection.
    perform for uploading Excel file
      perform upload_file_path.
    perform for transfering Excel data to Internal table
      perform excel_to_itab.
      perform int_process.
    *&      Form  upload_file_path
          text
    -->  p1        text
    <--  p2        text
    form upload_file_path .
      call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        exporting
          filename                = p_file
          i_begin_col             = 1
          i_begin_row             = 1
          i_end_col               = 12
          i_end_row               = 5000
        tables
          intern                  = it_data
        exceptions
          inconsistent_parameters = 1
          upload_ole              = 2
          others                  = 3.
      if sy-subrc <> 0.
        message e000(zdbm) with 'Error in getting filename'.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    endform.                    " upload_file_path
    *&      Form  excel_to_itab
          text
    -->  p1        text
    <--  p2        text
    form excel_to_itab .
      loop at it_data into wa_data.
        at new row.
          clear: wa_poheader, wa_poitem.
        endat.
        case wa_data-col.
          when '001'.
            move wa_data-value to wa_poheader-doc_date.
          when '002'.
            move wa_data-value to wa_poheader-comp_code.
          when '003'.
            move wa_data-value to wa_poheader-purch_org.
          when '004'.
            move wa_data-value to wa_poheader-pur_group.
          when '005'.
            move wa_data-value to wa_poheader-vendor.
          when '006'.
            move wa_data-value to wa_poheader-po_number.
          when '007'.
            move wa_data-value to wa_poheader-pmnttrms.
          when '008'.
            move wa_data-value to wa_poitem-po_item.
          when '009'.
            move wa_data-value to wa_poitem-material.
          when '010'.
            move wa_data-value to wa_poitem-plant.
          when '011'.
            move wa_data-value to wa_poitem-stge_loc.
          when '012'.
            move wa_data-value to wa_poitem-tax_code.
        endcase.
        at end of row.
          append wa_poheader to get_poheader.
          append wa_poitem to get_poitem.
        endat.
        clear: wa_data.
      endloop.
    endform.                    " excel_to_itab
    *&      Form  Int_process
          text
    -->  p1        text
    <--  p2        text
    form int_process .
      loop at get_poheader into wa_poheader.
        read table get_poitem into wa_poitem index 1.
    call function 'BAPI_PO_CREATE1'
      exporting
        poheader                     = wa_poheader
      POHEADERX                    =
      POADDRVENDOR                 =
      TESTRUN                      =
      MEMORY_UNCOMPLETE            =
      MEMORY_COMPLETE              =
      POEXPIMPHEADER               =
      POEXPIMPHEADERX              =
      VERSIONS                     =
      NO_MESSAGING                 =
      NO_MESSAGE_REQ               =
      NO_AUTHORITY                 =
      NO_PRICE_FROM_PO             =
    IMPORTING
      EXPPURCHASEORDER             =
      EXPHEADER                    =
      EXPPOEXPIMPHEADER            =
    tables
      RETURN                       =
       poitem                       = get_poitem
      POITEMX                      =
      POADDRDELIVERY               =
      POSCHEDULE                   =
      POSCHEDULEX                  =
      POACCOUNT                    =
      POACCOUNTPROFITSEGMENT       =
      POACCOUNTX                   =
      POCONDHEADER                 =
      POCONDHEADERX                =
      POCOND                       =
      POCONDX                      =
      POLIMITS                     =
      POCONTRACTLIMITS             =
      POSERVICES                   =
      POSRVACCESSVALUES            =
      POSERVICESTEXT               =
      EXTENSIONIN                  =
      EXTENSIONOUT                 =
      POEXPIMPITEM                 =
      POEXPIMPITEMX                =
      POTEXTHEADER                 =
      POTEXTITEM                   =
      ALLVERSIONS                  =
      POPARTNER                    =
      POCOMPONENTS                 =
      POCOMPONENTSX                =
      POSHIPPING                   =
      POSHIPPINGX                  =
      POSHIPPINGEXP                =
      endloop.
    endform.                    " Int_process

  • Loading the data from a text file to a table using pl/sql

    Hi Experts,
    I want to load the data from a text (sample1.txt) file to a table using pl/sql
    I have used the below pl/sql code
    declare
    f utl_file.file_type;
    s varchar2(200);
    c number := 0;
    begin
    f := utl_file.fopen('TRY','sample1.txt','R');
    loop
    utl_file.get_line(f,s);
    insert into sampletable (a,b,c) values (s,s,s);
    c := c + 1;
    end loop;
    exception
    when NO_DATA_FOUND then
    utl_file.fclose(f);
    dbms_output.put_line('No. of rows inserted : ' || c);
    end;
    and my sample1.txt file looks like
    1
    2
    3
    The data is getting inserted, with below manner
    select * from sampletable;
    A     B     C
    1     1     1
    2     2     2
    3     3     3
    I want the data to get inserted as
    A     B     C
    1     2     3
    The text file that I have is having three lines, and each line's first value should go to each column
    Please help...
    Thanks

    declare
    f utl_file.file_type;
    s1 varchar2(200);
    s2 varchar2(200);
    s3 varchar2(200);
    c number := 0;
    begin
    f := utl_file.fopen('TRY','sample1.txt','R');
    utl_file.get_line(f,s1);
    utl_file.get_line(f,s2);
    utl_file.get_line(f,s3);
    insert into sampletable (a,b,c) values (s1,s2,s3);
    c := c + 1;
    utl_file.fclose(f);
    exception
    when NO_DATA_FOUND then
    if utl_file.is_open(f) then utl_file.fclose(f); ens if;
    dbms_output.put_line('No. of rows inserted : ' || c);
    end;SY.

  • How to pass .txt file as an attachment to the web service (SOAP Attachment)

    Hi,
    I am creating web service using NetBeans 6.5 IDE and JAX-WS. I create a web application and then create web service using provided interface. I want to add .txt file as an attachment/parameter to the web service operation using "Add operation" interface. Don't want to add as an attachment to the SOAP message by creating it explicitly. IDE generates SOAP request and response automatically when the service is tested using "Test Web service" option. How can I add attcahment when I add operation so that it will appear in the generated SOAP message ?
    TIA.

    Hi AnitaDP,
    Attachment doesn't work in web service. You have to pass the content of the text file as a String or as an array of bytes to a method of your web service. From there, you may save the passed data in a file.

  • Read a txt file & pass it to AppleScript

    I was originally going to try to do this purely with AppleScript, but someone (who knows a lot more than me) told me it would be better to do it with a shell script.
    What I want to do is read the contents of a txt file, which would contain a single URL. It would then pass the contents of that text file (the URL) on to be run by AppleScript, via osascript. Here's the AppleScript that should be run via osascript:
    tell application "Safari"
      add reading list item fileContents
    end tell
    So basically it would grab the URL from the text file and add it to Safari's Reading List. Any help would be greatly apreciated.

    Here's the thing...
    It's almost impossible to get a shell script to interact with Safari - not quite, but bizarrely difficult.
    AppleScript, on the other hand, is designed with the explicit goal of facilitating inter-process communication - one process telling another process to do something.
    To do it all via the shell would likely either mean directly manipulating Safari's preference files to include the data you want, or invoking AppleScript (via osascript) to tell Safari what you want it to do.
    The former is a nightmare proposition, which leaves the latter, and if you're going to resort to using AppleScript (even via osascript) then why not do the whole thing in AppleScript and be happy.
    At the end of the day it's about using the right tool for the job. AppleScript was designed for this kind of thing. It's hard to see a better way of doing it.
    I suspect your 'someone' doesn't really know as much as you think (or they think )

  • How to download a .txt file correctly. Please help as soon as possible!

    Hi everybody,
    I need to implement download that prompts the user to save a txt file.
    If I use "attachment" in response.setHeader, my IE 5.50 crashes after downloading 4 to 6 files consecutively.
    I tried to change the response.setHeader to "inline" and the response.setContentType to "application/zip" or "application/UNKNOWN", and although it works in IE 5.50, my IE 5.00 never prompts asking to save the file, it always opend the file into the browser window, and I need a prompt.
    I saw many questions related with this problem in this forum, but none that answered accurately to this problem.
    Please help as soon as possible, I dont have much time to do this.
    Thank you very much.

    Thank you gypsy617 for your reply, but it still does not work!
    I made all the changes to
    1)res.setContentType("application/x-download");
    2)res.setHeader("Content-Disposition", "attachment; filename=" + filename);
    3)OutputStream out = res.getOutputStream();
    4)returnFile(filename, out);
    5) and i sent the file content as bytes
    But the real problem is regarding the "attachment" option !!!
    In my application, in the same page, there are a lot of links that users can download, each one a link that calls a action. It works well for the first downloaded file, for the second, ..., and then, when we try to download the file number 4 or 5, IE says that there is a problem and it must close (and it asks us to send a report - something like "Exception Information Code:0xc0000005 Flags:0x00000000 Record:0x0000000000000000 Address:0x0000000077a7710a").
    I know that the problem is the "attachment" because if I choose "inline", IE never crashes. But i really need a Save As dialog, the txt files cannot be openned into the browser window, so i cant use inline.
    Any idea?
    Thank you.

  • Is it possible to do some researches for .txt files or .doc files in labview?

    Hi,
    I want to do some researches to a .txt file or a .doc file so as to find some keywords.then make some operations to the file to save it later.I wonder if it is possible for bits operations and for researches?
    Thanks a lot.

    Absolutely.
    From your block diagram, in the Functions Palette, click on "File I/O". You'll find a number of useful vi's. For instance, you can use the "Read Characters From File" or "Scan From File" vi's to read character strings, which can be manipulated using the string functions (vi's).
    You can also click on "Binary File vi's" if you are dealing with bit-operations.
    You can read a file, parse it, manipulate the data and write it back, all within LabView. It is very useful for that.
    Explore & have fun! )
    -JLV-

  • How to run and pass parameters to exe file from the .txt file

    hi,
     i am facing problem with passing parameters to the .exe file which is run by labview.firstly i have  .txt script with parameters which i have to pass to .exe file. This .exe file is also a software and that script is written for it.And now i have to create  programm in labview which should fullfill following points.
      1. I have to use one knob named 'Run script'.If i pressed the knob ,it should open the Browser where i can choose .txt script file.
      2. .exe application should open(Path already chossen).
      3. after passing the parameters .exe application should closed.
      4.And labview now should update his parameter
    I can just open .exe file using Exce.vi but i dont getting any idea to do more than this.can somebody please help me?
    Solved!
    Go to Solution.

    This depends on the exe file. Does it retrieve the information as standard input or does it require the information as command line arguments?
    Depending on this, you can read the txt-file in LV (using the file functions) and pass the content to the System Exec.vi.
    Norbert 
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • Is it possible to read txt files on the new ipod nano? as it was on the 5th gen

    is it possible to read txt files on the new ipod nano? as it was on the 5th gen.

    We won't know for sure until either the iPod is released and somebody can verify that or when the manual is available online from Apple.
    B-rock

Maybe you are looking for