Passing contents of text file in oracle cursor

Hi,
I need to pass the content of text file in cursor and pass it on to calling codes. then calling codes will generate another text at their end. Can some help how can I pass contents of text file in oracle cursor? Thanks

i need to do it without tables for some reasons.

Similar Messages

  • Unable to find file error while loading data from text file to Oracle

    Hi,
    I am having a interface where i am loading a data of Text file to Oracle.
    But when i am trying to do this i am getting following error.
    ODI-1227: Task SrcSet0 (Loading) fails on the source FILE connection SAPMM.
    Caused By: java.sql.SQLException: File not found: d:/mdb/#General.get_filename
         at com.sunopsis.jdbc.driver.file.FileResultSet.<init>(FileResultSet.java:160)
         at com.sunopsis.jdbc.driver.file.impl.commands.CommandSelect.execute(CommandSelect.java:57)
         at com.sunopsis.jdbc.driver.file.CommandExecutor.executeCommand(CommandExecutor.java:33)
    SAPMM is connection name.
    I am using get_filename to get the filename and it is fetching correct value as the this variable refreshes in previous step of this interface.
    KM used for loading is File to SQL
    What would be cause of this error?
    Thanks,
    Mahesh

    Hi,
    Did a testing and following are the result
    I have
    A> created package having steps like
    1. Declaration of variable v_filename.
    2. Refreshing variable v_filename.
    3. Execution of Interface which gets the file name from v_filename and load into target table
    Package executes successfully.
    B> created package having steps like
    1. Declaration of variable v_filename.
    2. Refreshing variable v_filename.
    3. Scenario of Interface which gets the file name from v_filename and load into target table
    Package executes with erre as it is not able to find the file
    C> created package having steps like
    1. Declaration of variable v_filename.
    2. Refreshing variable v_filename.
    3. Execution of Interface which gets the file name from v_filename and load into target table
    4. Now create a scenario of the package , use the generated scenario in another package say main_package
    Execution of main_package is successful.
    Thanks,
    Sutirtha

  • How to load date and time from text file to oracle table through sqlloader

    hi friends
    i need you to show me what i miss to load date and time from text file to oracle table through sqlloader
    this is my data in this path (c:\external\my_data.txt)
    7369,SMITH,17-NOV-81,09:14:04,CLERK,20
    7499,ALLEN,01-MAY-81,17:06:08,SALESMAN,30
    7521,WARD,09-JUN-81,17:06:30,SALESMAN,30
    7566,JONES,02-APR-81,09:24:10,MANAGER,20
    7654,MARTIN,28-SEP-81,17:24:10,SALESMAN,30my table in database emp2
    create table emp2 (empno number,
                      ename varchar2(20),
                      hiredate date,
                      etime date,
                      ejob varchar2(20),
                      deptno number);the control file code in this path (c:\external\ctrl.ctl)
    load data
    infile 'C:\external\my_data.txt'
    into table emp2
    fields terminated by ','
    (empno, ename, hiredate, etime, ejob, deptno)this is the error :
    C:\>sqlldr scott/tiger control=C:\external\ctrl.ctl
    SQL*Loader: Release 10.2.0.1.0 - Production on Mon May 31 09:45:10 2010
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Commit point reached - logical record count 5
    C:\>any help i greatly appreciated
    thanks
    Edited by: user10947262 on May 31, 2010 9:47 AM

    load data
    infile 'C:\external\my_data.txt'
    into table emp2
    fields terminated by ','
    (empno, ename, hiredate, etime, ejob, deptno)Try
    load data
    infile 'C:\external\my_data.txt'
    into table emp2
    fields terminated by ','
    (empno, ename, hiredate, etime "to_date(:etime,'hh24:mi:ss')", ejob, deptno)
    this is the error :
    C:\>sqlldr scott/tiger control=C:\external\ctrl.ctl
    SQL*Loader: Release 10.2.0.1.0 - Production on Mon May 31 09:45:10 2010
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Commit point reached - logical record count 5
    C:\>
    That's not an error, you can see errors within log and bad files.

  • How to save the RichTextBox Content in Text file

    hI ,
    I NEED TO SAVE THE RichTextBox Content in text file ? 

    If this IS a LabVIEW question, here's an example of how to load a rich text file (to help if you don't know how to get a rich text in LabVIEW).
    If you have a Rich Text Box, you can use the invoke method "SaveFile" to match the function you linked to.

  • Reading Text Files using Oracle PL/SQL and UTL_FILE

    Hi, experts. I tried to read a text file into oracle. Here is what i did:
    1. Create a text file in the directory: C:\temp\New Text Document.txt
    2. Run the following SQL in PL/SQL:
    CREATE or replace DIRECTORY sampledata AS 'C:\temp\';
    grant read, write on directory sampledata to public;
    3. When I run the following code, it caused an error: ora-29280: invalid directory path. I have alread checked the directory path, it is correct. Would someone know what wrong is my code?
    declare
    f utl_file.file_type;
    s varchar2(3000);
    begin
    f := utl_file.fopen('sampledata','New Text Document.txt','R');
    utl_file.get_line(f,s);
    utl_file.fclose(f);
    dbms_output.put_line(s);
    end;
    Thank you

    Try with a filename without spaces:No problem with spaces
    SQL> declare
      2  f utl_file.file_type;
      3  s varchar2(3000);
      4  begin
      5  f := utl_file.fopen('SAMPLEDATA','New Text Document.txt','R');
      6  utl_file.get_line(f,s);
      7  utl_file.fclose(f);
      8  dbms_output.put_line(s);
      9  end;
    10  /
    line1
    PL/SQL procedure successfully completed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Import Text File to Oracle Table

    Hi Guys,
    Just needed some advice on how to approach this project. I need to set up an automated schedule to import a text file into an oracle table. There will be a folder set up, where a file is put every day for me. The file will have a name such as Name_Extract_<Date>. It will always start with the words Name_extract_ and the date appended to it. I need to import this text file into oracle, then perhaps copy the file to another folder when import is finished.
    What will be the best method to use to accomplish this?? SQl Loader, UTL_FILE package? Any help will be appreciated.

    Not much details but depending on versions etc of your Oracle database I'd look into external tables. Perhaps even leverage DBFS (only available in 11.2).
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10713/tablecls.htm#CNCPT1141
    -Andy

  • Upload text file to oracle table with checking and aggregation

    Hi Friends,
    I am new to ODI.  I have encountered a problem which is specific to ODI 11G (11.1.1.6.3) to upload text file to oracle table with checking and aggregation.  Would you please teach me how to implement the following requirement in ODI 11G?
    Input text file a:
    staffCode, staffCat, status, data
    input text file b:
    staffCodeStart, staffCodeEnd, staffCat
    temp output oracle table c:
    staffCat, data
    output oracle table d:
    staffCat, data
    order:
    a.staffCode, a.staffCat, a.status
    filter:
    a.status = ‘active’
    join:
    a left outerjoin b on a.staffCode between b.staffCodeStart and b.staffCodeEnd
    insert temp table c:
    c.staffCat = if b.staffCat is not null then b.staffCat else a.staffCat
    c.data = a.data
    insert table d:
    if c.staffCat between 99 and 1000 then d.staffCat = c.staffCat, d.data = sum(c.data)
    else d.staffCat = c.staffCat, d.data = LAST(c.data)
    Any help on fixing this is highly appreciated. Thanks!!
    Thanks,
    Chris

    Dear Santy,
    Many thanks for your prompt reply.  May I have more information about the LAST or SUM step?
    I was successful to create and run the following interfaces p and q
    1. Drag text file a to a newly created interface panel p
    2. Filter text file a : a.status = ‘active’
    3. Lookup text file a to text file b : a.staffCode between b.staffCodeStart and b.staffCodeEnd
    4. Drag oracle temp table c to interface panel p
    5. Set c.staffCat : CASE WHEN b.staffCat IS NULL THEN a.staffCat ELSE b.staffCat END
    6. Set c.data : a.data
    7. Drag oracle temp table c to a newly created interface panel q
    8. Drag oracle table d to interface panel q
    9. Set UK to d.staffCat
    10. Set Distinct Rows to table d
    11. Set d.staffCat = c.staffCat
    12. Set d.data = SUM(c.data)
    However, the interface q should be more than that:
    If c.staffCat is between 99 and 1000, then d.data = the last record c.data; else d.data = sum(c.data)
    Would you please teach me how to do the LAST or SUM steps?  Moreover, can interface p and interface q be combined to one interface and do not use the temp table c?  Millions thanks!
    Regards,
    Chris

  • "how to load a text file to oracle table"

    hi to all
    can anybody help me "how to load a text file to oracle table", this is first time i am doing, plz give me steps.
    Regards
    MKhaleel

    Usage: SQLLOAD keyword=value [,keyword=value,...]
    Valid Keywords:
    userid -- ORACLE username/password
    control -- Control file name
    log -- Log file name
    bad -- Bad file name
    data -- Data file name
    discard -- Discard file name
    discardmax -- Number of discards to allow (Default all)
    skip -- Number of logical records to skip (Default 0)
    load -- Number of logical records to load (Default all)
    errors -- Number of errors to allow (Default 50)
    rows -- Number of rows in conventional path bind array or between direct path data saves (Default: Conventional path 64, Direct path all)
    bindsize -- Size of conventional path bind array in bytes (Default 256000)
    silent -- Suppress messages during run (header, feedback, errors, discards, partitions)
    direct -- use direct path (Default FALSE)
    parfile -- parameter file: name of file that contains parameter specifications
    parallel -- do parallel load (Default FALSE)
    file -- File to allocate extents from
    skip_unusable_indexes -- disallow/allow unusable indexes or index partitions (Default FALSE)
    skip_index_maintenance -- do not maintain indexes, mark affected indexes as unusable (Default FALSE)
    commit_discontinued -- commit loaded rows when load is discontinued (Default FALSE)
    readsize -- Size of Read buffer (Default 1048576)
    external_table -- use external table for load; NOT_USED, GENERATE_ONLY, EXECUTE
    (Default NOT_USED)
    columnarrayrows -- Number of rows for direct path column array (Default 5000)
    streamsize -- Size of direct path stream buffer in bytes (Default 256000)
    multithreading -- use multithreading in direct path
    resumable -- enable or disable resumable for current session (Default FALSE)
    resumable_name -- text string to help identify resumable statement
    resumable_timeout -- wait time (in seconds) for RESUMABLE (Default 7200)
    PLEASE NOTE: Command-line parameters may be specified either by position or by keywords. An example of the former case is 'sqlldr scott/tiger foo'; an example of the latter is 'sqlldr control=foo userid=scott/tiger'. One may specify parameters by position before but not after parameters specified by keywords. For example, 'sqlldr scott/tiger control=foo logfile=log' is allowed, but 'sqlldr scott/tiger control=foo log' is not, even though the position of the parameter 'log' is correct.
    SQLLDR USERID=GROWSTAR/[email protected] CONTROL=D:\PFS2004.CTL LOG=D:\PFS2004.LOG BAD=D:\PFS2004.BAD DATA=D:\PFS2004.CSV
    SQLLDR USERID=GROWSTAR/[email protected] CONTROL=D:\CLAB2004.CTL LOG=D:\CLAB2004.LOG BAD=D:\CLAB2004.BAD DATA=D:\CLAB2004.CSV
    SQLLDR USERID=GROWSTAR/[email protected] CONTROL=D:\GROW\DEACTIVATESTAFF\DEACTIVATESTAFF.CTL LOG=D:\GROW\DEACTIVATESTAFF\DEACTIVATESTAFF.LOG BAD=D:\GROW\DEACTIVATESTAFF\DEACTIVATESTAFF.BAD DATA=D:\GROW\DEACTIVATESTAFF\DEACTIVATESTAFF.CSV

  • Output query result to a text file in ORACLE

    I Need a procedure for generating output query into text file in Oracle.
    for Example,
    A table called Tab1
    the columns are c1,c2,c3,c4,c5.
    I want to store the data in text file in...
    First row as a column name & then, appear the records in second row onwards...
    c1|c2|c3|c4|c5.
    Please kindly provide the solution for this ASAP.

    In case you are using Oracle 9i or higher you should better create a DIRECTORY rather then setting utl_file_dir,e.g.
    SQL> CREATE DIRECTORY log_dir AS '/appl/gl/log';
    SQL> GRANT READ ON DIRECTORY log_dir TO DBA; http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/u_file.htm#ARPLS069

  • Modifying the contents of text file ini j2me

    Hi,
    I'm developing a application in j2me wherein i need to erase the previous stored contents fromthe text file and store new content submitted thru the front end program. Kindly please suggest me how to proceed in this regard.
    Thanks

    If you want to change an ini file in the jar file: you can't do that.
    You can however store the changes in the RMS.

  • How to store the content of a file in oracle table.

    Hello,
    I have a .xml file in unix , how can i upload the content of that file into a column of a table in oracle?

    Did you look at the link posted in response to the OP? At a quick look, it seems fairly reasonable to me.
    John

  • How to get the content of text file to write in JTextArea?

    Hello,
    I have text area and File chooser..
    i wanna the content of choosed file to be written into text area..
    I have this code:
    import java.awt.Container;
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.File;
    import javax.swing.JButton;
    import javax.swing.JFileChooser;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.*;
    public class Test_Stemmer extends JFrame {
    public Test_Stemmer() {
    super("Arabic Stemmer..");
    setSize(350, 470);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setResizable(false);
    Container c = getContentPane();
    c.setLayout(new FlowLayout());
    JButton openButton = new JButton("Open");
    JButton saveButton = new JButton("Save");
    JButton dirButton = new JButton("Pick Dir");
    JTextArea ta=new JTextArea("File will be written here", 10, 25);
    JTextArea ta2=new JTextArea("Stemmed File will be written here", 10, 25);
    final JLabel statusbar =
                  new JLabel("Output of your selection will go here");
    // Create a file chooser that opens up as an Open dialog
    openButton.addActionListener(new ActionListener() {
       public void actionPerformed(ActionEvent ae) {
         JFileChooser chooser = new JFileChooser();
         chooser.setMultiSelectionEnabled(true);
         int option = chooser.showOpenDialog(Test_Stemmer.this);
         if (option == JFileChooser.APPROVE_OPTION) {
           File[] sf = chooser.getSelectedFiles();
           String filelist = "nothing";
           if (sf.length > 0) filelist = sf[0].getName();
           for (int i = 1; i < sf.length; i++) {
             filelist += ", " + sf.getName();
    statusbar.setText("You chose " + filelist);
    else {
    statusbar.setText("You canceled.");
    // Create a file chooser that opens up as a Save dialog
    saveButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent ae) {
    JFileChooser chooser = new JFileChooser();
    int option = chooser.showSaveDialog(Test_Stemmer.this);
    if (option == JFileChooser.APPROVE_OPTION) {
    statusbar.setText("You saved " + ((chooser.getSelectedFile()!=null)?
    chooser.getSelectedFile().getName():"nothing"));
    else {
    statusbar.setText("You canceled.");
    // Create a file chooser that allows you to pick a directory
    // rather than a file
    dirButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent ae) {
    JFileChooser chooser = new JFileChooser();
    chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    int option = chooser.showOpenDialog(Test_Stemmer.this);
    if (option == JFileChooser.APPROVE_OPTION) {
    statusbar.setText("You opened " + ((chooser.getSelectedFile()!=null)?
    chooser.getSelectedFile().getName():"nothing"));
    else {
    statusbar.setText("You canceled.");
    c.add(openButton);
    c.add(saveButton);
    c.add(dirButton);
    c.add(statusbar);
    c.add(ta);
    c.add(ta2);
    public static void main(String args[]) {
    Test_Stemmer sfc = new Test_Stemmer();
    sfc.setVisible(true);
    }could you please help me, and tell me what to add or to modify,,
    Thank you..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    realahmed8 wrote:
    thanks masijade,
    i have filter the file chooser for only text files,
    but i still don't know how to use FileReader to put text file content to the text area (ta) ..
    please tell me how and where to use it..How? -- See the IO Tutorials on Sun for the FileReader (and I assume you know how to call setText and append in the JTextArea).
    Where? -- In the actionPerformed method (better would be a separate thread that is triggered through the actionPerformed method, but that is probably beyond you at the moment), of course.
    Give it a try.

  • SQL Loader - Loading Text File into Oracle Table that has carriage returns

    Hi All,
    I have a text file that I need to load into a table in Oracle using SQL Loader. I'm used to loading csv or comma delimited files into Oracle so I'm not sure what the syntax is when it comes to loading a text file that essentially has one value per row and each row is separated by a carriage return. So when you open the text file, the records look like this:
    999999999 <CRLF>
    888888889 <CRLF>
    456777777 <CRLF>
    456555535 <CRLF>
    345688888 <CRLF>
    So each row is separated by a hard return and I need to tell sql loader that the hard return or next row is the next value to insert into the table. Below is an example of a control file I tend to use as a template for loading csv files but I need to modify it to accomodate this new structure.
    OPTIONS (DIRECT=TRUE,ROWS=100000)
    UNRECOVERABLE
    LOAD DATA
    INFILE 'C:\input.txt'
    BADFILE 'C:\input.bad'
    APPEND
    INTO TABLE TEST_TABLE
    FIELDS TERMINATED BY ","
    TRAILING NULLCOLS
    COLUMN_1
    How to I modify the control file above to use hard returns as the field/row delimiter for my text file?
    Thanks

    Hi there,
    Obviously my intention wasn't to post the same message 4 times....I pressed the "Submit Message" button but the submission hung and I pressed it a few times and finally it worked but it created several versions of my post. You need to allow users the ability to delete there own postings...I was looking for this option but didn't have it.
    Sorry

  • Output folder contents into text file

    Hello, everyone.
    I am new to automator, and I'd like to learn how to use it. Recently, someone asked me if there was a way that they could select a folder and somehow dump the filenames of all items in that folder (non-recursively) to a text file. It seems to me that this is the sort of thing that Automator would be able to do. Can anyone give me some tips on how I might go about doing this?
    I also figured this might be possible with a custom bash command. I am more experienced with bash and Unix command line, so if there is a better option there, please let me know. I just figured I would check here first.
    Thanks!

    That does work, but the only problem is that the folder who's contents are being exported will be different every time. (I see now that I didn't specify that in my first post). Ideally, he would either be given an option to select a folder to read, or he would just be able to drag and drop the folder onto an application (or into terminal) and have it perform this task.

  • Need to search contents of text files on a windows network drive....

    I am trying to search the content of a directory on a windows network drive for that contains .sas files (essentially text files) for a certain text string. Find does not seem to do this. Any ideas/suggestions?
    When I copy a file to my desktop I can do it easily, but that is not an option.

    Uh yeah....in my opinion GREATLY affects Apple's claim to windows compatibility......unless there is a solution out there. My firm is windows-based and we have a terabyte or so of data and files related to various stuff all buried in subfolders..and all I want is to search one folder for one text string.
    I'm praying for a solution here.....

Maybe you are looking for

  • Report with all monitors & their threshold for a server for SCOM 2007 R2

    Hi,  I need a report with all monitored monitors & rules with their effective threshold for SCOM 2007 R2. I tried few scripts & tools mentioned on different blogs, but not getting anything. Any help in this regard would be highly appreciated. TIA

  • How to create a PDF output

    When I select my ADOBE PDF printer from my printer list and print to file I don't get a PDF file. I get a PRN file. When I try to open it with ADOBE I get a "syntax error". But there's no information about what the error is. Is there anyway to get PD

  • I am trying to connect my HP Officejet 6500a to my Acer 3503WLMi laptop.

    I am running Windows XP and think it may work with ePrint. I can,t  find where to go to get the app for ePrint?  I,m not very switched on when it comes to this sort of thing. Somebody PLEASE help me

  • Cannot Transfer video footage from SD Card to Final Cut

    I have a Panasonic SDHC 32GB card with footage that I can't seem to log and transfer from the card. The only feature that they all seem to have in common is that they are long Clips (10min+), the smaller clips transferred just fine. #1, 8, 9 ,10 and

  • Order QTY should not exceed than reference document

    Dear Gurus, I am creating a Release order with reference to Contract. Ex. order qty is 100 in Contract, while doing sale order it should not allow to change the order qty more than 100 [not more than Ref. document qty]. I have tried in VTAA, completi