Reg: read excel column and insert into table.

hi Friends,
      i wanted to read the data from Excel and insert into in my oracle tables.
      can you provide the link or example script.
    how to read the column value from excel and insert into table.
  please help.

< unnecessary reference to personal blog removed by moderator >
Here are the steps:
1) First create a directory and grant read , write , execute to the user from where you want to access the flat files and load it.
2) Write a generic function to load PIPE delimited flat files:
CREATE OR REPLACE FUNCTION TABLE_LOAD ( p_table in varchar2,
p_dir in varchar2 DEFAULT ‘YOUR_DIRECTORY_NAME’,
P_FILENAME in varchar2,
p_ignore_headerlines IN INTEGER DEFAULT 1,
p_delimiter in varchar2 default ‘|’,
p_optional_enclosed in varchar2 default ‘”‘ )
return number
is
– FUNCTION TABLE_LOAD
– PURPOSE: Load the flat files i.e. only text files to Oracle
– tables.
– This is a generic function which can be used for
– importing any text flat files to oracle database.
– PARAMETERS:
– P_TABLE
– Pass name of the table for which import has to be done.
– P_DIR
– Name of the directory where the file is been placed.
– Note: The grant has to be given for the user to the directory
– before executing the function
– P_FILENAME
– The name of the flat file(a text file)
– P_IGNORE_HEADERLINES
– By default we are passing 1 to skip the first line of the file
– which are headers on the Flat files.
– P_DELIMITER
– Dafault “|” pipe is been passed.
– P_OPTIONAL_ENCLOSED
– Optionally enclosed by ‘ ” ‘ are been ignored.
– AUTHOR:
– Slobaray
l_input utl_file.file_type;
l_theCursor integer default dbms_sql.open_cursor;
l_lastLine varchar2(4000);
l_cnames varchar2(4000);
l_bindvars varchar2(4000);
l_status integer;
l_cnt number default 0;
l_rowCount number default 0;
l_sep char(1) default NULL;
L_ERRMSG varchar2(4000);
V_EOF BOOLEAN := false;
begin
l_cnt := 1;
for TAB_COLUMNS in (
select column_name, data_type from user_tab_columns where table_name=p_table order by column_id
) loop
l_cnames := l_cnames || tab_columns.column_name || ‘,’;
l_bindvars := l_bindvars || case when tab_columns.data_type in (‘DATE’, ‘TIMESTAMP(6)’) then ‘to_date(:b’ || l_cnt || ‘,”YYYY-MM-DD HH24:MI:SS”),’ else ‘:b’|| l_cnt || ‘,’ end;
l_cnt := l_cnt + 1;
end loop;
l_cnames := rtrim(l_cnames,’,');
L_BINDVARS := RTRIM(L_BINDVARS,’,');
L_INPUT := UTL_FILE.FOPEN( P_DIR, P_FILENAME, ‘r’ );
IF p_ignore_headerlines > 0
THEN
BEGIN
FOR i IN 1 .. p_ignore_headerlines
LOOP
UTL_FILE.get_line(l_input, l_lastLine);
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
v_eof := TRUE;
end;
END IF;
if not v_eof then
dbms_sql.parse( l_theCursor, ‘insert into ‘ || p_table || ‘(‘ || l_cnames || ‘) values (‘ || l_bindvars || ‘)’, dbms_sql.native );
loop
begin
utl_file.get_line( l_input, l_lastLine );
exception
when NO_DATA_FOUND then
exit;
end;
if length(l_lastLine) > 0 then
for i in 1 .. l_cnt-1
LOOP
dbms_sql.bind_variable( l_theCursor, ‘:b’||i,
ltrim(rtrim(rtrim(
regexp_substr(l_lastLine,’([^|]*)(\||$)’,1,i),p_delimiter),p_optional_enclosed),p_optional_enclosed));
end loop;
begin
l_status := dbms_sql.execute(l_theCursor);
l_rowCount := l_rowCount + 1;
exception
when OTHERS then
L_ERRMSG := SQLERRM;
insert into BADLOG ( TABLE_NAME, ERRM, data, ERROR_DATE )
values ( P_TABLE,l_errmsg, l_lastLine ,systimestamp );
end;
end if;
end loop;
dbms_sql.close_cursor(l_theCursor);
utl_file.fclose( l_input );
commit;
end if;
insert into IMPORT_HIST (FILENAME,TABLE_NAME,NUM_OF_REC,IMPORT_DATE)
values ( P_FILENAME, P_TABLE,l_rowCount,sysdate );
UTL_FILE.FRENAME(
P_DIR,
P_FILENAME,
P_DIR,
REPLACE(P_FILENAME,
‘.txt’,
‘_’ || TO_CHAR(SYSDATE, ‘DD_MON_RRRR_HH24_MI_SS_AM’) || ‘.txt’
commit;
RETURN L_ROWCOUNT;
end TABLE_LOAD;
Note: when you run the function then it will also modify the source flat file with timestamp , so that we can have the track like which file was loaded .
3) Check if the user is having UTL_FILE privileges or not :
SQL> SELECT OWNER,
OBJECT_TYPE
FROM ALL_OBJECTS
WHERE OBJECT_NAME = ‘UTL_FILE’
AND OWNER =<>;
If the user is not having the privileges then grant “UTL_FILE” to user from SYS user:
SQL> GRANT EXECUTE ON UTL_FILE TO <>;
4) In the function I have used two tables like:
import_hist table and badlog table to track the history of the load and another to check the bad log if it occurs while doing the load .
Under the same user create an error log table to log the error out records while doing the import:
SQL> CREATE TABLE badlog
errm VARCHAR2(4000),
data VARCHAR2(4000) ,
error_date TIMESTAMP
Under the same user create Load history table to log the details of the file and tables that are imported with a track of records loaded:
SQL> create table IMPORT_HIST
FILENAME varchar2(200),
TABLE_NAME varchar2(200),
NUM_OF_REC number,
IMPORT_DATE DATE
5) Finally run the PLSQL block and check if it is loading properly or not if not then check the badlog:
Execute the PLSQL block to import the data from the USER:
SQL> declare
P_TABLE varchar2(200):=<>;
P_DIR varchar2(200):=<>;
P_FILENAME VARCHAR2(200):=<>;
v_Return NUMBER;
BEGIN
v_Return := TABLE_LOAD(
P_TABLE => P_TABLE,
P_DIR => P_DIR,
P_FILENAME => P_FILENAME,
P_IGNORE_HEADERLINES => P_IGNORE_HEADERLINES,
P_DELIMITER => P_DELIMITER,
P_OPTIONAL_ENCLOSED => P_OPTIONAL_ENCLOSED
DBMS_OUTPUT.PUT_LINE(‘v_Return = ‘ || v_Return);
end;
6) Once the PLSQL block is been executed then check for any error log table and also the target table if the records are been successfully imported or not.

Similar Messages

  • How can one  read a Excel File and Upload into Table using Pl/SQL Code.

    How can one read a Excel File and Upload into Table using Pl/SQL Code.
    1. Excel File is on My PC.
    2. And I want to write a Stored Procedure or Package to do that.
    3. DataBase is on Other Server. Client-Server Environment.
    4. I am Using Toad or PlSql developer tool.

    If you would like to create a package/procedure in order to solve this problem consider using the UTL_FILE in built package, here are a few steps to get you going:
    1. Get your DBA to create directory object in oracle using the following command:
    create directory TEST_DIR as ‘directory_path’;
    Note: This directory is on the server.
    2. Grant read,write on directory directory_object_name to username;
    You can find out the directory_object_name value from dba_directories view if you are using the system user account.
    3. Logon as the user as mentioned above.
    Sample code read plain text file code, you can modify this code to suit your need (i.e. read a csv file)
    function getData(p_filename in varchar2,
    p_filepath in varchar2
    ) RETURN VARCHAR2 is
    input_file utl_file.file_type;
    --declare a buffer to read text data
    input_buffer varchar2(4000);
    begin
    --using the UTL_FILE in built package
    input_file := utl_file.fopen(p_filepath, p_filename, 'R');
    utl_file.get_line(input_file, input_buffer);
    --debug
    --dbms_output.put_line(input_buffer);
    utl_file.fclose(input_file);
    --return data
    return input_buffer;
    end;
    Hope this helps.

  • How to read ecel sheet and insert into oracle table

    hi all,
    am working on forms builder 6i. and i want , from a trigger to read from a a sheet excel file the data and insert into a table that i had aleady created.
    i whrite a code that can till now open the excel file but i cant read the data to insert it into the table.
    am using TEXT_IO.IS_OPEN to open the file
    TEXT_IO.GET_LINE to take each line
    and subst(x as variable) to read the first line , but the subsrt return nohing
    any solution??

    There's already a topic made on this: how to copy data from excel to oracle forms

  • Could anyone tell me how to read 4 lines altogether and insert into table

    Hi ,
    I want to load the below data into table by using sql loader.
    First 4 lines should insert in one single row in table and again it should from '01' load the next 4 lines in another row.
    01suresh
    02works
    03in
    04bankok
    01kumar
    02works
    03in
    04abudabi
    01Raju
    02works
    03in
    04france
    Could you please give me some suggestion how i can accomplish it.
    Thanks in advance.
    Regards,
    Vino

    user1142030 wrote:
    First 4 lines should insert in one single row in table and again it should from '01' load the next 4 lines in another row.Not a problem, use CONTINUEIF. Control file:
    LOAD DATA
    INFILE *
    REPLACE
    CONTINUEIF NEXT PRESERVE(1:2) != "01"
    INTO TABLE continueif
    TRAILING NULLCOLS
    DUMMY FILLER POSITION(1:2),
    COL1 TERMINATED BY '02',
    COL2 TERMINATED BY '03',
    COL3 TERMINATED BY '04',
    COL4 TERMINATED BY '01'
    BEGINDATA
    01suresh
    02works
    03in
    04bankok
    01kumar
    02works
    03in
    04abudabi
    01Raju
    02works
    03in
    04france Now:
    SQL> create table continueif(
      2                          col1 varchar2(10),
      3                          col2 varchar2(10),
      4                          col3 varchar2(10),
      5                          col4 varchar2(10)
      6                         )
      7  /
    Table created.
    SQL> host sqlldr scott@orcl/tiger control=c:\temp\continueif.ctl log=c:\temp\continueif.log
    SQL> select * from continueif
      2  /
    COL1       COL2       COL3       COL4
    suresh     works      in         bankok
    kumar      works      in         abudabi
    Raju       works      in         france
    3 rows selected.
    SQL> SY.

  • Reading  xml data from url and insert into table

    CREATE TABLE url_tab2
    URL_NAME VARCHAR2(100),
    URL SYS.URIType
    INSERT INTO url_tab2 VALUES
    (’This is a test URL’,
    sys.UriFactory.getUri(’http://www.domain.com/test.xml’)
    it is giving error as invalid character

    Check if your single quotes are the correct single quotes.
    The principle works as advertised in the XMLDB Developers Guide...
    C:\>sqlplus / as sysdba
    SQL*Plus: Release 11.1.0.7.0 - Production on Tue Nov 25 21:44:46 2008
    Copyright (c) 1982, 2008, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> create user OTN identified by OTN account unlock;
    User created.
    SQL> grant dba, xdbadmin to OTN;
    Grant succeeded.
    SQL> conn OTN/OTN
    Connected.
    SQL> CREATE TABLE uri_tab (docUrl SYS.URIType, docName VARCHAR2(200));
    Table created.
    SQL> -- Method SYS.URIFACTORY.getURI() with absolute URIs
    SQL> -- Insert an HTTPUri with absolute URL into SYS.URIType using URIFACTORY.
    SQL> -- The target is Oracle home page.
    SQL> INSERT INTO uri_tab VALUES
      2  (SYS.URIFACTORY.getURI('http://www.oracle.com'), 'AbsURL');
    1 row created.
    SQL> -- Insert an HTTPUri with relative URL using constructor SYS.HTTPURIType.
    SQL> -- Note the absence of prefix http://. The target is the same.
    SQL> INSERT INTO uri_tab VALUES (SYS.HTTPURIType('www.oracle.com'), 'RelURL');
    1 row created.
    SQL> -- Insert a DBUri that targets employee data from database table hr.employees.
    SQL>
    SQL> INSERT INTO uri_tab VALUES
      2  (SYS.URIFACTORY.getURI('/oradb/HR/EMPLOYEES/ROW[EMPLOYEE_ID=200]'), 'Emp200');
    1 row created.
    SQL> SELECT e.docUrl.getCLOB(), docName FROM uri_tab e;
    E.DOCURL.GETCLOB()
    DOCNAME
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN
    ">
    <html>
    <head>
    AbsURL
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN
    ">
    <html>
    E.DOCURL.GETCLOB()
    DOCNAME
    <head>
    RelURL
    <?xml version="1.0"?>
    <ROW>
      <EMPLOYEE_ID>200</EMPLOYEE_ID>
      <FIRST_NAME>Jenn
    Emp200
    SQL> set long 1000
    SQL> select HTTPURITYPE('www.oracle.com').getCLob() from dual;
    HTTPURITYPE('WWW.ORACLE.COM').GETCLOB()
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN
    ">
    <html>
    <head>
    <title>Oracle 11g, Siebel, PeopleSoft |
    Oracle, The World's Largest Enterprise S
    oftware Company</title>
    <meta name="title" content="Enterprise Applications | D
    atabase | Fusion Middleware | Applicatio
    ns Unlimited | Business | Oracle, The Wo
    rld's Largest Enterprise Software CompanEdited by: Marco Gralike on Nov 25, 2008 10:13 PM

  • Read text file and insert into MySQL

    Dears,
    I need to read text file and then insert the data in the correct column in the MySQL database
    example
    I have the following text file:
    field1=1234 field2=56789 field3=444555
    field1=1333 field2=2222 field3=333555
    and so on and so forth ,,note that all rows are identical and just the filed value is changed(there is a dilemeter between fields)
    how can I read field1,field2 and field3 from text file and insert them in the correct table and column in the database.....
    any help?????
    thanks for your cooperation
    Best Regars

    Sure.
    Which part don't you understand?
    1. Reading a text file
    2. Parsing the text file contents.
    3. Relational databases and SQL.
    4. How to create a database.
    5. How to connect to a database in Java.
    6. How to insert records into the database in Java.
    7. How to map Java objects to records in a database.
    This is a pretty nice list. Solve complex problems by breaking them into smaller ones.
    %

  • Inserting a number in increasing order as columns are inserted into table

    i have a global temporary table that is populated using a procedure that has a column that needs to start at 0 and add 1 each time a column is inserted. Is there a way to do this without creating a sequence and a trigger for that column?
    example:
    ikey tran_post_code_rc receipt_date sequence_num_rc
    0 E289F 31-dec-2009 100
    1 E289F 31-dec-2009 98
    2 E289F 31-dec-2009 90
    3 E289F 31-dec-2009 103
    4 E289F 31-dec-2009 89
    5 E289F 31-dec-2009 97

    let me see if I am understanding you correctly
    INSERT INTO ven415940_rpt2
    SELECT
    rownum AS ikey
    ,c.tran_post_code_rc
    ,c.receipt_date
    ,c.sequence_num_rc
    from .....
    does this look corrrect?

  • Access data from from two lists based on lookup columns and insert into another

    Hi,
    I am new in SharePoint and is stuck in some problem.
    I want to insert data in to a list by fetching data from 2 lists.
    The scenario is :
    List A Columns : EmployeeName, EmployeeID, EmployeeSalary 
    List B Columns : DepartmentName, EmployeeID, ManagerID
    EmployeeID is lookup column 
    I want to fetch data from these 2 lists and insert data into another list:
    List C Columns: EmployeeName, EmployeeSalary, DepartmentName 
    Can someone please explain me all the possible approaches to do the above task

    If ListA and ListB are the lists that you created, it would be better to generate the lists data into one list not seperate lists, as they both represents the property information of one employee.
    If they are existing lists, you may have following considerations:
    1. if you are a programmer, it would be easier to have a lookup column at ListA, to generate the EmployeeName, EmplyeeSalary, then using ItemAdded event, to generate the DepartmentName column based on EmployeeID column.
    2. have a lookup column look at ListA, use workflow, set when item is created, start the workflow automatically, then in the workflow, find ListB related item based on EmployeeID column, to set the DepartmentName column, SharePoint designer workflow
    set Item Value activity can do this work, you can research to find more information about how to do this.
    Thanks,
    Qiao Wei <br/> My blog:http://blog.goobol.com

  • Read Excel file and insert it into a table

    Hi All
    i'm developing a web app using jdeveloper 11.1.1.3
    I want to upload an excel file to a table, is there way in the frame work to do this easily
    Tx

    convert the excel fil to a .csv file and expose the csv file as a datacontrol and then use it in the table
    http://technology.amis.nl/blog/2306/uploading-csv-files-into-dynamic-adf-faces-tables-programmtically-creating-columns

  • Procedure with multiple Loops and Insert into table

    Hello All,
    I am trying to create the Procedure to create a new table for our DWH.
    In this Case, I have 2 tables and I need to create Loop for each value from one table and get the respective data from second table based on first table data.
    Please find the below example:
    First table: TABLE_A
    X             Y              Z
    1              a              10
    1              b             abc
    1              c              xy
    1              e             $
    2              a              11
    2              c              asf
    2              d             tal
    2              f              ghs
    Second Table: TABLE_B
    A             B             C             D             E              F
    10           abc         xy           sd           ew          100
    10           jhy          xy           sd           ew          100
    11           ght         asf          tal           ss            ghs
    11           ght         afr          tal           ss            ghs
    O/P Table from Procedure: OUTPUT_TABLE
    A             B             C             D             E              F              X
    10           abc         xy           sd           ew          100         1
    11           ght         asf          tal           ss            ghs         2
    Business Logic In the Procedure:
    CREATE OR REPLACE PROCEDURE OP_TAB_PROCEDURE IS
    BEGIN
                    -- First get the DISTINCT values from the TABLE_A to generate the Loop
                    FOR ID (SEELCT DISTINCT X FROM TABLE_A_
                    LOOP
                                    -- For Each ID get the Y ,Z values from TABLE_A other than $ in Z
                                                    TEMP:
                                                    SELECT Y, Z FROM TABLE_A WHERE X = ID.X AND Z <> '$' ;
                                                    Based on above SELECT statement, I need to construct dynamic SQL query to get the data from TABLE_B
                                                    OP_EACH_ID:
                                                    SELECT * , ID.X AS X FROM TABLE_A WHERE [In this place I need generate sql cond dynamically. For Example, For X=1 in TABLE_A , the where cond must A=10 AND B='abc' AND C='xy'
                                                                                                                                                                                                                     For X=2 , the Where cond must be WHERE A=11 AND C='asf' AND D='tal' AND F='ghs']
                                                    -- I need to INSERT all the values from OP_EACH_ID into OUT_PUT_TABLE
                    END LOOP ;
    END;
    I am new to PL/SQL , so please help me on the above case.

    duplicate post

  • Create and insert into table from Oracle to MS SQL server.

    Hello,
    Oracle Database 11g and Red hat 5
    I have a very different kind of issue. I am handling the ORACLE db(remote db with all the important data). On the other side their is a MS SQL server db(local db with some testing data in it). All the users will access the ORACLE db for the actual processing but for sometime they need to apply some of their own concepts. So they will transfer the data from ORACLE to MS sql server.
    I want to create a code in ORACLE db like a procedure , which will create a table in MS sql server , insert data into it,Also create some metadata table to keep some of my table's info on MS SQL serve db,If the table is present it should append the data, .... like many things ...
    Overall my question is , how can i write a code to make these operation on a remote db, that to these operations are DDL and on MS SQL Server(Non-Oracle) ???
    Please guide me with some ideas or solutions ...
    Also provide if you have some good links to study ...
    thanks in advance.

    I'm not sure why you never visit http://tahiti.oracle.com prior to asking any question. Is it forbidden in your locale? Are you afraid of it? Will your salary be decreased when you visit the documentation?
    http://www.oracle.com/pls/db111/search?word=sql+server&partno=
    should provide sufficient information.
    Your doc question must be considered a violation of Forum Etiquette and an abuse of this forum.
    Sybrand Bakker
    Senior Oracle DBA

  • Read XML data and Insert into SQL Database

    Hi Everybody,
    i am new to Oracle SOA.
    Can anybody help me out to how to insert xml data into sql server using BPEL and JDeveloper (with clear steps).
    thanks in advance
    Vishnu Kumar

    Hi Peter,
    you are right,at high level i was able to figure at these things.
    But i don't know how to implement it using jdeveloper.
    It will be more helpful if you can give me detailed steps to do it.
    Thanks
    Vishnu Kumar

  • How to extract data from xml and insert into Oracle table

    Hi,
    I have a large xml file. which will have hundreds of the following transaction tags having column names and there values.
    There is a table one of the schema with coulums "actualCostRate","billRate"....etc.
    I need to extract the values of these columns and insert into the table
    <Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuUK" chargeCode="LCOCD1" externalID="L-RESCODE_UK1-PROJ_UK_CNT_GBP-37289-8" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-12" transactionType="L" units="11" taskID="5017601" inputTypeCode="SALES" groupId="123" voucherNumber="ABCVDD" transactionClass="ABCD"/>
    <Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuEU" chargeCode="LCOCD1" externalID="L-RESCODE_US1-PROJ_EU_STD2-37291-4" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-04" transactionType="L" units="4" taskID="5017601" inputTypeCode="SALES" groupId="124" voucherNumber="EEE222" transactionClass="DEFG"/>

    Re: Insert from XML to relational table
    http://www.google.ae/search?hl=ar&q=extract+data+from+xml+and+insert+into+Oracle+table+&btnG=%D8%A8%D8%AD%D8%AB+Google&meta=

  • Sample insert into table with BLOB column

    This is my first opportunity to work with BLOB columns. I was wondering if anyone had some sample code that shows the loading of a blob column and inserted into the table with a blob column.
    I have to produce a report (including crlf) and place it into a blob column. The user will download the report at a later time.
    Any suggestions / code samples are greatly appreciated!!!!

    You can enable string binding in TopLink.
    login.useStringBinding(int size);
    or you could enable binding in general,
    login.bindAllParameters();

  • Split one column  value and insert into multiple columns

    hi
    am new to plsql .
    i want to split a characters from one column and insert into multiple columns
    i tried used substr function the symbol ',' vary his place dynamically ,so i can't apply substr function.
    for eg:  before split
    col1 :
    col2 :
    col3 :
    col4 :
    colu5: adsdf,fgrty,erfth,oiunth,okujt
    after split
    col1 :adsd
    col2 :fgrty
    col3 :erfth
    col4 :oiunth
    col5 : adsdf,fgrty,erfth,oiunth,okujt
    can anyone help me
    thanks
    Edited by: 800324 on Dec 23, 2010 8:28 AM
    Edited by: 800324 on Dec 23, 2010 8:36 AM

    How about:
    SQL> create table t
      2  (col1 varchar2(30)
      3  ,col2 varchar2(30)
      4  ,col3 varchar2(30)
      5  ,col4 varchar2(30)
      6  ,col5 varchar2(30)
      7  );
    Table created.
    SQL> insert into t (col5) values ('adsdf,fgrty,erfth,oiunth,okujt');
    1 row created.
    SQL> insert into t (col5) values ('x,y');
    1 row created.
    SQL> insert into t (col5) values ('a,b,c,d');
    1 row created.
    SQL> select * from t;
    COL1                           COL2                           COL3                           COL4                           COL5
                                                                                                                                adsdf,fgrty,erfth,oiunth,okujt
                                                                                                                                x,y
                                                                                                                                a,b,c,d
    3 rows selected.
    SQL>
    SQL> merge into t a
      2  using ( with t1 as ( select col5||',' col5
      3                       from   t
      4                     )
      5          select substr(col5, 1, instr(col5, ',', 1, 1)-1) col1
      6          ,      substr(col5, instr(col5, ',', 1, 1)+1, instr(col5, ',', 1, 2)- instr(col5, ',', 1, 1)-1) col2
      7          ,      substr(col5, instr(col5, ',', 1, 2)+1, instr(col5, ',', 1, 3)- instr(col5, ',', 1, 2)-1) col3
      8          ,      substr(col5, instr(col5, ',', 1, 3)+1, instr(col5, ',', 1, 4)- instr(col5, ',', 1, 3)-1) col4
      9          ,      rtrim(col5, ',') col5
    10          from   t1
    11        ) b
    12  on ( a.col5 = b.col5 )
    13  when matched then update set a.col1 = b.col1
    14                             , a.col2 = b.col2
    15                             , a.col3 = b.col3
    16                             , a.col4 = b.col4
    17  when not matched then insert (a.col1) values (null);
    3 rows merged.
    SQL> select * from t;
    COL1                           COL2                           COL3                           COL4                           COL5
    adsdf                          fgrty                          erfth                          oiunth                         adsdf,fgrty,erfth,oiunth,okujt
    x                              y                                                                                            x,y
    a                              b                              c                              d                              a,b,c,d
    3 rows selected.
    SQL> Assuming you're on 9i...

Maybe you are looking for

  • Need help installing oracle 8.1.7 on RH 8.0

    I'm a newbie to linux red hat 8.0 and I'm trying to install oracle 8.1.7 on red hat 8.0 I keep getting all these error message and half the instructions i read i cannot find thoughts files that need to be modified. Can someone please point me into th

  • Will upgrading ram improve speed in Mac and windows (VMware fusion)?

    I Am using VMware fusion for music production and that program requires a lot of workspace. I have a MacBook Pro 4gb ram and when I turn VMware on it goes to 2 gb ram in Mac and 2 gb ram in windows. My Mac speed is normal when VMware fusion is turned

  • Problem converting XPS document with large images

    Hi, When I try to convert XPS documents to PDF in Acrobat 9.0 Pro, I have problems with "large images". They are either truncated or scaled down. The only images that convert correctly are small images that are not stretched to fill a large area. Att

  • Email: content-type html

    Is it possible to send an email with html content from ALSB ? If I set the content-type to 'text/html' in the transport header, the ALSB is overriding it to 'text/plain'. Any ideas are appreciated. Thanks.

  • Total Training for Flash CS4 ProIT,

    hello, im somewhat new to flash but i want to be good at it. im not really sure where to post this also but im looking for opinion and advise. im wondering about the package total training for adobe cs4 professional if it will good for my training an