divide a column value and insert it into several columns

Hello
am new to plsql.
I want to divide a characters in a column and insert into multiple columns

I tried the function substr used the symbol ',' vary its place dynamically, so I can't apply the substr function.


for example: before split
col1:
col2:
COL3:
COL4:
colu5: adsdf, fgrty, erfth, oiunth, okujt



after separation

col1: adsd
col2: fgrty
COL3: erfth
COL4: oiunth
col5: adsdf, fgrty, erfth, oiunth, okujt



can someone help me

Thank you

Published by: 800324 on December 23, 2010 08:28

Published by: 800324 on December 23, 2010 08:36

What:

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...

Tags: Database

Similar Questions

  • Get the date value. MinValue and insert it into the DB

    Hello

    I'm developing an adf application using jdev11g.

    I need to recover the 3 values of page jsf (inputText 2 + 1 date. MinValue) and insert them into DB

    so I create a method in appModuleImpl:

    {public createAffAgVehNewRow (Date date, around km, veh Integer) Sub

    Get the id of the current user

    String ag = ADFContext.getCurrent () .getSessionScope ().get("idAg").toString ();

    getSequenceNumber

    oracle.jbo.domain.Number seq = new oracle.jbo.domain.Number (0);

    SequenceImpl seqImpl = new SequenceImpl ("AFF_AV_SEQ", getDBTransaction());

    SEQ = seqImpl.getSequenceNumber ();

    Insert values into the DB table

    Line r = getAffAgVehView1 () .createRow ();

    ViewObjectImpl vo = this.getAffAgVehView1 ();

    r.setAttribute ("IdAg", Integer.parseInt (ag.toString ()) ");

    r.setAttribute ("IdAffAv", seq);

    r.setAttribute ("KmDep", km);

    r.setAttribute ("IdVeh", veh);

    r.setAttribute ("DateAff", date);

    r.setAttribute ("KmArriv", null);

    r.setAttribute ("ConsoCarb", null);

    vo.insertRow (r);

    this.getDBTransaction () .commit ();

    }

    also, I changed the default value of the EO (AffAgVeh) to adf.currentDate () and the user interface as simpleDate format: "MM/DD/YYYY.

    the problem as whene I enter 3 inputValues and click on the button I get this message:

    Timestamp format must be yyyy-mm-dd hh: mm: [.fffffffff]

    someone knows how to solve this problem

    Thank you

    Mark

    Hi Dev

    Please pass.

    java.sql.SQLException: column type invalid in the adf

    Thank you

    Subramanian M

  • Read the BLOB and insert data into a table

    Hi all

    Let us examine below on Oracle DB 12 c:

    create table xx_test3 (c blob);
    
    insert into xx_test3 (c) values (utl_raw.cast_to_raw(
    'azertyuiop,qsdfghjklm,wxcvbn'));
    
    
    create table xx_target (col1 varchar2(50));
    
    
    
    

    Can someone guide me how to read the data and insert it into the xx_target table?

    Necessary result is:

    
    select * from xx_target;
    
    
    COL1                                              
    
    --------------------------------------------------
    azertyuiop                                        
    qsdfghjklm                                        
    wxcvbn                                            
    
    3 rows selected.
    
    
    
    
    

    Thanks in advance,

    Stoyanov.

    insert into xx_target (col1)

    with the data as)

    Select utl_raw.cast_to_varchar2 (dbms_lob.substr (c, 32000, 1)) CBC

    of xx_test3

    )

    Select regexp_substr (CBC, ' [^,] +', 1, level)

    from the data

    connect by level<= regexp_count(src,="" ',')="" +="">

  • Remove all lines and insert them into Oracle can make performance worse?

    I m working in a project that I need to make a batch update regularly (every 4 months) of excel files. These files have doesn´t excellent key in their ranks.

    The development of a code that deletes all lines and inserts the entire base again is easier than one who checks in all the ranks of its primary key and if necessary update. (sometimes may be a key to 5 columns).

    My question is: if I delete all the rows in the tables of the insert it again, it will cause tablespace fragmentation and in a future loss of performance?

    Is there a way to avoid this?

    Thanks in advance

    Alexander

    This response helped me a lot.

    Thank you all

    Remove all lines and insert them into Oracle can make performance worse? -Stack overflow

  • Divide the value and insert into the table

    create table mytab (a tank (25), b Varchar2 (50), Varchar2 (100)) C;

    I have a string like

    myStr:'A$bggoy#qwewewee@A$Qwe#zcxdf@A$po#xvcvxc@A$sdmy#sfdsdf @'

    I need to divide and insert into mytab

    That's what I tried

    declare p_str varchar2 (4000)

    Begin

    long l_str p_str default. '$';

    number of l_n;

    myTableType l_data: = myTabletype();

    Start

    loop

    l_n: = instr (l_str, ",");

    When the output (nvl(l_n,0) = 0);

    l_data.extend;

    l_data (l_data.count): =.

    LTRIM (rtrim (substr (l_str, 1, l_n - 1)));

    l_str: = substr (l_str, l_n + 1);

    -Connect mytab

    end loop;

    end;

    Shows below inf-s:

    describe the OBJ_SPLIT ;

    recreate

    CREATE OR REPLACE TYPE OBJ_SPLIT_table IS TABLE OF OBJ_SPLIT;

    to view the result of the compilation

    CREATE OR REPLACE Function Fn_get_split (P_str VARCHAR2)

    return OBJ_SPLIT_table

    PIPELINED is type t_ref_cursor IS REF CURSOR;

    rf_c t_ref_cursor;

    r_out_rec OBJ_SPLIT: = OBJ_SPLIT (null, null, null, null);

    Begin

    Open the rf_c for

    Select s,.

    REGEXP_SUBSTR (str, ' [^ $] +', 1, 1) s1,

    REGEXP_SUBSTR (str, ' [^ $#] +', 1, 2) s2,.

    REGEXP_SUBSTR (str, ' [^ $#] +' 1, 3) s3

    from (select s, REGEXP_SUBSTR (s, "[^ @] +', 1, rownum") str)

    (select s P_str of double)

    connect by instr (s, ' @', 1, level - 1) > 0)

    where str is not null;

    LOOP

    EXTRACTION rf_c

    IN

    r_out_rec. Str,

    r_out_rec. Delimter1,

    r_out_rec. Delimter2,

    r_out_rec. Delimter3;

    EXIT WHEN rf_c % NOTFOUND;

    PIPE ROW (r_out_rec);

    END LOOP;

    CLOSE Rf_c;

    end;

    and the result

    Select DELIMTER1, DELIMTER2, table DELIMTER3 (Fn_get_split('A$bggoy#qwewewee@A$qwe#zcxdf@A$po#xvcvxc@A$sdmy#sfdsdf@'));

    in SQLPLUS


    ----

    Ramin Hashimzade

  • Separate a string in a field and insert it into 3 fields in another table

    I tried to do this with many examples in the forum using REGEXP_REPLACE and REGEXP_SUBSTR but nothing seems to work properly for me.

    I have this column in the t3_one table

    mergecode
    A8846
    A8847

    I need to use this mergecode to insert some values into the following three columns in the table t3_two

    dataCode mcprefix mcsuffix
    A A-8846, 8846
    A A-8847, 8847

    create table t3_one (mergecode varchar2 (10));

    create table t3_two (datacode varchar2 (10), mcprefix varchar2 (2), mcsuffic varchar (10));

    Insert into t3_one
    (mergecode)
    VALUES
    ("A8946");

    Insert into t3_one
    (mergecode)
    VALUES
    ('A8947");
  • How can I program a button to retrieve an image from a user base and insert them into a form field?

    I need help (I have not the slightest idea) with a java script to program a button to retrieve an image from a user base and insert into a form field. To go to the menu select icon.

    [edited by moderator - he had no body to the post office and it was while heading a long title.] [Shorten the title and pasted the original title, plenty of length as the message body]

    Okay, that's actually quite easily. As the l' evenement event MouseUp button, select "Execute JavaScript" and enter this code:

    event.target.buttonImportIcon ();

    When you click the button it will open a file selection dialog and the selected file is displayed under the icon of the button.

  • get the name of a directory file and insert it into a table

    Hello

    I have a requirement, I need to read the name of a Linux directory file and enter the file name in a variable,

    After that, I need to insert this file name in a table.

    EX: is it a file1.txt in Yearbook of the CBA, and I read that 'file name' in the v_file_name variable and I'm going to insert this file name in a table.

    Hello

    I think you've got your request of replied by Chantal.
    Shoul you have a kind of intelience in the name of the file itself so that ODI retrieves the correct file and insert into the table.

    Thank you
    Fati

  • updated line and insert them into another table with trigger.

    Hi guys I have a table that looks like this.
    CREATE TABLE TEST
      (
        "COL1" VARCHAR2(20 BYTE),
        "COL2" VARCHAR2(20 BYTE),
        "COL3" VARCHAR2(20 BYTE)
      )
    I'm going to insert the col1 and col2 values, but I need to get the value of column 3 of table 2 and then insert the complete record in table 3. I love doing that with a trigger. I get an error message and I can't for the life of me figuere out what im doing wrong.
    So here is my nonfunctional trigger.


    Here are the two table

    CREATE TABLE TESTTABLE
      (
        "COLUMN1" NUMBER(15,0),
        "COLUMN2" NUMBER(15,0)
      )
     
    
    Insert into TESTTABLE (COLUMN1,COLUMN2) values (1,5);
    HERE IS THE CODE OF THE TRIGGER
    CREATE OR REPLACE TRIGGER TRIGGER1 
    AFTER INSERT ON TEST 
    FOR EACH ROW 
    BEGIN
      update TEST
      SET COL3 = (SELECT COLUMN2 FROM TEST, TESTTABLE WHERE COLUMN1 = :new.COL1);
    END
    I get an error of trigger mutation that I tried the other iterations of the above but I'm not getting anywhere. I have dumb down my problem at these 3 table.
    Can someone point me in the right direction.

    You'll have to do some reading, but it comes down to process the data on education instead of line level.
    You may even be not at all a trigger.
    See:
    http://www.Oracle-base.com/articles/9i/mutating-table-exceptions.php
    http://asktom.Oracle.com/pls/asktom/asktom.download_file?p_file=6551198119097816936

  • Generate the command Id and insert data into two different tables: oracle apex 5.0

    I have three tables. name of the tables: PRODUCT, ORDER_HEADER, ORDER_DETAIL. I took REPORT inter ASSETS in which the VALUES from TABLE product. I need to use the trigger here, there is a TEXT ARTICLE called ORDER ID: it will generate through trigger. so whenever new order placed order id must be unique. There is a button when this button is clicked, the VALUES of REPORT must be inserted in to ORDER_HEADER , ORDER_DETAIL (in fact, I am in confusion is it even possible).

    I tried to create the trigger: not work if


    CREATE OR REPLACE TRIGGER "EMP_TRG1".

    Before Insert on order_header

    for each line

    Start

    If: new. Order_ID is null

    then

    Select lpad (demo_seq.nextval, 8, '0'): new. Order_ID order_header;

    end if;

    end;

    SQL:

    Select

    apex_item. Text(1,p.PRODUCT_ID) PID.

    PN.product_name,

    apex_item. Text(2,p.PRODUCT_QTY) qt.

    apex_item. Text(3,p.unit_price) upward,

    apex_item. Text(4,p.TOTAL_AMOUNT) am

    OMS_SHIP_CART_DETAIL p, pn OMS_PRODUCT

    where p.product_id = pn.product_id

    DA:

    var arr_f01 = [];

    var arr_f02 = [];

    var arr_f03 = [];

    var arr_f04 = [];

    var arr_f05 = [];

    product_id var;

    unit_price var;

    Var Qty;

    var total_1;

    () $("input[name='f01']").each

    function() {}

    product_id = $(this).closest('tr') .children ('td [headers = 'PID']') .text ();

    unit_price = $(this).closest('tr') .children ('td [headers = "Uprice"]') .text ();

    Qty = $(this).closest('tr') .children ('td [headers = "Qty"]') .text ();

    total_1 = $(this). Closest ('tr'). Children ('td [headers = "total"]'). Text();

    arr_f01.push ($(this).) Val());

    arr_f02.push (product_id);

    arr_f03.push (total_1);

    arr_f04.push (unit_price);

    arr_f05.push (Qty);

    }  );

    (apex). Server.Process

    "Insert a command."

    , {f01: arr_f01, f02: arr_f02, f03: arr_f03, f04: arr_f04, f05: arr_f05}

    }

    , {dataType: "text", success: function (pData) {alert ('added product') ;}}

    );

    Ajax callback:

    declare

    l_count number;

    Start

    -insert into OMS_ORDER_HEADER (USER_ID, TOTAL_AMOUNT, batch, ORDER_DATE) values(:P1_USER_ID,:P42_TOTAL,'PENDING',SYSDATE);

    I'm looping 1.apex_application.g_f01.count

    insert into OMS_ORDER_DETAIL (PRODUCT_ID, UNIT_QTY, UNIT_PRICE, TOTAL_AMOUNT)

    values (APEX_APPLICATION. G_F01 (i), APEX_APPLICATION. G_F03 (i), APEX_APPLICATION. G_F04 (i), APEX_APPLICATION. G_F05 (i));

    commit;

    end loop;

    end;

    Hi Dominique,.

    I create a process page away present in your application

    declare
      l_order_id varchar2(8);
    begin
      insert into order_header(ORDER_ID
                            , STATUS
                            , ORDER_DATE)
                      values(lpad(demo_seq.nextval,8,'0')
                            , 'Pending'
                            , sysdate)
      returning ORDER_ID into l_order_id; 
    
      for rec in(select ID
                      , QTY
                      , PRICE
                  from product)
      loop 
    
        Insert Into Order_Detail ( ORDER_ID
                                  , PRODUCT_ID
                                  , QTY
                                  , UNIT_PRICE)
                            Values(l_order_id
                                  , rec.id
                                  , rec.qty
                                  , rec.price); 
    
        commit;
      end loop;
    end;
    

    Please check and let me know.

    Kind regards

    Jitendra

  • Look for patterns in a string and insert it into a new table

    I need to write a query that finds a number of location of employees that has been changed from old to new

    EMPLOYEE_DESC

    Description of the ID

    1 employee location was change from 877-287-8765 to 876-876-0976

    2 location of employee was passing of 877-287-8766 at 876-879-0976

    slot 3 is passed under NONE FOUND TO577-75-5951

    Once I get the identifier for the old and the new, I need to insert into the new table

    INSERT INTO TABLE_B

    (OLD_LOC_ID, NEW_LOC_ID)

    VALUES (OLD_LOC_ID, NEW_LOC_ID);

    TABLE_B

    ID OLD_LOC_ID NEW_LOC_ID

    1 287-877-8765 876-876-0976

    2 287-877-8766 879-876-0976

    3. NONE FOUND 577-75-5951

    The problem is that there is no fixed model for these records. I guess I have to insert the records that correspond to a fixed patten and snoop then through other manually. Is there a REGULAR expression feature that can help me grep values old and new location for the employee_desc number?

    Thank you

    Kevin

    Hello

    Kevin_K wrote:

    ...  The problem is that there is no fixed model for these records. I guess I have to insert the records that correspond to a fixed patten and snoop then through other manually. Is there a REGULAR expression feature that can help me grep values old and new location for the employee_desc number?

    Thank you

    Kevin

    Yes, you can do something like this:

    REGEXP_SUBSTR (description

    , ' ((NONE FOUND) |) (\d+-\d+-\d+)) * To * \d+-\d+-\d+'

    1

    1

    'i' - case-insensitive

    )

    It looks like for

    1. a "phone number" or the words "NOTHING FOUND", followed immediately by
    2. 0 or more spaces followed immediately by
    3. the word "TO", followed immediately
    4. 0 or more spaces followed immediately by
    5. a "phone number".

    where a "phone number" is defined as

    1. 1 or more digits, followed immediately
    2. a hyphen, immediately followed by
    3. 1 or more digits, followed immediately
    4. a hyphen, immediately followed by
    5. 1 or more digits
    6. You can also get the parts before and after 'TO' separately.
  • Checkbox selects customer value and inserts of table

    Hello

    I need, when I need to create the form that displays all customer names with the check box in front of them
    so that the user can select customer for which they wish to process orders.

    I created check boxes and trying to insert the client in a table, but it does not work. Here is my code.
    Any help will be greatly appreciated.



    IF: block.checkbox = 'Y' THEN
    Insert into customer values(:block.client,600,user,sysdate);


    Thank you
    Sandy

    Hello.
    I guess that's a block of multi-record.
    If so, you need to loop in your block and for each record, you must issue an insert statement.
    Then make a commit_form.

    go_block('your_block');
    first_record;
    loop
     if :your_block.your_check_box  = 'Y' then
      insert into client values(:block.client,600,user,sysdate); 
    
      end if;
    
     exit when :system.last_record = 'TRUE';
    next_record;
    end loop;
    
    first_record;
    
    commit;
    
    if form_success or sqlcode = 0 then
         message('records successfully saved into database');
           message(' ',no_acknowledge);
    
    else
         message('Error saving records: '||sqlerrm);
         message(' ',no_acknowledge);
    end if;
    

    Hope it helps you,
    Fabrizio

    If this answer is useful or appropriate, please mark. Thank you.

  • Output and group records into several column format problem

    Hi all

    I'm banging my head on the wall with this one. I have a query that displays the result in the form of two columns, it works fine.

    I have a problem when I try to use "group"for the field DSC1 doesn't show duplicates."  He transforms the output in column 2, column 3 and column 4 spots white all along.

    Someone knows how can I get it to display 2 columns of output and does not show in double DSC1 fields? The following are examples of what is happening:


    1 example of what he does without group (note to Apple is twice, which is not):

    Apples apples

    Orange peaches

    banannas grapes

    What I need to do (only show each DSC1 once and continue with the format of two columns) :

    oranges apples

    Fisheries banannas

    grapes

    Here is the code I use:

    < cfquery name = "getProduct" datasource = "mydb" >
    SELECT * from ecitm
    WHERE DSC1 <>' '
    order by DSC1

    < / cfquery >

    <! - start the 2-column output table - >

    < table border = "0" width = "90%" border = "0" align = "center" cellpadding = "5" cellspacing = "5" >

    < cfset newrow = false

    < b >
    < cfoutput query = "getProduct" group = "DSC1" >

    < cfif newrow EQ "true" >
    < b >
    < / cfif >
    < td >
    #DSC1 #.
    < cfif DSC2 NEQ "" > "".
    < br >
    #DSC2 #.
    < / cfif >

    < br >
    < a href = "DetailsList.cfm? ID = #getProduct.ID # & litm = #getProduct.LITM #" > VIEW < /a > DETAILS
    < table >

    < cfif getProduct.currentRow MOD 2 EQ 0 >
    < /tr >
    < cfset newrow = true >
    < cfelse >
    < cfset newrow = false >
    < / cfif >


    < / cfoutput >
    < /tr >
    < /table >

    The currentRow always property will count the number or records in the record setting loop, if you their output or not.

    Since you are not the output values for each record in the Recordset, you must count the itterations yourself.

    Put a meter of itteration before the loop.

    Update the counter at the top of the loop.

    OR on newer versions of CF

    Reset the counter in the true clause of the block, where you also define new line. >

    Then use the variable in the iit instead the currentRow property to determine the number of items have been posted.

    **** OR ****

    You could do a simple SQL command does not get duplicates first and then use a loop of simple without any of the grouping and additional logic that you do.

    
    
    SELECT DISTINCT *
         FROM ecitm
         WHERE DSC1 <> ' '
         ORDER BY DSC1
    
    
    
    
         #DSC1#
         
    
        
    
    
    
  • How can I extract the data from a csv file and insert it into an Oracle table? (UTL_FILE)

    Hi, please help me whit this query

    Im trying to extrate the data in a file csv and im using the ULT_FILE package
    I have this query that read the file and the first field, but if the field has a different length does not work as it should

    For example if I had this .csv file:

    1, book, laptop

    2, pen, Eraser

    3, notebook, paper

    And in the table, I had to insert like this

    ID descrption1 description2

    laptop 1 book

    Eraser pen 2

    paper laptop 3

    For now, I have this query, which displays only with DBMS:

    Declare

    -Variables

    Cadena VARCHAR2 (32767).

    Vfile UTL_FILE. TYPE_DE_FICHIER;

    Dato varchar2 (200);                                             -Date

    dato1 varchar2 (200);

    dato2 varchar2 (200);

    Identifier varchar2 (5): = ', ';                             -Identifier (en)

    v_ManejadorFichero UTL_FILE. TYPE_DE_FICHIER;     -For exceptions

    -Table variables

    I_STATUS GL_INTERFACE. % OF STATUS TYPE.

    I_LEDGER_ID GL_INTERFACE. TYPE % LEDGER_ID;

    I_USER_JE_SOURCE_NAME GL_INTERFACE. TYPE % USER_JE_SOURCE_NAME;

    I_ACCOUNTING_DATE GL_INTERFACE. TYPE % ACCOUNTING_DATE;

    I_PERIOD_NAME GL_INTERFACE. TYPE % PERIOD_NAME;

    I_CURRENCY_CODE GL_INTERFACE. CURRENCY_CODE % TYPE;

    I_DATE_CREATED GL_INTERFACE. DATE_CREATED % TYPE;

    I_CREATED_BY GL_INTERFACE. CREATED_BY % TYPE;

    I_ACTUAL_FLAG GL_INTERFACE. TYPE % ACTUAL_FLAG;

    I_CODE_COMBINATION_ID GL_INTERFACE. TYPE % CODE_COMBINATION_ID;

    I_ENTERED_DR GL_INTERFACE. TYPE % ENTERED_DR;

    I_ENTERED_CR GL_INTERFACE. TYPE % ENTERED_CR;

    I_ACCOUNTED_DR GL_INTERFACE. TYPE % ACCOUNTED_DR;

    I_ACCOUNTED_CR GL_INTERFACE. TYPE % ACCOUNTED_CR;

    I_TRANSACTION_DATE GL_INTERFACE. TRANSACTION_DATE % TYPE;

    I_REFERENCE1 GL_INTERFACE. REFERENCE1% TYPE;

    I_REFERENCE2 GL_INTERFACE. REFERENCE2% TYPE;

    I_REFERENCE3 GL_INTERFACE. REFERENCE3% TYPE;

    I_REFERENCE4 GL_INTERFACE. REFERENCE4% TYPE;

    I_REFERENCE5 GL_INTERFACE. REFERENCE5% TYPE;

    I_REFERENCE10 GL_INTERFACE. REFERENCE10% TYPE;

    I_GROUP_ID GL_INTERFACE. GROUP_ID % TYPE;

    BEGIN

    Vfile: = UTL_FILE. FOPEN ('CAPEX_ENVIO', 'comas.csv', 'R');

    loop

    UTL_FILE. GET_LINE(Vfile,Cadena,32767);

    dato1: = substr (cadena, instr(cadena, identificador,1,1)-1, instr(cadena, identificador,1,1)-1);

    dato2: = substr (cadena, instr (cadena, identifier, 1, 1) + 1, instr(cadena, identificador,3,1)-3);

    dbms_output.put_line (dato1);

    dbms_output.put_line (dato2);

    -The evidence

    -dbms_output.put_line (cadena);

    -dbms_output.put_line (substr (dato, 3, instr(dato, identificador,1,1)-1));

    -dbms_output.put_line (substr (dato, instr (dato, identifier, 1, 2) + 1, instr(dato, identificador,1,1)-1));

    -dbms_output.put_line (substr (cadena, 1, length (cadena)-1));

    end loop;

    UTL_FILE. FCLOSE (Vfile);

    -----------------------------------------------------------------------------------EXCEPTIONS------------------------------------------------------------------------------------------------------------------------------------------------------------

    EXCEPTION

    When no_data_found then

    dbms_output.put_line ('Todo Correcto');

    When utl_file.invalid_path then

    UTL_FILE. FCLOSE (V_ManejadorFichero);

    RAISE_APPLICATION_ERROR (-20060,'RUTA DEL ARCHIVO NULLIFIED: (');)

    WHEN UTL_FILE. INVALID_OPERATION THEN

    UTL_FILE. FCLOSE (V_ManejadorFichero);

    RAISE_APPLICATION_ERROR ('-20061,'EL ARCHIVO NO PUDO SER ABIERTO ");

    WHEN UTL_FILE. INVALID_FILEHANDLE THEN

    UTL_FILE. FCLOSE (V_ManejadorFichero);

    RAISE_APPLICATION_ERROR (-20062, 'INVALIDO MANAGER');

    WHEN UTL_FILE. WRITE_ERROR THEN

    UTL_FILE. FCLOSE (V_ManejadorFichero);

    RAISE_APPLICATION_ERROR (-20063, 'ESCRITURA ERROR');

    WHEN UTL_FILE. INVALID_MODE THEN

    UTL_FILE. FCLOSE (V_ManejadorFichero);

    RAISE_APPLICATION_ERROR (-20064, 'MODO INVALIDO');

    WHEN UTL_FILE. INTERNAL_ERROR THEN

    UTL_FILE. FCLOSE (V_ManejadorFichero);

    RAISE_APPLICATION_ERROR (-20065, 'ERROR INTERNO');

    WHEN UTL_FILE. READ_ERROR THEN

    UTL_FILE. FCLOSE (V_ManejadorFichero);

    RAISE_APPLICATION_ERROR (-20066, 'LECTURA ERORR');

    WHEN UTL_FILE. FILE_OPEN THEN

    UTL_FILE. FCLOSE (V_ManejadorFichero);

    RAISE_APPLICATION_ERROR ('-20067,'EL ARCHIVO ARE ESTA ABIERTO ");

    WHEN UTL_FILE. THEN ACCESS_DENIED

    UTL_FILE. FCLOSE (V_ManejadorFichero);

    RAISE_APPLICATION_ERROR (-20068, 'REFUSED ACCESS');

    WHEN UTL_FILE. DELETE_FAILED THEN

    UTL_FILE. FCLOSE (V_ManejadorFichero);

    RAISE_APPLICATION_ERROR (-20069, 'OPERACIÓN BORRADO FALLO');

    WHEN UTL_FILE. RENAME_FAILED THEN

    UTL_FILE. FCLOSE (V_ManejadorFichero);

    RAISE_APPLICATION_ERROR (-20070, 'OPERATION SOBREESCRITURA FALLO');

    END;

    Hello

    Try something like this:

    POS1: = INSTR (cadena, idntificador, 1, 1);
    POS2: = INSTR (cadena, idntificador, 1, 2);

    ID: = SUBSTR (cadena, 1, pos1 - 1);
    description1: = SUBSTR (cadena, pos1 + 1, (pos2 - pos1)-1);
    Description2: = SUBSTR (cadena, pos2 + 1);

    where pos1 and pos2 are numbers.

    Rather than use UTL_FILE, consider creating an external table.  You won't have to write any PL/SQL, and this means that you won't be tempted to write a bad article of EXCEPTION.

  • Is it to extract data from a database and insert it into a session variable?

    $_SESSION ['Stud_FirstName'] = $row_rs_Login ["Stud_FirstName"];

    because it is not work. I swear to you that the more I learn, the less I know.

    What to do to change?

    Thank you!

    Yes. However, the recordset must exist before you can assign value to another variable. The last line of code that creates a recordset object looks like this:

    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    

    If you attempt to create the variable session before this line, as you are, I suspect, is not really surprising that it does not work.

    Even if you don't want to write all the code yourself, you must understand the code that Dreamweaver is written for you. Otherwise you will be constantly bumping your head on the keyboard. A PHP script is executed from top to bottom, and the flow of the script is controlled by loops and conditional statements. Get your head around these concepts, and you can find customizing Dreamweaver code much easier.

Maybe you are looking for