That's why inserting another extra value?

Hello

I have create this procedure.

create or replace procedure proc_test (v2 in varchar2)
as
r sys_refcursor;
VARCHAR2 (10) v1.
Start
Open r for
Select regexp_substr (v2, ' [^,] +', 1, level ") of the double
connect regexp_substr (v2, ' [^,] +', 1, level ') is not null;
loop
extract the r in v1;
Insert in the test
values (v1);
out when are % notfound;
end loop;
Close r;
end;

I'm passing values-

Start
proc_test ('a, b');
end;

PL/SQL procedure successfully completed.

SQL > select * from test;

V
-
one
b
b


That's why inserting another extra value?

Concerning

Hello

Put your exit when are % notfound; BEFORE your insert statement and try again...

Kind regards

Robert.

Tags: Database

Similar Questions

  • Avoid to insert a short value in column with friendly notification

    Hi all

    I've got table with column 'mobile phone '. My need is to avoid inserting too short values (normal duration is 9). Also the user should receive easy to use, why he or she can't insert a value that is too short. How can I make it?

    Thanks in advance.

    CREATE TABLE 'SCHEMENAME '. "" CELL PHONES. "

    ('ID' (32 BYTE) CHAR by DEFAULT sys_guid(),

    'MOBILE PHONE' NUMBER (9.0).

    "DESCR" VARCHAR2 (1000 BYTE),

    'STATE' NUMBER (5.0) DEFAULT 0,

    "CREATED" DATE default sysdate,

    "CREATEDBY" VARCHAR2 (1000 BYTE),

    DATE 'DAY. '

    "UPDATEDBY' VARCHAR2 (1000 BYTE)

    );

    Hello

    You can use a trigger to achieve

    for example

    CREATE OR REPLACE TRIGGER SCHEMENAME.TR_CELLPHONES

    BEFORE INSERT OR UPDATE ON SCHEMENAME. CELL PHONES

    FOR EACH LINE

    DECLARE

    BEGIN

    IF length(:new.) MOBILE PHONE)<>

    THEN

    RAISE_APPLICATION_ERROR ("-20101, ' the phone is too short!");

    ROLLBACK;

    END IF;

    END;

    /

    Concerning

  • XML contains some records that must be inserted and some updates

    Hello

    I get an XML that contains documents that I need to insert into a table of ABC.

    It's some of the files in the xml file are already present in the table ABC (that's why I get unique key constraint error). I update the records instead of inserting it.

    How to differentiate records of new records and create a separate xml and update in the ABC table?

    Hello

    Use a MERGE statement, whose source is the result of a XMLTable.

    Something like that, in pseudocode:

    MERGE INTO target_table t
    USING (
      SELECT x.pk_id, x.col1, x.col2, ...
      FROM XMLTable(
             '/root/record'
             passing my_xml_doc
             columns pk_id number       path 'ID'
                   , col1  varchar2(30) path 'COL1'
                   , col2  varchar2(30) path 'COL2'
                   , ...
           ) x
    ) src
    ON ( t.pk_id = src.pk_id )
    WHEN MATCHED THEN UPDATE
     SET t.col1 = src.col1
       , t.col2 = src.col2
       , ...
    WHEN NOT MATCHED THEN INSERT
     (pk_id, col1, col2, ...)
     VALUES ( src.pk_id, src.col1, src.col2, ...)
    ;
    
  • How is it that when I insert my sd card it opens Photos rather then opening as it is implemented

    Why is that, when I insert my sd card it opens opening instead of Photos? How can I change this?

    If Photos open, when you insert the card, turn off the box "open pictures for this..." ».  This check mark is below the toolbar on the left of the window.

    The next time you insert the card, pictures won't open (until you reformat the card in the camera).

    In opening preferences, select the preference "import: when a camera is connected, open aperture.

  • How to create a formula that highlights the cell that contains the same data that I type in another cell

    Hi, can someone help me make a formula which detects and highlights the value of the cell that contains the items of data that I entered in another cell? Thank you

    resolved to myself

  • Insert the new value in existing csv file

    Hello

    I have a CSV file that I created using a totalizer. now I need to insert this string values by searching the line

    For example:-first column is date so I'll look for the date and insert comment for her

    attached the CSV file


  • In the Xbox box, family cannot see my see and when he tried to add me error "he says that I am in another family."

    * Original title: Why can't my parents see me?

    Why when I open the family on the Xbox, I see my father-in-law in my family, but when he looks at the family, he can't see me, and when he tries to add me, he said that I am in another family.          

    I'm confused, please help.

    Hello

    Your Question is beyond the scope of this community...

    I suggest that repost you in the Xbox Forums.

    "Xbox a Preview program FAQ.

    http://support.Xbox.com/en-us/Xbox-one/system/Xbox-update-preview-FAQ

    'Home'

    http://forums.Xbox.com/

    "Xbox forums.

    http://forums.Xbox.com/xbox_forums/general_discussion/f/3817.aspx

    _________________________________________________

    "Xbox Forums directory.

    http://www.Xbox.com/en-us/forums

    General

    Material & Discussion Services

    Xbox support
    Agent hours: M - F 09:00-17:00 PT

    Law enforcement forums

    Technical support of Xbox Live rewards
    Xbox Live rewards Squad hours: M - F 09:00-17: 00 PST

    See you soon.

  • Ask the lines that correspond fully to another column

    Hi all

    Take into consideration the following 11 g:

    CREATE TABLE X_A (COL1 NUMBER, COL2 NUMBER);
    create table x_b (col1 number);
    
    INSERT INTO X_A VALUES (1,2);
    insert into x_a values (1,3);
    INSERT INTO X_A VALUES (2,2);
    INSERT INTO X_B VALUES (2);
    insert into x_b values (3);
    

    I want to interview table X_A only these col1 that match all records in X_B (i.e. value equal to '1').

    If I join the 2 tables by x_a.col2 - x_b.col1 I have two values 1 and 2 col1. But I want only 1 to appear because it contains 2.3 in x_b.col2

    Any ideas?

    Kind regards

    Stoyanov

    Join partition using

    select col1, col2
      from (
            select a.col1, a.col2, count(a.col2) over(partition by a.col1) cnt1, count(b.col1) over(partition by a.col1) cnt2
              from x_b b
              left join x_a a partition by (a.col1)
                on a.col2 = b.col1
           )
     where cnt1 = cnt2
    
  • insertion of unique values as well as the value of the sequence

    Hello gurus,

    I need to copy values from table A to table B as well as the value of the sequence.

    Please find the scripts below.

    -Table A and insert

    create a (varchar2 (40) of ename, space job_id varchar2 (40));

    insert into a values ('Suri', 'THIS');

    insert into a values ('Suri', 'THIS');

    insert into a values ('ABC', 'Admin');

    -Creation of table B

    create table B (number empno, ename varchar2 (40), job_id varchar2 (40));

    -sequence to fill data in table B empno

    create sequences b_empno_seq.

    Requirement is that we need fill out the unique values in table A in table B as well as the sequence (for the empno column) value

    Please find below the insert and update statements I tried below.

    Please let me know if we have a better approach

    INSERT INTO B (ename, job_id)

    SELECT DISTINCT ename, job_id

    A.;

    UPDATE b b1

    SET empno = b_empno_seq. NEXTVAL

    WHERE ename in (SELECT ename b B2 WHERE b2.ename = b1.ename);

    -Suri ;-)

    INSERT INTO B

    () AS T

    SELECT DISTINCT ename,

    job_id

    A

    )

    SELECT b_empno_seq.nextval,

    Ename,

    job_id

    T

    /

    SY.

  • I created a form to complete 4 page. I would like to place a button at the bottom of page 4 when you click inserts another copy of the form in the existing file. I have the user to have the ability to easily create muliple copies of the same 4 pages in

    I created a form to complete 4 page in Acrobat. I would like to place a button at the bottom of page 4 when you click inserts another copy of the form in the existing file. I want the user to have the ability to easily create multiple copies of the same 4 pages in a single file. It is possible with Acrobat? I use a PC.

    It is possible using models and JavaScript, but if it is to work with the player, users will need to use the desktop version (Windows/Mac) of 11 Reader or CD player. Here is a link to an older article which explains the basics: Planet PDF - a lesson in the templates for Adobe Acrobat

    Note that this is a bit outdated, but it should help you get started. If you have any other questions, post them in the Acrobat JavaScript here forum: JavaScript

  • Adobe metadata Muse - I was put in the description, the customer wants to appear in the search through properties of the Page engines &gt; metadata &gt; description and nothing changes. I'm not a coder, that I'm a Designer, that's why I love Muse so much,

    -Metadata I was put in the description, the customer wants to appear in the search through properties of the Page engines > metadata > description and nothing changes. I'm not a coder, I'm a Designer, that's why I love Muse so much, but it is a real problem. any help would be appreciated. I watched the tutorial by Dani Beamount already it was very clear but his does not work for me

    What Miss me?

    That you expect your customer as a 'change' ?

    Google does not use the Description so much more. You can always add it, and it might be useful to other search engines and other purposes. But Google structured content, good keywordsand values a good title !

  • How can I insert an empty value not in loop of mySQL

    How can I prevent my loop to try to insert an empty value in the mySQL database? The form that I use has four lines were created automatically. If they only meet in three lines that I have problems with the fourth row is empty.  Here is my code that works fine as long as they don't leave an empty field.

    < cfloop to = "#form.numba # '1' = ' index 'idx' = >"

    < cfset getqty form ["Qty" & idx] = >

    < cfset getitem form ["item" & idx] = >

    < cfset getunit form ['unit' & idx] = >

    < cfset gettotal form ['total' & idx] = >

    < name cfquery = "insertItems" datasource = "#application.dsn #" >

    INSERT in Articles

    (orderID,

    quantity,

    agenda,

    Unit,

    total

    )

    VALUES)

    < cfqueryparam value = "" #getoid # "CFSQLType ="CF_SQL_INTEGER">,"

    < cfqueryparam value = "" #getqty # "CFSQLType ="CF_SQL_INTEGER">,"

    < cfqueryparam value = "" #getitem # "CFSQLType ="CF_SQL_VARCHAR">,"

    < cfqueryparam value = "" #getunit # "CFSQLType ="CF_SQL_INTEGER">,"

    < cfqueryparam value = "" #gettotal # "CFSQLType ="CF_SQL_INTEGER">"

    )

    < / cfquery >

    < / cfloop >

    Thanks in advance.

    The user can omit one of the lines, not necessarily the last population. In fact, it can fail to complete the entire form.

    The best solution is to validate the data prior to the insertion of the database. For example, you can see empty lines as follows

  • Insert another page in the same format in AI?

    I'm with have. The file contains several pages. How can I insert another page in the same format?

    'pages' are plans of work in artificial intelligence. Use the tool of work plan to add or modify existing relationships. Although I'm not entirely sure that's what you hear.

  • best way to find the maximum value that is less than a specific value?

    Hello guys,.

    What is the fastest way to find a record that has value max of a field and there is a limitation to a specific value for ex:

    example 1:
    create table dummy(master_id number, detail_id number, some_value varchar2(80));
     
    insert into dummy values (1,1,'bla bla1');
    insert into dummy values (1,2,'bla bla2');
    insert into dummy values (1,3,'bla bla3');
    insert into dummy values (2,1,'bla bla4');
    insert into dummy values (2,2,'bla bla5');
    insert into dummy values (2,3,'bla bla6');
    insert into dummy values (2,4,'bla bla7');
    commit;
    I want to get:
    1 3 bla bla3
    2 4 bla bla7
    And these applications give a correct result:
    Select * 
    from   dummy d1
    where  detail_id = (select max(detail_id) from dummy d2 where d2.master_id = d1.master_id);
     
    OR next one which i prefered.
     
    Select *
    From   (Select d1.* , row_number() over(partition by master_id order by detail_id desc) r
            from   dummy d1)
    Where  r = 1;
    If these solutions are enough or is there a better way?

    Edited by: elcaro on 13.Ara.2011 04:02

    Edited by: elcaro on 14.Ara.2011 04:31

    Please try this with your new test tables:

    select m.master_id,
           m.master_data,
           max(d.id) keep (dense_rank last order by data_value, d.id) d_id,
           max(d.master_id)  keep (dense_rank last order by data_value, d.id) d_master_id,
           max(data_value) keep (dense_rank last order by data_value, d.id) d_data_value,
           max(date_data)  keep (dense_rank last order by data_value, d.id) d_date_data
    from master_dummy m, detail_dummy d
    where m.master_id=d.master_id
    and d.date_data <= to_timestamp('04012010','ddmmyyyy')
    group by m.master_id, m.master_data
    

    Published by: hm on 14.12.2011 05:18

    (I added d.id column in the order by the dense_rank. clause that could make a difference when there is more than one line with the same data_value).

  • for-each@cell inserts an extra empty column

    HI Experts,
    I use for-each@cell to be able to display columns of a report in excel. But this sentence, inserts an extra empty column in the report. Is it possible to get rid of this empty column.

    Thank you
    Swarna

    You can have so that it ignores the empty columns

Maybe you are looking for