Thread:how to stored procedure stored in csv file in oracle

can any one help me out please.
db--oracle(10.2.0.4)
platform-linux(64)
we need to export data from a table into a .csv file.
please help me out.
thanks

Hello,
i have created function but as i run below :
declare
  2      l_rows    number;
  3  begin
  4      l_rows := dump_csv( 'select *
  5                             from all_users
  6                            where rownum < 5',
  7                          ',',
  8                          '/tmp',
  9                          'test.dat' );
10      dbms_output.put_line( to_char(l_rows) ||
11                            ' rows extracted to ascii file' );
12  end;
13  /
declare
ERROR at line 1:
ORA-29280: invalid directory path
ORA-06512: at "SYS.UTL_FILE", line 29
ORA-06512: at "SYS.UTL_FILE", line 448
ORA-06512: at "SYS.DUMP_CSV", line 15
ORA-06512: at line 4Error is occour
how could i resolve this.
thanks

Similar Messages

  • How to load the data from .csv file to oracle table???

    Hi,
    I am using oracle 10g , plsql developer. Can anyone help me in how to load the data from .csv file to oracle table. The table is already created with the required columns. The .csv file is having about 10lakh records. Is it possible to load 10lakh records. can any one please tell me how to proceed.
    Thanks in advance

    981145 wrote:
    Can you tell more about sql * loader??? how to know that utility is available for me or not??? I am using oracle 10g database and plsql developer???SQL*Loader is part of the Oracle client. If you have a developer installation you should normally have it on your client.
    the command is
    sqlldrType it and see if you have it installed.
    Have a look also at the FAQ link posted by Marwin.
    There are plenty of examples also on the web.
    Regards.
    Al

  • How to Migrate Stored procedure on Sql server 2008 to Oracle Database

    Guys, I need help vey badly as I am new in this field.
    Problem is that, I have to migrate stored procedure on Sql server 2008 to oracle Oracle database:
    Whole scenario--
    1. Sql Server 2008 application on Windows server (source machine)
    2. I have to migrate 70 Stored Procedure
    3. To Oracle Database on Linux machine (Target machine)
    Any method (no problem)
    Please, help me or give me any reference as I don't know which keyword is differ in both database.
    Thanks in advance

    Hi,
      You could the free Oracle SQL*Developer to do this.
    There is information and a download link here -
    Oracle SQL Developer&lt;/title&gt;&lt;meta name=&quot;Title&quot; content=&quot;Oracle SQL Developer&quot;&gt;&lt;meta n…
    and information on using it for migrations here -
    http://www.oracle.com/technetwork/database/migration/index-084442.html
    You could use it in 2 ways -
    1. Go through a migration but just pull the stored procedure code from the file created after you generate the SQL from the SQL*Server database
    2. Use the scratch editor accessed from -
    - Tools - Migration - Scratch Editor
    and paste the SQL*Server stored procedure code into the window and it will convert it to Oracle code. The tool is very good but may have problems if you have very complicated procedures that use SQL*Server specific utilities.
    Regards,
    Mike

  • Stored procedure : spool to output file

    i have to spool data from a stored proc to a csv file.I am using dbms_output.put command as i have mulitiple things to put in a row , comma delimited
    My proc looks like this
    create or replace proc xyz
    declare
    cursor c is select x y z .....
    form
    d f f f
    where ....
    variable declaration
    begin
    someting something ..
    for rec in cursor
    loop
    dbms_output.put(x1||',');
    dbms_output.put(x2||',');
    dbms_output.put(x3||',');
    dbms_output.put(x4||',');
    dbms_output.NEW_LINE;
    endloop
    This does not seem to be working ,Can you please tell me the correct way to do so .
    I need a comma delimited file at the end .

    I cannot use util_file .
    I am ussing dbms_output.put . Thats fine .
    i am spooling currently
    I want to know how I can set the SET variables that only the dbms_output.put variables are spooled to the .
    When you do spool get all the command s?.
    Currently i am doing this
    $ORACLE_HOME/bin/sqlplus -s <<EOI
    $CONNECT_STR
    WHENEVER SQLERROR EXIT FAILURE;
    SET FEED OFF TERM OFF
    SET SERVEROUTPUT ON
    SPOOL $SQL_LOG
    BEGIN
    ${PROCESS_SCHEMA_NM}.${STORED_PROC}.CONVERT_FLEX_2_TIMESHEET;
    END;
    is this correct ?

  • How can we a validate a CSV file in SSIS and log the error details in another CSV File by using Sript Task.

    How can we a  validate a CSV file in SSIS and log the error details in another CSV File by using Sript Task.

    Please see:
    http://www.bidn.com/blogs/DevinKnight/ssis/76/does-file-exist-check-in-ssis
    http://social.msdn.microsoft.com/Forums/en-US/01ce7e4b-5a33-454b-8056-d48341da5eb2/vb-script-to-write-variables-to-text-file

  • How to import data from excel or csv files to Oracle table

    hello everybody,
    I am new here and new in Oracle. I would like to know the steps how to import data from excel or csv files to Oracle table.
    Let say I already have table inside the Oracle. Then my user give me the sets of data inside the Excel Worksheet.
    So, how can I import the excel data into Oracle table.
    Thank you in advance.
    cheers,
    shima

    Even easier. Download JDeveloper 11G from this site.
    Set up the database connection, right click on the table, select Import->Excel and specify your file to load it. On the import pop-up, you must view and update each tab indicating Columns, Data Types, and DML.
    Columns -- move the selected columns that you want to load to the box on the right
    Data Types -- select column name from second column to which the data for each column of the import file should load
    DML -- click this tab to generate the INSERT SQL
    Once done click 'Insert'

  • Issue while generating a CSV file through Oracle.

    Hi,
    I am generating a CSV file using oracle stored procedure.
    In an Oracle procedure I need to create a CSV file, which contains the data of a select query, and then emailing this file. Problem is that one of the field contains comma eg ('ABC,DE'). Now in the CSV file 'ABC' is shown in the one cell and 'DE' is shifted to the adjacent cell which is not required..
    Thanks.

    Hi Welcome,
    If you data contains comma then make ~ as your delimeter.
    or repalce all the commas form your data.
    select replace(column_name,',','') from table_name; /* before writing to the file */Regards,
    Bhushan

  • Loading data from .csv file into Oracle Table

    Hi,
    I have a requirement where I need to populate data from .csv file into oracle table.
    Is there any mechanism so that i can follow the same?
    Any help will be fruitful.
    Thanks and regards

    You can use Sql Loader or External tables for your requirement
    Missed Karthick's post ...alredy there :)
    Edited by: Rajneesh Kumar on Dec 4, 2008 10:54 AM

  • How do you import data base dmp file in oracle 10g

    How do you run data base dmp file in oracle 10g

    Examples..
    Table Exports/Imports
    The TABLES parameter is used to specify the tables that are to be exported. The following is an example of the table export and import syntax:
    expdp scott/tiger@db10g tables=EMP,DEPT directory=TEST_DIR dumpfile=EMP_DEPT.dmp logfile=expdpEMP_DEPT.log
    impdp scott/tiger@db10g tables=EMP,DEPT directory=TEST_DIR dumpfile=EMP_DEPT.dmp logfile=impdpEMP_DEPT.log
    For example output files see expdpEMP_DEPT.log and impdpEMP_DEPT.log.
    The TABLE_EXISTS_ACTION=APPEND parameter allows data to be imported into existing tables.
    Schema Exports/Imports
    The OWNER parameter of exp has been replaced by the SCHEMAS parameter which is used to specify the schemas to be exported. The following is an example of the schema export and import syntax:
    expdp scott/tiger@db10g schemas=SCOTT directory=TEST_DIR dumpfile=SCOTT.dmp logfile=expdpSCOTT.log
    impdp scott/tiger@db10g schemas=SCOTT directory=TEST_DIR dumpfile=SCOTT.dmp logfile=impdpSCOTT.log
    For example output files see expdpSCOTT.log and impdpSCOTT.log.
    Database Exports/Imports
    The FULL parameter indicates that a complete database export is required. The following is an example of the full database export and import syntax:
    expdp system/password@db10g full=Y directory=TEST_DIR dumpfile=DB10G.dmp logfile=expdpDB10G.log
    impdp system/password@db10g full=Y directory=TEST_DIR dumpfile=DB10G.dmp logfile=impdpDB10G.log

  • Bulk Insert CSV file in Oracle 9i

    Greetings all,
    Is there a similar way in Oracle to the Bulk Insert Command in SQL Server to bulk load a csv file in Oracle?
    Something else then the External Table and the SQL*Loader.
    Sincerely
    Dan

    Here is an example:
    CREATE TABLE EXT_ASSC
       (     LEVEL_1 VARCHAR2(30),
         LEVEL_2 VARCHAR2(50),
         CATEGORY_CODE VARCHAR2(100),
         LEVEL_3 VARCHAR2(100)
       ORGANIZATION EXTERNAL
        ( TYPE ORACLE_LOADER
          DEFAULT DIRECTORY some_directory
          ACCESS PARAMETERS
          ( RECORDS DELIMITED BY NEWLINE
              NODISCARDFILE
              NOLOGFILE
              BADFILE 'my_bad_file.bad'
            FIELDS
              TERMINATED BY ','
              LRTRIM
              MISSING FIELD VALUES ARE NULL
          LOCATION
           ( 'some_file.csv'
       REJECT LIMIT UNLIMITED;

  • How to call a stored procedure using its package name in Oracle

    hi
    we're doing a JDBC scenario where we call a stored procedure(a.prc) using its package name(b)The stored procedure has In /Out/IN-OUT parameter.
    i have got 2 queries:
    1- How to call the stored procedure using it's package.
    2- How to capture the In/Out parameter in the response.

    hi Prateek
    thanks for the reply.
    However when i tried mapping it to Package.procedure, communication channel throws the error saying that Package.proceudre needs to be declared.
    As i said , the procedure has IN-OUT parameter too.In oracle we need to write a block if we want to read the IN-OUT parameter.
    How to get the IN-OUT parameter in XI?

  • Creating stored procedure to import csv data into tables

    I am trying to create a stored procedure to import data from a csv file into a table. I tried using sqlldr but could not run it at school due to access permissions that they will not change. So I looked at the utl_package and from what I can see it requires a "virtual" directory, which conflicts with the access permissions again at school. So can I create a stored procedure that will just read data from a csv file into a table without the need to write or create a file/directory.
    Thankyou

    Satyaki_De wrote:
    Since, you are talking about so much restriction - i don't think you will get that.
    One alternative solution can be -> write a java based pl/sql procedure and try load that by parsing it. But, for that you need execute privileges on dbms_java package.
    Do you have that? I doubt.
    Regards.
    Satyaki De.Nope not allowed to use java, and im new to oracle. Why can't a stored procedure in pl/sql just read a file and put the data into a table I create prior?

  • Stored Procedure call from JDBC sender for Oracle Database

    Hi,
    I have a requirement to call stored procedure using JDBC sender adapter for retriving data from an Oracle database.
    I need to execute first stored procedure call from Querry SQL statement and then trigger second stored procedure call for confirming the succesful retrival of those records from the update SQL statement.
    Querries:
    1. Can we trigger stored procedure from Update statement of JDBC sender.
    2. Can we call stored procedure from Querry statement, since I have read on other sdn threads that stored procedure calls on Oracle database are not allowed. If not possible to have "Execute stored procedure" would the function call (select * from table(function name)) work same as stored procedure.
    3. In a JDBC sender the Querry statement and Update statement are executed in same session call and same database connection. What happens if the querry statement was not succesful, would the update be still triggered.
    Please note PI does not have direct access to main table and hence the need to have separate stored procedure calls.
    The PI version is PI 7.11 sp4.
    Appreciate your inputs.
    Thanks.
    Siddhesh S.Tawate

    >1. Can we trigger stored procedure from Update statement of JDBC sender.
    I think not possible using update statement.
    > Can we call stored procedure from Querry statement, since I have read on other sdn threads that stored procedure calls on Oracle database are not allowed. If not possible to have "Execute stored procedure" would the function call (select * from table(function name)) work same as stored procedure.
    Yes using select query you can call stored procedure.
    >. In a JDBC sender the Querry statement and Update statement are executed in same session call and same database connection. What happens if the querry statement was not succesful, would the update be still triggered.
    No select and update handles in the same session using the same thread so if one transaction fails update should not proceed.

  • Java Stored Procedure with LOB as input parameter (oracle 9i 9.2.0.6)

    Hi,
    Is there a way to pass CLOB as input and output as part of java stored proceudre in oracle 9i (9.2.0.6)?
    I have to perform some data conversion on the CLOB data in java program and return the converted CLOB as output.
    --Ramesh Lokineni                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    The reason why I want to use java for conversion is because, I want to perform base64 encoding decoding on the content stored in CLOB column. I tried to use by chunking the data into smaller pieces and apply the base64 encoding, but when I decode the CLOB using base64, I am not getting the same data. Later when I read about how base64 encoding happens I realized chunking the data in CLOB doesn't work. That's when I started to diggin how I can pass CLOB to java stored procedures.

  • Stored Procedures with Date data types and Oracle

    This should be easy.... But i keep getting the error:
    [Macromedia][Oracle JDBC Driver][Oracle]ORA-06550: line 1,
    column 7: PLS-00306: wrong number or types of arguments in call to
    'RETRIEVE_TS' ORA-06550: line 1, column 7: PL/SQL: Statement
    ignored
    And I got it worked out to where i know it is a problem with
    the way i am using the date data types in a stored procedure....
    In the past i usually avoided calling procedures in Oracle
    with date as the in type.... It is always easiest to let oracle
    convert the string to a date.... Unfortunately now i am stuck with
    having a date type in the procedure call.... So the question is:
    WHAT IS THE PROPER WAY TO SUBMIT DATE/TIME STAMP IN A STORED
    PROCEDURE?
    The Oracle Procedure looks like this:
    PROCEDURE retrieve_ts (
    p_at_tsv_rc IN OUT sys_refcursor,
    p_units IN OUT VARCHAR2,
    p_officeid IN VARCHAR2,
    p_timeseries_desc IN VARCHAR2,
    p_start_time IN DATE,
    p_end_time IN DATE,
    p_timezone IN VARCHAR2 DEFAULT 'GMT',
    p_trim IN NUMBER DEFAULT false_num,
    p_inclusive IN NUMBER DEFAULT NULL,
    p_versiondate IN DATE DEFAULT NULL,
    p_max_version IN NUMBER DEFAULT true_num
    AND the stored procedure call looks like this:
    <cfset ed = Now()>
    <cfset sd = #DateAdd("d",-lbt,Now())#>
    <cfstoredproc datasource="CWMS"
    procedure="cwms.cwms_ts.retrieve_ts"
    returncode="no">
    <cfprocparam type="inout" variable="unit" value="#unit#"
    dbvarname="@p_units"
    cfsqltype="cf_sql_varchar">
    <cfprocparam type="in" value="MVS"
    dbvarname="@p_officeid"
    cfsqltype="cf_sql_varchar">
    <cfprocparam type="in" value=#id.cwms_ts_id#
    dbvarname="@p_timeseries_desc"
    cfsqltype="cf_sql_varchar">
    <cfprocparam type="in" value="#sd#"
    dbvarname="@p_start_time"
    cfsqltype="cf_sql_date">
    <cfprocparam type="in" value="#ed#"
    dbvarname="@p_end_time"
    cfsqltype="cf_sql_date">
    <cfprocparam type="in" value="#tz#"
    dbvarname="@p_time_zone"
    cfsqltype="cf_sql_varchar">
    <cfprocparam type="in" value="0"
    dbvarname="@p_trim"
    cfsqltype="cf_sql_numeric">
    <cfprocparam type="in" value=""
    null = "yes"
    dbvarname="@p_inclusive"
    cfsqltype="cf_sql_numeric">
    <cfprocparam type="in" value=""
    null="yes"
    dbvarname="@p_versiondate"
    cfsqltype="cf_sql_date">
    <cfprocparam type="in" value="1"
    dbvarname="@p_max_version"
    cfsqltype="cf_sql_numeric">
    <cfprocresult name="ts_dat">
    </cfstoredproc>
    Text

    Yeah.... One is a type INOUT ref cursor.... which is denoted
    by the cfprocresult....
    By the way:
    Phil - the code example with a little tweaking worked fine on
    my machine....
    <<cfstoredproc procedure="test_pkg.test"
    datasource="myDSN" returncode="no">
    <cfprocparam type="IN" cfsqltype="cf_sql_timestamp"
    value="15-JUN-2005">
    <cfprocparam type="OUT" cfsqltype="cf_sql_varchar"
    variable="v_out">
    <cfprocresult name="rs1">
    </cfstoredproc>
    PROCEDURE test(
    v3_out OUT ref_cur_type,
    v1_in IN date default null,
    v2_out OUT varchar2
    IS
    BEGIN
    v2_out := TO_CHAR(v1_in, 'mm/dd/yyyy');
    OPEN v3_out
    FOR
    SELECT *
    FROM user
    WHERE activation_date >= v1_in;
    END test;
    Why do i still get this error......
    Here is what it looks like now:
    PROCEDURE retrieve_ts (
    p_at_tsv_rc IN OUT sys_refcursor,
    p_units IN OUT VARCHAR2,
    p_officeid IN VARCHAR2,
    p_timeseries_desc IN VARCHAR2,
    p_start_time IN DATE,
    p_end_time IN DATE,
    p_timezone IN VARCHAR2 DEFAULT 'GMT',
    p_trim IN NUMBER DEFAULT false_num,
    p_inclusive IN NUMBER DEFAULT NULL,
    p_versiondate IN DATE DEFAULT NULL,
    p_max_version IN NUMBER DEFAULT true_num
    <cfstoredproc datasource="CWMS"
    procedure="cwms.cwms_ts.retrieve_ts"
    returncode="no">
    <cfprocparam type="INOUT" variable="p_units"
    value="#unit#" <!---p_units--->
    cfsqltype="cf_sql_varchar">
    <cfprocparam type="IN" value="MVS"
    <!---p_officeid--->
    cfsqltype="cf_sql_varchar">
    <cfprocparam type="IN" value=#id.cwms_ts_id#
    <!---p_timeseries_desc--->
    cfsqltype="cf_sql_varchar">
    <cfprocparam type="IN" value="#sd#"
    <!---p_start_time--->
    cfsqltype="cf_sql_timestamp">
    <cfprocparam type="IN" value="#ed#"
    <!---p_end_time--->
    cfsqltype="cf_sql_timestamp">
    <cfprocparam type="IN" value="#tz#"
    <!---p_timezone--->
    cfsqltype="cf_sql_varchar">
    <cfprocparam type="IN" value="0" <!---p_trim--->
    cfsqltype="cf_sql_integer">
    <cfprocparam type="IN" value=""
    <!---p_inclusive--->
    null = "yes"
    cfsqltype="cf_sql_numeric">
    <cfprocparam type="IN" value=""
    <!---p_versiondate--->
    null="yes"
    cfsqltype="cf_sql_timestamp">
    <cfprocparam type="IN" value="1"
    <!---p_max_version--->
    cfsqltype="cf_sql_integer">
    <cfprocresult name="ts_dat">
    <!---sys_refcursor--->
    </cfstoredproc>
    If I truly am short a parameter, How do you specify the INOUT
    sys_refcursor?

Maybe you are looking for

  • HP Pavilion dv-4087CL Notebook receiving : Boot Device Not Found-Please install an operating system

    My Duaghter is out of the country studing abroad.  Her PC would no longer boot up so she took it to a support shop. They replaced her hard drive, fixed an over heating issue and reloaded her PC.  Now she is getting this new error message and she is d

  • Many problems with Vista and Itunes--slowing and crashing

    Okay, so itunes has never worked right on my computer. I have a Comaq Persario V6000 with the Centrino duo. These are some of the problems I have with Itunes: 1. will not play initially on start up. I need to close itunes, open it again and then some

  • Defining BI Power User Role and Authorizations

    We are looking for information/best practices/guidelines pertaining to defining BI Power Users and the appropriate authorizations to attach to this role.  Our Power Users are asking for approval to access several transactions within BI, specifically

  • How to track Hyperion Business Rules

    Hi Which log can we look into to track which HBR'S were created/deleted by users along with timestamp? Env:11.1.2.1 ,WIN2K8 64 bit Thanks, Manoj

  • Need help in getting access with phone Addressbook

    Hi, I am developing a application that desires to get access with the existing phone address book. Q1) I found that JSR 75 will help.I think i am in right way. plz help me by giving an example?? Q2) Does All MIDP2.0 enabled phones supports JSR 75?? H