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?

Similar Messages

  • I'm getting a 'The Management Pack element is not declared' error when trying to import CSV data into my *extended* WindowsComputer class

    Background:
    I have a class called SUS_WindowsComputerMP, that is an extension of the Microsoft class, Microsoft.Windows.Computer
    I'm trying to import CSV data into this extended class and to the base class as well.
    Question:
    What am I doing wrong? I have a feeling that the Import CSV Format file is different for importing data into *extended* classes like mine, because the XML structure below would work for non-extended classes.
    "...Creating new CSVImporter
    Data Filename: D:\Peter\CMDB II\Exported MPs\TestMPs\SUS_WindowsComputer.csv
    Format Filename: D:\Peter\CMDB II\Exported MPs\SUS_WindowsComputerMP.xml
    Validating against XSD schema...
    The 'ManagementPack' element is not declared.
    Validation completed.
    Format file D:\Peter\CMDB II\Exported MPs\SUS_WindowsComputerMP.xml contains an invalid root element. Expected: root node with name \"CSVImportFormat\"
    Could not initialize a Management Object Creator from format file D:\Peter\CMDB II\Exported MPs\SUS_WindowsComputerMP.xml. Import thread exiting.
    My import format XML is this:
    <CSVImportFormat>
    <Class Type="ClassExtension_a3ae3e0f_d578_43dc_aa3e_9037a094763c" >
    <Property ID="WindowsServerID" />
    <Property ID="PrincipalName" />
    <Property ID="NetbiosComputerName" />
    <Property ID="IPAddress" />
    <Property ID="NetbiosDomainName" />
    <Property ID="DNSName" />
    <Property ID="OSVersionDisplayName" />
    <Property ID="SerialNo" />
    <Property ID="ServerDescription" />
    <Property ID="AssetTagNo" />
    <Property ID="ServerNameRow" />
    <Property ID="ChassisType" />
    <Property ID="InstallDate" />
    <Property ID="IsVirtualMachine" />
    <Property ID="BusinessUnitCustomersEnum" />
    <Property ID="RegionLocationEnum" />
    <Property ID="OtherFunctionRoleEnum" />
    <Property ID="ProductTypeEnum" />
    <Property ID="ObjectStatus" />
    <Property ID="AssetStatus" />
    <Property ID="CriticalityEnum" />
    <Property ID="EnvironmentEnum" />
    <Property ID="CostCodeClassEnum" />
    <Property ID="DataClassificationEnum" />
    <Property ID="Manufacturer" />
    </Class>
    </CSVImportFormat>

    Hello,
    Can anyone please help me out with this weird issue.
    thanks,
    orton

  • How to import csv data into Oracle using c#

    Hello,
    How to import csv data into Oracle using c #. Where data to be imported 3GB in size and number of rows 7512263. I've managed to import csv data into Oracle, but the time it takes about 1 hour. How to speed up the time it takes to import csv data into oracle. Thank you.
    This is my code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Diagnostics;
    using System.Threading;
    using System.Text.RegularExpressions;
    using System.IO;
    using FileHelpers;
    using System.Data.OracleClient;
    namespace sqlloader
    class Program
    static void Main(string[] args)
    int jum;
    int i;
    bool isFirstLine = false;
    FileHelperEngine engine = new FileHelperEngine(typeof(XL_XDR));
    //Connect To Database
    string constr = "Data Source=(DESCRIPTION=(ADDRESS_LIST="
    + "(ADDRESS=(PROTOCOL=TCP)(HOST= pt-9a84825594af )(PORT=1521 )))"
    + "(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=o11g)));"
    + "User Id=xl;Password=rahasia;";
    OracleConnection con = new OracleConnection(constr);
    con.Open();
    // To Read Use:
    XL_XDR[] res = engine.ReadFile("DataOut.csv") as XL_XDR[];
    jum = CountLinesInFile("DataOut.csv");
    FileInfo f2 = new FileInfo("DataOut.csv");
    long s2 = f2.Length;
    int jmlRecord = jum - 1;
    for (i = 0; i < jum; i++)
    ShowPercentProgress("Processing...", i, jum);
    Thread.Sleep(100);
    if (isFirstLine == false)
    isFirstLine = true;
    else
    string sql = "INSERT INTO XL_XDR (XDR_ID, XDR_TYPE, SESSION_START_TIME, SESSION_END_TIME, SESSION_LAST_UPDATE_TIME, " +
    "SESSION_FLAG, VERSION, CONNECTION_ROW_COUNT, ERROR_CODE, METHOD, HOST_LEN, HOST, URL_LEN, URL, CONNECTION_START_TIME, " +
    "CONNECTION_LAST_UPDATE_TIME, CONNECTION_FLAG, CONNECTION_ID, TOTAL_EVENT_COUNT, TUNNEL_PAIR_ID, RESPONSIVENESS_TYPE, " +
    "CLIENT_PORT, PAYLOAD_TYPE, VIRTUAL_TYPE, VID_CLIENT, VID_SERVER, CLIENT_ADDR, SERVER_ADDR, CLIENT_TUNNEL_ADDR, " +
    "SERVER_TUNNEL_ADDR, ERROR_CODE_2, IPID, C2S_PKTS, C2S_OCTETS, S2C_PKTS, S2C_OCTETS, NUM_SUCC_TRANS, CONNECT_TIME, " +
    "TOTAL_RESP, TIMEOUTS, RETRIES, RAI, TCP_SYNS, TCP_SYN_ACKS, TCP_SYN_RESETS, TCP_SYN_FINS, EVENT_TYPE, FLAGS, TIME_STAMP, " +
    "EVENT_ID, EVENT_CODE) VALUES (" +
    "'" + res.XDR_ID + "', '" + res[i].XDR_TYPE + "', '" + res[i].SESSION_START_TIME + "', '" + res[i].SESSION_END_TIME + "', " +
    "'" + res[i].SESSION_LAST_UPDATE_TIME + "', '" + res[i].SESSION_FLAG + "', '" + res[i].VERSION + "', '" + res[i].CONNECTION_ROW_COUNT + "', " +
    "'" + res[i].ERROR_CODE + "', '" + res[i].METHOD + "', '" + res[i].HOST_LEN + "', '" + res[i].HOST + "', " +
    "'" + res[i].URL_LEN + "', '" + res[i].URL + "', '" + res[i].CONNECTION_START_TIME + "', '" + res[i].CONNECTION_LAST_UPDATE_TIME + "', " +
    "'" + res[i].CONNECTION_FLAG + "', '" + res[i].CONNECTION_ID + "', '" + res[i].TOTAL_EVENT_COUNT + "', '" + res[i].TUNNEL_PAIR_ID + "', " +
    "'" + res[i].RESPONSIVENESS_TYPE + "', '" + res[i].CLIENT_PORT + "', '" + res[i].PAYLOAD_TYPE + "', '" + res[i].VIRTUAL_TYPE + "', " +
    "'" + res[i].VID_CLIENT + "', '" + res[i].VID_SERVER + "', '" + res[i].CLIENT_ADDR + "', '" + res[i].SERVER_ADDR + "', " +
    "'" + res[i].CLIENT_TUNNEL_ADDR + "', '" + res[i].SERVER_TUNNEL_ADDR + "', '" + res[i].ERROR_CODE_2 + "', '" + res[i].IPID + "', " +
    "'" + res[i].C2S_PKTS + "', '" + res[i].C2S_OCTETS + "', '" + res[i].S2C_PKTS + "', '" + res[i].S2C_OCTETS + "', " +
    "'" + res[i].NUM_SUCC_TRANS + "', '" + res[i].CONNECT_TIME + "', '" + res[i].TOTAL_RESP + "', '" + res[i].TIMEOUTS + "', " +
    "'" + res[i].RETRIES + "', '" + res[i].RAI + "', '" + res[i].TCP_SYNS + "', '" + res[i].TCP_SYN_ACKS + "', " +
    "'" + res[i].TCP_SYN_RESETS + "', '" + res[i].TCP_SYN_FINS + "', '" + res[i].EVENT_TYPE + "', '" + res[i].FLAGS + "', " +
    "'" + res[i].TIME_STAMP + "', '" + res[i].EVENT_ID + "', '" + res[i].EVENT_CODE + "')";
    OracleCommand command = new OracleCommand(sql, con);
    command.ExecuteNonQuery();
    Console.WriteLine("Successfully Inserted");
    Console.WriteLine();
    Console.WriteLine("Number of Row Data: " + jmlRecord.ToString());
    Console.WriteLine();
    Console.WriteLine("The size of {0} is {1} bytes.", f2.Name, f2.Length);
    con.Close();
    static void ShowPercentProgress(string message, int currElementIndex, int totalElementCount)
    if (currElementIndex < 0 || currElementIndex >= totalElementCount)
    throw new InvalidOperationException("currElement out of range");
    int percent = (100 * (currElementIndex + 1)) / totalElementCount;
    Console.Write("\r{0}{1}% complete", message, percent);
    if (currElementIndex == totalElementCount - 1)
    Console.WriteLine(Environment.NewLine);
    static int CountLinesInFile(string f)
    int count = 0;
    using (StreamReader r = new StreamReader(f))
    string line;
    while ((line = r.ReadLine()) != null)
    count++;
    return count;
    [DelimitedRecord(",")]
    public class XL_XDR
    public string XDR_ID;
    public string XDR_TYPE;
    public string SESSION_START_TIME;
    public string SESSION_END_TIME;
    public string SESSION_LAST_UPDATE_TIME;
    public string SESSION_FLAG;
    public string VERSION;
    public string CONNECTION_ROW_COUNT;
    public string ERROR_CODE;
    public string METHOD;
    public string HOST_LEN;
    public string HOST;
    public string URL_LEN;
    public string URL;
    public string CONNECTION_START_TIME;
    public string CONNECTION_LAST_UPDATE_TIME;
    public string CONNECTION_FLAG;
    public string CONNECTION_ID;
    public string TOTAL_EVENT_COUNT;
    public string TUNNEL_PAIR_ID;
    public string RESPONSIVENESS_TYPE;
    public string CLIENT_PORT;
    public string PAYLOAD_TYPE;
    public string VIRTUAL_TYPE;
    public string VID_CLIENT;
    public string VID_SERVER;
    public string CLIENT_ADDR;
    public string SERVER_ADDR;
    public string CLIENT_TUNNEL_ADDR;
    public string SERVER_TUNNEL_ADDR;
    public string ERROR_CODE_2;
    public string IPID;
    public string C2S_PKTS;
    public string C2S_OCTETS;
    public string S2C_PKTS;
    public string S2C_OCTETS;
    public string NUM_SUCC_TRANS;
    public string CONNECT_TIME;
    public string TOTAL_RESP;
    public string TIMEOUTS;
    public string RETRIES;
    public string RAI;
    public string TCP_SYNS;
    public string TCP_SYN_ACKS;
    public string TCP_SYN_RESETS;
    public string TCP_SYN_FINS;
    public string EVENT_TYPE;
    public string FLAGS;
    public string TIME_STAMP;
    public string EVENT_ID;
    public string EVENT_CODE;
    I hope someone can give me a solution. Thanks

    The fastest way is to use external tables or sql loader (sqlldr). (If you use external tables or sql loader, you don't use C# at all).

  • Ability to Import Spreadsheet Data into Table in Apps added Anytime Soon??

    I love HTMLDB so much, and I thought I would never find anything it couldn't do, but I have run headlong into a problem that I've discovered many users have.
    The Import Spreadsheet Data into Table functionality available in Data Workshop is such a treasure, and I was hoping with all of my heart that such functionality would be available for use inside the User Applications in HTMLDB 2.0. Alas, it is not so.
    I know some brave folks have come up with work-arounds for this lack, and I applaud them. However, none of those will work for the situation I am faced with. I am about to strike out into the no-man's-land of trying to create my own PL/SQL csv file parsing function. Please wish me luck. Also, could you please tell me if this functionality is going to be included anytime soon?

    Well I looked at the FLOWS_020000.WWV_FLOW_LOAD_DATA.LOAD_CSV_DATA procedure
    From what I can gather(considering nobody cant look at the actual procedural code):
    P_FILE_ID seems to be file id you find in FLOWS_FILES.WWV_FLOW_FILE_OBJECTS$
    P_CNAMES seems to be the column names of table you are loading into
    P_UPLOAD seems to be the names of field from file you are loading
    P_SCHEMA seems to be the schema that contains table where data will be loaded
    P_TABLE seems to be table that you load data into
    P_DATA_TYPE seems to be the datatypes from file to be loaded
    P_DATA_FORMAT not sure
    P_PARSED_DATA_FORMAT not sure
    P_SEPARATOR seems to be the field seperator from file
    P_ENCLOSED_BY seems to be what fields will be enclosed with
    P_FIRST_ROW_IS_COL_NAME seems to be to tell whether or not first row contains column headings
    P_LOAD_TO not sure
    P_CURRENCY seems to be the currency symbol that comes from file
    P_NUMERIC_CHARS not sure
    P_CHARSET not sure
    P_LOAD_ID not sure
    Essentially you could run this process provided you get all the kinks worked out(that is what all the parameters mean/are expected)...
    ...or..
    you write your own process:
    - that reads the blob/clob content line by line
    declare
    n number;
    buffer varchar2(4000);
    begin
    (do some sort of loop until end of length of lob)
    n := dbms_lob.instr( "your lob", ',',"next comma position" );
    if ( nvl(n,0) > 0 )
    then
    buffer := dbms_lob.read( p_lob, "amount of lob length to read", n);
    end if;
    end;
    The above code with some tweaking will read the lob. However you still will have to add a piece that creates sql insert statement. One of the pitfalls I see with custom code is the fact that if you end up with huge lob string you will run into problem of creating sql insert statement. Not the actual statement but assigning the statement to a variable due to datatype lengths.
    Hopefully this will help you more in the right direction!

  • Writing a stored procedure to import SQL Server table data into a Oracle table

    Hello,
    As a new DBA I have been tasked with writing a stored procedure to import SQL Server table data into an Oracle table. I have been given many suggestions on how to do it from SQL Server but I I just need to write a stored procedure to run it from the Oracle side. Suggestions/guidance on where to start would be greatly appreciated! Thank you!
    I started to write it based on what I have but I know this is not correct :/
    # Here is the select statement for the data source in SQL Server...
    SELECT COMPANY
    ,CUSTOMER
    ,TRANS_TYPE
    ,INVOICE
    ,TRANS_DATE
    ,STATUS
    ,TRAN_AMT
    ,CREDIT_AMT
    ,APPLD_AMT
    ,ADJ_AMT
    ,TRANS_USER1
    ,PROCESS_LEVEL
    ,DESCRIPTION
    ,DUE_DATE
    ,OUR_DATE
    ,OUR_TIME
    ,PROCESS_FLAG
    ,ERROR_DESCRIPTION
      FROM data_source_table_name
    #It loads data into the table in Oracle....   
    Insert into oracle_destination_table_name (
    COMPANY,
    CUSTOMER,
    TRANS_TYPE,
    INVOICE,
    TRANS_DATE,
    STATUS,
    TRANS_AMT,
    CREDIT_AMT,
    APPLD_AMT,
    ADJ_AMT,
    TRANS_USER1,
    PROCESS_LEVEL,
    DESCRIPTION,
    DUE_DATE,
    OUR_DATE,
    OUR_TIME,
    PROCESS_FLAG,
    ERROR_DESCRIPTION)
    END;

    CREATE TABLE statements would have been better as MS-SQL and Oracle don't have the same data types.
    OUR_DATE, OUR_TIME will (most likely) be ONE column in Oracle.
    DATABASE LINK
    Personally, I'd just load the data over a database link:
    insert into oracle_destination_table_name ( <column list> )
    select ... <transform data here>
    from data_source_table@mssql_db_link
    As far as creating the database link from Oracle to MS-SQL ... that is for somebody else to answer.
    (most likely you'll need to use an ODBC driver)
    EXTERNAL TABLE
    If the data from MS-SQL is in a CSV file, just use and external table.
    same concept:
    insert into oracle_destination_table_name ( <column list> )
    select ... <transform data here>
    from data_source_external_table
    MK

  • HOW TO CREATE STORED PROCEDURE IN DATA INTEGRATOR

    Hi to every one,
    Can any one help in giving me a solution for creating stored procedure in Data Integrator.
    I m new to this field

    Hi nath,
    Firstly are you using MYSQL or Oracle as the database,if its oracle database then follow this
    http://obiee101.blogspot.com/2008/01/obiee-using-oracle-stored-procedure-to.html
    http://oraclebizint.wordpress.com/2008/02/20/oracle-bi-ee-101332-executing-stored-proceduresfunctions-before-reports-before-report-triggers-and-global-temporary-tables/
    EXEC [DATABASE_NAME].[SCHEMA_NAME].[PROCEDURE_NAME][DATABASE_NAME] --> is the database name your creating your procedure
    [SCHEMA_NAME]-->is the user with which your creating
    [PROCEDURE_NAME] --> the name given to procedure
    You dont know how to get those run this SQL in TOAD and see select sys_context('userenv','db_name'), sys_context('userenv','session_user') from dual
    (OR) open you connection pool properties window in RPD,you will get the DB name and the user name as the schema name
    hope answered your question.
    CHeers,
    KK

  • Creating Stored Procedure in Java

    Hi All,
    I would like to ask how to create a stored procedure in Java.
    My project now is to create a program that will open a DB2 SQL File (Creating Table and Stored Procedure) and then Execute it.
    Executing the CREATE TABLE command is not that difficult since I can break the execution down by statement (divide by ";" in the SQL file).
    The logic I applied here are:
    1. Open the SQL file and store the contents into a String object.
    2. Call the executeUpdate(string_sql_fileContent) method of Statement Object.
    Example: SQL File contect to be executed.
    ===========================================================
    CREATE TABLE MDMTEST.sample
    (firstname CHARACTER(40),
    middlename CHARACTER(40),
    lastname CHARACTER(40),
    idNo SMALLINT NOT NULL
    DATA CAPTURE NONE;
    #SYNC 10;
    ALTER TABLE MDMTEST.sample
    LOCKSIZE ROW
    APPEND OFF
    NOT VOLATILE;
    #SYNC 20;
    ALTER TABLE MDMTEST.sample
    ADD PRIMARY KEY
    (idNo
    #SYNC 30;
    RUNSTATS ON TABLE MDMTEST.sample
    AND INDEXES ALL
    SHRLEVEL REFERENCE;
    ===========================================================
    I can divide this by ";" and execute them by statement.
    But my problem is when creating Stored Procedure... Since in stored procedure there are so many stub-statements...
    Example: Content of SQL File for creating stored procedure.
    ===========================================================
    CREATE PROCEDURE MDMTEST.DROP_ALL_OBJECTS ( )
    SPECIFIC MDMTEST.SQL051109115453000
    LANGUAGE SQL
    NOT DETERMINISTIC
    CALLED ON NULL INPUT
    MODIFIES SQL DATA
    INHERIT SPECIAL REGISTERS
    BEGIN
         Delete Statement;
         Insert Statement;
         Update Statement;
    END;
    ===========================================================
    Take note there are three statements inside the CREATE..BEGIN.. and END.. (namely Delete, Insert, and Update Statements).
    How can I execute the command for creating the procedure in Java? I believe that creating stored procedures in other databases are almost the same...
    So... anyboby who have tried creating stored procedure in Java?
    Please help me in this... I wanna pass the subject hehe..

    I have used these files as a sample:
    Java Program:
    import java.io.*;
    import java.sql.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import my.db.components.*;
    public class ProcedureUploader {
         private MyDBConnection dbConn=new MyDBConnection();
         private Statement statement;
    public ProcedureUploader() {
         try{
              dbConn.connectDB ("206.206.206.206","12345","DEV","mdmtest","mdmtest");     
              this.statement=dbConn.getStatement ();               
         }catch(SQLException sqle){
              sqle.printStackTrace();
         public String getContents(String fileName) throws IOException{
              File inputFile = new File(fileName);
    FileReader in = new FileReader(inputFile);
    int c; String contents="";
    while ((c = in.read()) != -1) contents+=(char) c;
    in.close();
    return contents;
    public void executeSQLCommand(String file) throws IOException{         
         String command="";
         try{
              command=getContents(file);          
                   statement.executeUpdate(command);
              System.out.println("Command Execution Successful.");     
         }catch(Exception ex){
              System.out.println("There is a problem executing the command. Please check the SQL file and re-execute again.");
              ex.printStackTrace();
    public static void main(String args[]) throws IOException{
         ProcedureUploader uploader=new ProcedureUploader();
         uploader.executeSQLCommand("C:\\I2\\Development\\ProcedureUploader\\sample.sql");
    SQL File:
    CREATE PROCEDURE MDMTEST.sampleProc ( )
    SPECIFIC MDMTEST.sampleProc
    LANGUAGE SQL
    NOT DETERMINISTIC
    CALLED ON NULL INPUT
    MODIFIES SQL DATA
    INHERIT SPECIAL REGISTERS
    delete from SAMPLE;
    commit;
    select * from SAMPLE;;
    #SYNC 10;
    ===========================================================
    The problem is that ... there will be an error:
    ===========================================================
    There is a problem executing the command. Please check the SQL file and re-execute again.
    com.ibm.db2.jcc.c.SqlException: DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC: delete from SAMPLE;;PECIAL REGISTERS
    ;<psm_repeat>
    at com.ibm.db2.jcc.c.fg.e(fg.java:1596)
    at com.ibm.db2.jcc.c.fg.b(fg.java:1160)
    at com.ibm.db2.jcc.b.gb.h(gb.java:217)
    at com.ibm.db2.jcc.b.gb.b(gb.java:46)
    at com.ibm.db2.jcc.b.w.b(w.java:40)
    at com.ibm.db2.jcc.b.vb.f(vb.java:118)
    at com.ibm.db2.jcc.c.fg.m(fg.java:1155)
    at com.ibm.db2.jcc.c.fg.a(fg.java:1865)
    at com.ibm.db2.jcc.c.fg.c(fg.java:517)
    at com.ibm.db2.jcc.c.fg.executeUpdate(fg.java:501)
    at ProcedureUploader.executeSQLCommand(ProcedureUploader.java:44)
    at ProcedureUploader.main(ProcedureUploader.java:54)
    ===========================================================
    But still the procedure will be created but until the first ";" only... OR.. creates a stored procedure having the following lines only.
    ===========================================================
    CREATE PROCEDURE MDMTEST.sampleProc ( )
    SPECIFIC MDMTEST.sampleProc
    LANGUAGE SQL
    NOT DETERMINISTIC
    CALLED ON NULL INPUT
    MODIFIES SQL DATA
    INHERIT SPECIAL REGISTERS
    delete from SAMPLE;
    ===========================================================

  • Usage of sequence for uploading data into tables(column store) using CSV

    How to make use of sequence when data is uploaded into table(column store) with the CSV file ?

    Hi Sharada,
    You may have to follow the below steps:
    1) To load the data from flat file to a Staging table using IMPORT command
    2) You have to call the procedure to load the data further into final Table.
    a) Have a look on this procedure to load data :
    SAP HANA: Generic Procedure using Arrays to Load delta data into Tables
    b) See my reply on the syntax on how to use "Sequence"
    Auto-Incrementor in stored procedure!
    You will have to ensure that you frame your insert query in such a way to have the sequence number in the target table.
    Regards,
    Krishna Tangudu

  • How can i create stored procedures dynamically?

    I have tried to create a stored procedure building a string with the PL/SQL code needed to create the procedure. If i run the code using SQL+ works fine, but using the following code:
    Public Sub CreateStoredProcedure()
    Dim strSql As String
    strSql = "CREATE OR REPLACE PACKAGE OPSPRUEBAS AS " & vbCrLf
    strSql = strSql & vbTab & "PROCEDURE consulta (resultado OUT VARCHAR2); " & vbCrLf
    strSql = strSql & "END OPSPRUEBAS; " & vbCrLf
    strSql = strSql & "/ " & vbCrLf
    strSql = strSql & ". " & vbCrLf
    strSql = strSql & "CREATE OR REPLACE PACKAGE BODY OPSPRUEBAS AS " & vbCrLf
    strSql = strSql & "PROCEDURE consulta (resultado OUT VARCHAR2) IS " & vbCrLf
    strSql = strSql & "oc_ref" & vbTab & vbTab & "REF Content_Ontology; " & vbCrLf
    strSql = strSql & "oc" & vbTab & vbTab & "Content_Ontology; " & vbCrLf
    strSql = strSql & "ori" & vbTab & vbTab & "role_def; " & vbCrLf
    strSql = strSql & "ori_ref" & vbTab & vbTab & "ref role_def; " & vbCrLf
    strSql = strSql & "conce" & vbTab & vbTab & "concept; " & vbCrLf
    strSql = strSql & "conce_ref" & vbTab & "REF concept; " & vbCrLf
    strSql = strSql & "b" & vbTab & vbTab & "boolean; " & vbCrLf
    strSql = strSql & "BEGIN " & vbCrLf
    strSql = strSql & "b:=false; " & vbCrLf
    strSql = strSql & "select REF(oi) into ori_ref from rol_table oi where oi.name='Playing'; " & vbCrLf
    strSql = strSql & "select deref(ori_ref) into ori from dual; " & vbCrLf
    strSql = strSql & "select REF(oi) into oc_ref from c_ontologies oi where oi.web_source_prop=websource('FilmContentOntology'); " & vbCrLf
    strSql = strSql & "select deref(oc_ref) into oc from dual; " & vbCrLf
    strSql = strSql & "if oc.if_has_co_class('Film')='TRUE' AND " & vbCrLf
    strSql = strSql & "oc.if_has_co_class('theater')='TRUE' AND " & vbCrLf
    strSql = strSql & "oc.if_has_co_relationship('is_scheduled')='TRUE' AND " & vbCrLf
    strSql = strSql & "oc.if_has_co_attributes('Film', lista('is_scheduled', 'title', 'actor'))='TRUE' AND " & vbCrLf
    strSql = strSql & "oc.if_has_co_attributes('theater', lista('theatername', 'address', 'email'))='TRUE' " & vbCrLf
    strSql = strSql & "then resultado:='FilmContentOntology'; " & vbCrLf
    strSql = strSql & "else resultado:='No Existe'; " & vbCrLf
    strSql = strSql & "end if; " & vbCrLf
    strSql = strSql & "END consulta; " & vbCrLf
    strSql = strSql & "END OPSPRUEBAS; " & vbCrLf
    strSql = strSql & "/ " & vbCrLf
    strSql = strSql & ". " & vbCrLf
    strSql = strSql & "COMMIT;" & vbCrLf
    TextBox2.Text = strSql
    'Dim myConnectionString As String = "User Id=system;Password=daniel;Data Source=websogo;"
    'Dim oraConn As Oracle.DataAccess.Client.OracleConnection = New Oracle.DataAccess.Client.OracleConnection(myConnectionString)
    Dim myCmd As New System.Data.OleDb.OleDbCommand()
    Dim MyConnection As New System.Data.OleDb.OleDbConnection()
    MyConnection.ConnectionString = "Provider=MSDAORA;Data Source=websogo;password=daniel;User ID=system"
    MyConnection.Open()
    'oraConn.Open()
    myCmd.Connection = MyConnection
    myCmd.CommandType = CommandType.Text
    myCmd.CommandText = strSql
    myCmd.ExecuteNonQuery()
    'Dim e As Oracle.DataAccess.Client.OracleException
    'Try
    ' myCmd.ExecuteNonQuery()
    'Catch e
    ' Dim error1 As Oracle.DataAccess.Client.OracleError
    ' error1 = e.Errors.Item(0)
    ' Textbox3.Text = error1.Source & " " & error1.Message
    'End Try
    MyConnection.Close()
    End Sub
    I've tried using Microsoft ODP, OLEDB and Oracle's ODP.NET
    Also tried to catch any error but there are no errors!
    Has anybody achived a successful dynamically stored procedure creation using .net?
    thanks in advance
    Dan

    I'm trying to create Stored Procedures via .NET and able to do so but when I look in Oracle Enterprise Manager Console, the Stored Procedures are marked as INVALID... If I edit the Stored Procedure (i.e. delete a space or something minor) and SAVE then it compiles fine.....
    Any ideas ????
    will be using this against 9i & 10g db

  • Importing excel data into oracle tables

    Hello gurus,
    Importing excel data into oracle tables..
    I know this is the most common question on the thread ...First, i searched the forum, i found bunch of threads with loading data using sqlloader, converting excel into .Txt, tab delimited file, .csv file etc....
    Finally i was totally confused in terms how to get this done....
    Here is wat i have
       - Excel file on local computer.
       - i have laod data into dev environment tables(So no risk involved, but want to try something simple)
       - Oracle version 11.1.0.7
       - Sqlplus and toad (editors)
    Here is wat i like to do ....i dont know if its possible
        - Without going to unix server can i do everthing on local system by making use of oracle db and sqlplus or toad
       SQLLOADER might be one option...but i dont want to go the unix server for placing files and logs and stuff.
    Wat will be best and simplest option to do?? and wat format will best to convert from excel into csv, or txt or tab delimited etc.....
    If you suggest sqlloader, any code example will be greatly appriciated.
    Thank you so much!!!

    Hi,
    user642297 wrote:
    Imran,
    This is increadible option in toad!!! It works absolutely sweet!! I have toad 9.7 version. IT works great. Thank you so much!!You are welcome :)
    Well i have further discussion on this ....this option is great if you doing in staging or development area. What if your doing in prod?? If you automating the sqlloader then how do u do it?? I think we still need to stick with traditional approach of laoding data by making use of SQLLoader right ?? If m wrong please correct me.well, in our case, we do have access to a custom schema in prod where we create the staging table and load the data from datafiles.
    try this:
    load data
    infile 'C:\dest.csv'
    into table dest_table
    fields terminated by "~" optionally enclosed by '"'
    TRAILING NULLCOLS
    (name,
    owner_nm,
    description_column,
    UPDT_DT DATE 'MM/DD/YYYY')
    {code}
    you can get more info about sql loader and your error here:
    http://download.oracle.com/docs/cd/B10501_01/server.920/a96652/ch05.htm
    http://www.allinterview.com/showanswers/53766.html
    And one more quick question ...i found an example of control file , in that i see .dat format file. Is it a data file ?? can i try that option ?? But in excel i didnt see to convert the .dat format file.
    Any thoughts ???
    It is same as a delimiter text file.
    steps to create a .dat file (from a excel file):
    1. Insert a column between two columns and populate it with the delimiter (in our case, it is ~)
    2. Save the file as unicode text.
    3. Open the file in text editor and remove all the tabs (find an replace with blank)
    4. Save the file as "DEST.dat". Select encoding as UTF-8 while saving.
    5. Your .dat file is ready.
    Regards
    Imran
    Edited by: Imran Soudagar on Apr 22, 2010 10:22 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to write a procedure to load the data into a table using xml file as input to the procedure?

    Hi,
    Iam new to the xml,
    can u please anyone help me how to write procedure to load the data into a table using xml as input parameter to a procedure and xml file is as shown below which is input to me.
    <?xml version="1.0"?>
    <DiseaseCodes>
    <Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    <Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    <Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    </DiseaseCodes>.
    Regards,
    vikram.

    here is the your XML parse in 11g :
    select *
      from xmltable('//Entity' passing xmltype
    '<?xml version="1.0"?>
    <DiseaseCodes>
    <Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    <Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    <Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    </DiseaseCodes>
    ') columns
      "dcode" varchar2(4000) path '/Entity/dcode',
      "ddesc" varchar2(4000) path '/Entity/ddesc',
      "reauthflag" varchar2(4000) path '/Entity/reauthflag'
    dcode                                                                            ddesc                                                                            reauthflag
    0                                                                                (I87)Other disorders of veins - postphlebitic syndrome                           0
    0                                                                                (J04)Acute laryngitis and tracheitis                                             0
    0                                                                                (J17*)Pneumonia in other diseases - whooping cough                               0
    SQL>
    Using this parser you can create procedure as
    SQL> create or replace procedure myXMLParse(x clob) as
      2  begin
      3    insert into MyXmlTable
      4      select *
      5        from xmltable('//Entity' passing xmltype(x) columns "dcode"
      6                      varchar2(4000) path '/Entity/dcode',
      7                      "ddesc" varchar2(4000) path '/Entity/ddesc',
      8                      "reauthflag" varchar2(4000) path '/Entity/reauthflag');
      9    commit;
    10  end;
    11 
    12  /
    Procedure created
    SQL>
    SQL>
    SQL> exec myXMLParse('<?xml version="1.0"?><DiseaseCodes><Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity><Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity><Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity></DiseaseCodes>');
    PL/SQL procedure successfully completed
    SQL> select * from MYXMLTABLE;
    dcode                                                                            ddesc                                                                            reauthflag
    0                                                                                (I87)Other disorders of veins - postphlebitic syndrome                           0
    0                                                                                (J04)Acute laryngitis and tracheitis                                             0
    0                                                                                (J17*)Pneumonia in other diseases - whooping cough                               0
    SQL>
    SQL>
    Ramin Hashimzade

  • Can't import ical dates into iphoto calendar

    Hi all,
    I'm trying to make an iphoto calendar for a friend and I'm running into a frustrating problelm. My friend emailed me an ical birthday calendar which he would like to have included in the iphoto calendar. I imported the ical calendar into my own ical as a new calendar. I have created my calendar in iphoto but I cannot import these dates into it. When I go to settings and click the calendar tab I am given the option of which ical calendars I would like to import to my calendar. I see two, one is my own normal calendar and the other is the birthday calendar sent to me by my friend. I check the birthday calendar and then click ok and ical appears to be importing the dates but when I look at my calendar the dates have not imported. If I try importing my normal calendar I have no problem. What's going on here??? Please help I am getting really frustrated.

    There are many video formats. iPhoto can't read all of them; in fact, it can't read most of them. Here's something that can:
    VideoLAN - Download official VLC media player for Mac OS X
    On the other hand, the videos are just files. You can copy them anywhere you want in the Finder.

  • Importing iCal dates into Address book

    I have a calendar in iCal that stored severyone's brithday and I would like now to import these dates into my address book.  Is there any way?
    Thanks

    Hi,
    You may be able do this with an Applescript. However there is not enough information supplied to know.
    How are ther events formatted in iCal? Do they contain the full name of the person? Do they say how old they are? Are the people already in Address Book, or would they all be new cards?
    Best wishes
    John M

  • Is there a way to import iCal data into a numbers spreadsheet?

    Is there a way to import iCal data into a numbers spreadsheet?

    If you want to import lots of calendar events into Numbers, the general way to proceed would be to:
    export in CSV (character-separated values) from iCal (Calendar)
    import the CSV into Numbers.
    1. can be accomplished via AppleScript (perhaps in an Automator workflow) or, perhaps more convenient, a dedicated exporter app such as Export Calendars Pro or competitors.
    2. Importing into Numbers is usually as easy as File > Open and choose the CSV file.
    SG

  • I have created stored procedure with %rowtype as IN OUT parameter.I want to

    i have created stored procedure with %rowtype as IN OUT parameter.I want to call it in java program

    Hi Avi,
    I have the same problem as the person asking before me, so I'll try and clarify:
    I have a Java client and a PL/SQL database procedure that looks something along the lines of:
    Create of Replace procedure myProc(myRow IN myTable%Rowtype)
    It's very easy to pass a parameter into this procedure from another procedure within the database because creating another myTable%Rowtype is not a problem.
    However, Java doesnt know what "Rowtype" is.
    I was wondering how I would pass a "rowtype" from Java.
    I was thinking along the lines of creating an object in the DB like that:
    Create Type myObj AS myTable%Rowtype (<-- is that even allowed?)
    And then create a procedure in the DB with the header:
    Create of Replace procedure myProc(myRow IN myObj)
    And then, in my Java,just create a STRUCT of my DB object and pass it to the DB:
    myCallableStatement.setObject(1, myStruct);
    Would that work?
    Is there a better way?
    Thanks,
    Dan

Maybe you are looking for