PLSQL and CSV file

Hi Gurus,
I am trying to automate a process where in i will pass the path and name of the csv file to the procedure. It will automatically create an external table script and execute it. I have already prepared the script using Vb Script, however need to create it in PL-SOL package/procedure.
Could any please tell me how can i retrieve the header(feilds/columns) of the csv files using PL-SQL.
Regards,
Ravi Remje

Hi Al and Blu,
Before i could start i will give you a little background of why i want to follow this stuff.
I have task allocated in a Data warehousing area. We use the OWB (Oracle Warehouse Builder an ETL tool) for transformation of the data. I have Databse installed in UNIX box and OWB client on Windows XP.
We usually gets the data feed in either excel or in a csv file format. Now with the OWB tool it is very much easy to create an external table from the csv file or if the source is in excel just convert it into csv and pull inside the database using this tool on a simple right-click event. I have a problem here, the OWB tool does not have access to the folder where the flat file/csv file is stored. I guess some privileges issue. As a result i have to manually create an external table i.e., manually writing down the script as below.
CREATE TABLE EXT_SAMPLE_EXTERNAL
+(+
COLUMN1 VARCHAR2(255),
COLUMN2 VARCHAR2(255)
+)+
ORGANIZATION EXTERNAL
+( TYPE ORACLE_LOADER+
DEFAULT DIRECTORY "DATA_PUMP_DIR"
ACCESS PARAMETERS
+( RECORDS DELIMITED BY NEWLINE+
CHARACTERSET WE8MSWIN1252
STRING SIZES ARE IN BYTES
BADFILE DATA_PUMP_DIR:"Sample_external.BAD"
NODISCARDFILE
LOGFILE DATA_PUMP_DIR:"Sample_external.LOG"
SKIP 1 FIELDS TERMINATED BY  ','
OPTIONALLY ENCLOSED BY '"' AND '"'
NOTRIM
+(+
Column1 CHAR,
Column2 CHAR
+)+
+)+
LOCATION
+(+
+'Sample_external.csv'+
+)+
+)+
REJECT LIMIT UNLIMITED;
Hence, i automated the process using VBScript. Now my VBscript opens the csv file and get the header and runs some set of statements..applying some for loop and create the above statement automatically.
Now i want to apply it using PL-SQL statements. Using similar technique i will prepare the script which will not only create the external table automatically but will also archive the old files/records into other directory by some ftp commands and renaming the files with the time-stamp. This procedure ius executed whenever new data file is been loaded.
But I am still stuck in the step1 now :-(.
I hope this works. I dont know thinking out-of the box can make me bald :)
Regards,
Ravi R

Similar Messages

  • How Can I Import Contacts from Excel (XLSX/XLS) and CSV file to VCF File?

    Hi Friends,
    I have stored my all official and personal contacts list in the Excel (XLSX/XLS) spreadsheet and CSV file from long time. But now, I want to move my all contacts in an MS outlook 2013 and also Samsung S4 Contacts directory. But for this process, I require to import all Excel and CSV file contacts into VCF file format. So that, I could export vCard (VCF) file in the outlook and Samsung S4 contacts book. But I don't know about this process that how to import Excel and CSV file contacts into vCard format. If anyone has best solution to import and export excel or CSV file contacts into VCF file, so please share with me that information.
    Thanks & Best Regards
    Jackson T.
    <Edited By Host>

    https://itunes.apple.com/gb/app/csv-to-vcard/id713295900?mt=12

  • How to Read the "text file and csv file" through powershell Scripts

    Hi All
    i need to add a multiple users in a particular Group through powershell Script how to read the text and CSV files in powershell
    am completly new to Powershell scripts any one pls respond ASAP.with step by step process pls
    Regards:
    Rajeshreddy.k

    Hi Rajeshreddy.k,
    To add multiple users to one group, I wouldn't use a .csv file since the only value you need from a list is the users to be added.
    To start create a list of users that should be added to the group, import this list in a variable called $users, the group distinguishedName in a variable called $Group and simply call the ActiveDirectory cmdlet Add-GroupMember.
    $Users = Get-Content -Path 'C:\ListOfUsernames.txt'
    $Group = 'CN=MyGroup,OU=MyOrg,DC=domain,DC=lcl'
    Add-ADGroupMember -Identity $Group -Members $Users

  • Ssrs 2008 export to excel and csv file

    In a ssrs 2008 report, the user will export data to PDF, excel, and CSV files. When the report is exported to excel or csv file, the user wants me to hide some tablixes. Thus can you show me code on how to export the reports to csv or excel file without
    and be able to hide a few tablixes?

    Hi jazz_dog,
    According to your description, you want to set the visibility for some tablixes based on the exporting file type. Right?
    In Reporting Services 2008, we don't have any parameter to get type of exporting file. So we can only create a parameter and select a type before exporting to a file. Then use conditional expression to control the visibility. It's definitely not a good workaround,
    so your goal can't be achieved in Reporting Services 2008. However, for Reporting Service 2008R2 or later version, we have a build-in parameter called Render Format Name, this parameter will display the type of exporting file automatically. So we can make
    the judgment in expression based on the value of this parameter.
    Reference:
    Built-in Globals and Users References (Report Builder and SSRS)
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • How can I add links to open xml and csv files stored in another location? Please advice how to place links in my frame maker document?

    Hi,
    I would like to know as to how can I add links to open xml and csv files stored in another location? Please advice how to place links in my frame maker document?
    Kindly advice.
    Thanks
    Priya

    Special > Hypertext > Command "open document" will do its best to open the target document inside FrameMaker, which may not be much help; Special > Hypertext > Command "message …" will use the application you specify. The user guide for 7.0 says this about absolute links, and I don't think anything has changed since:
    For example, to start PaintBrush and open the Ship.pcx file on drive C you would use the command message system pbrush.exe C:/Ship.pcx
    I've not often used a relative link, and not recently: the same source says
    folder levels are separated by a slash / even in Windows and Mac
    [relative links] FrameMaker searches for a relative pathname beginning in the folder that contains the current document
    [absolute links] FrameMaker searches for an absolute pathname beginning at the top of the file system. In Windows, the absolute pathname begins with the drive specifier, a colon and a slash.

  • Timestamp error with IR 9.3 and CSV Files

    Hi all, I'm new to this forum and getting used to all of the Hyperion functionalities. I'm trying to create a query that will give me the history of orders and for that I'm using CSV files as the source of information. I have date fields that when I select them returns me a formatting error: "12/18/2009 doesn't match date format: 1992-01-31 00:00:00". I assume that this is because the field format is recognized as Timestamp. Is there a way to change the field format from within Hyperion?
    Appreciate your help!

    How and where exactly did you make this modification? I moved from an old PC to a new one and my queries work great on my old PC but with my new one, I am getting this "doesn't match date format:" error. I didn't have to make any changes when I set things up on my old PC (at least not that I remember) and not sure what to do here. Any help would be greatly appreciated.

  • Outlook and CSV files on a mac book

    I have a Mc Book Pro REtina and use MS outlook 2011 version 14.3.9 as my contact data base. I need to export my contacts to a csv file so i can upload them to google so i can sync with my iphone 5

    Why do you want to delete them? They are installed for a reason. Do not ever delete, move, or rename any operating system files. Doing so could render your system non-functional.
    As for deleting files simply drag them to the Trash or right-click or CTRL-click with the mouse on a file or selection of files to bring up the contextual menu. Select the "Move to Trash" option from the contextual menu.

  • Studio Creator And CSV Files

    Does SSC support csv files as a datasource. I've been trying to use a couple of jdbc-cvs drivers with SSC I cannot appear to get them to work (J-Stels and HXTT drivers). Any help much appreciated.

    Hi,
    Please take a look at the below thread:
    http://swforum.sun.com/jive/thread.jspa?forumID=123&threadID=47345
    This thread discusses about accessing CSV files which might be of help to you.
    Thanks
    RK.

  • Xls and csv file format

    I have a xls file that I can read and modify using POI. Users are providing another file in csv format that the program should read and make adjustments to the xls already read in the memory. Can anyone suggest the most efficient way to implement this?

    Its possible but I don't see a real clean way of implementing it. There are also a lot cases to consider when doing the data merge.
    Lets say its the most simple case where the data from the csv should be appended to the excel file starting one row after the last row of data.
    For writing data to a HSSFSheet in POI you should look at the poi examples, there is a method that returns the last row num on the sheet, then from that you create new rows while incrementing the last row num for each csv record. Then for each column in the csv you need to create a new HSSFCell from the HSSFRow object in Poi, set its cell type to texta and sets its value to the csv value.
    Thats the main loop right there. As far as reading a text file as csv format so you can easily navigate it on a row by row and column by column basis I'm not sure whats out there to do that for you.
    Hope that helps! - Duncan

  • How to load csv file in oracle table

    Hi,
    i have csv files to which i want to load the csv file data and table structure in oracle. my csv files on the window machine but database is runing on ibm aix.so how to do it please any one can help me about. thanks a lot in advance
    i know th syntax below
    $sqlldr userid=username/password control=<filename> log=<log filename>

    Hello,
    Yes, with SQL*Loader you can do it.
    But first you have to create a Table into your database with columns and datatype matching
    the content of you "csv" file.
    Then, you'll have to prepare a control file and use the option fields terminated by "," as it's
    a "csv" format.
    Then, you could execute your statement.
    Please, find enclosed a link with some example about SQL*Loader and "csv" file:
    [http://www.orafaq.com/wiki/SQL*Loader_FAQ]
    Hope this help.
    Best regards,
    Jean-Valentin

  • Csv file as input?

    Hello,
    I have and csv file with voltages. Now I would like to read this CSV file with an LabView programme and send the voltages to an analog output of a DAQ Card. (Each microsecond one Voltage value)
    Is that possible?
    regards
    doctorbluex

    Read your file using "read from Spreadheed file" and wire a comma as delimiter. (Transpose if needed).
    You'll get an array that you can use for any purpose (display in a graph, send to AO, etc.). Just slice out the desired row or column.  
    LabVIEW Champion . Do more with less code and in less time .

  • Problem in uploading xls/csv file with Email address through oracle forms

    Dear all,
    I've created an interface to upload data from xls
    and csv files to database tables.
    I'm sucessed in this. Now i'm facing an issue.
    If the xls/csv file having Email address,the
    upload activity is not working..junk characters is
    getting stored.
    I came to know that, xls .csv file having email
    address with hiperlink. so this may cause the
    issue (just guessing)..
    we can't restrict users to upload email without
    hiperlink.. so what is the alternative to do
    this..
    Email address
    [email protected]
    [email protected]
    [email protected]
    etc...

    Can you give some more information:
    What versions of Forms, database, Java, browser are you using?
    How are you uploading data? Please show us your code.
    What do you mean by "email with a hyperlink"?

  • Dynamicall create csv files and zip them

    Apex version - 4.2
    I have some data in the database. I want to generate multiple csv files dynamically from those data. Then zip the csv files together to provide it to the end user.
    Can anybody suggest with the approach that could be followed.
    Thanx in advance !

    Find some code to generate the csv, for instance Export and save result set in CSV format using UTL_FILE
    Find some code to zip the files/blobs, for instance http://technology.amis.nl/2010/06/09/parsing-a-microsoft-word-docx-and-unzip-zipfiles-with-plsql/
    Combine the two pieces
    Done

  • Exporting query results into a csv file using arabic and hebrew chars

    Hi,
    iv'e encountered a problem, using plsql to export a query into a csv file.. the arabic turns into question mark. Do you have any idea why?

    Usually this indicates a mismatch between client and database character set.
    How do you export this query?
    What is your database version?
    What is your client OS?
    T.

  • Read a CSV file and dynamically generate the insert

    I have a requirement where there are multiple csv's which needs to be exported to a sql table. So far, I am able to read the csv file and generate the insert statement dynamically for selected columns however, the insert statement when passed as a parameter
    to the $cmd.CommandText
    does not evaluate the values
    How to evaluate the string in powershell
    Import-Csv -Path $FileName.FullName | % {
    # Insert statement.
    $insert = "INSERT INTO $Tablename ($ReqColumns) Values ('"
    $valCols='';
    $DataCols='';
    $lists = $ReqColumns.split(",");
    foreach($l in $lists)
    $valCols= $valCols + '$($_.'+$l+')'','''
    #Generate the values statement
    $DataCols=($DataCols+$valCols+')').replace(",')","");
    $insertStr =@("INSERT INTO $Tablename ($ReqColumns) Values ('$($DataCols))")
    #The above statement generate the following insert statement
    #INSERT INTO TMP_APPLE_EXPORT (PRODUCT_ID,QTY_SOLD,QTY_AVAILABLE) Values (' $($_.PRODUCT_ID)','$($_.QTY_SOLD)','$($_.QTY_AVAILABLE)' )
    $cmd.CommandText = $insertStr #does not evaluate the values
    #If the same statement is passed as below then it execute successfully
    #$cmd.CommandText = "INSERT INTO TMP_APL_EXPORT (PRODUCT_ID,QTY_SOLD,QTY_AVAILABLE) Values (' $($_.PRODUCT_ID)','$($_.QTY_SOLD)','$($_.QTY_AVAILABLE)' )"
    #Execute Query
    $cmd.ExecuteNonQuery() | Out-Null
    jyeragi

    Hi Jyeragi,
    To convert the data to the SQL table format, please try this function out-sql:
    out-sql Powershell function - export pipeline contents to a new SQL Server table
    If I have any misunderstanding, please let me know.
    If you have any feedback on our support, please click here.
    Best Regards,
    Anna
    TechNet Community Support

Maybe you are looking for

  • Communication problem when using Google Font api

    Hi When I try linking to the Google font api I receive a communication error in BrowserLab. The page renders OK outside of BrowserLab in my usual browser and if I remove the link then the page works in BrowserLab (but obviously doesn't include the fo

  • 30 gig video ipod music question

    Hello, I have a 30 gig music/video ipod. it has 4000 songs on it. When i plug it into the computer, i can see the ipod and all the songs, but i can't synch the songs onto my itunes music library...i can't drag them over. any ideas

  • Can I delete the PDF file's content in Adobe Reader plug-in?

    I create a plug-in for Adobe Reader, when I open the PDF file, can I delete the PDF file's content in the plug-in?

  • Error in Oracle Identity Analytics 11.1.1.5.0

    Hi All, I am getting the following error constantly.help me. 02:40:00,084 ERROR [UserApplicationScannerImpl] Fail to complete Application Scan. org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for

  • Message error when computer started

    I have an old mac book pro (2008) ; when started a message appeared : you need to restart your computer. When I do the same message comes up again and again; I can't find the re initialisation mode, can some ones helps? Thank you!