Procedure to insert several lines

create or replace procedure relevent_doc_after_insert (JOBNUMBER IN varchar2,
DOCNAME IN VARCHAR2)
IS
PRAGMA AUTONOMOUS_TRANSACTION;
vDocName VARCHAR2 (80);

CURSOR insertAfterdata
IS
SELECT mnd_doc_name
OF clm_min_doc_to_process
WHERE mnd_doc_name! = DOCNAME;


BEGIN
OPEN insertAfterdata.
LOOP
EXTRACTION insertAfterdata
IN
vDocName;

EXIT WHEN insertAfterdata % NOTFOUND;

INSERT INTO clm_relevent_doc (rd_id,
rd_job_no,
rd_doc_name,
rd_created_user,
rd_created_date,
rd_status)
VALUES (relevant_doc_sequence. NEXTVAL,
JOBNUMBER,
vDocName,
'system ', he said.
To_char (SYSDATE, "yyyy-mm-dd HH12:MI:SS"),
'pending');

COMMIT;
END LOOP;
CLOSE InsertAfterdata;

EXCEPTION
WHILE OTHERS THEN
NULL;

END;



Above is my procedure

I pass below the settings during the execution
JOBNUMBER = 123
DOCNAME = driving licence



When the CURSOR query get the 3rows as a result but insert several rows in the clm_relevent_doc table, why did this happen.

It does not work properly, is it not? If this isn't the case, then please point where.

Also as knani questioned, and so I did (although not confirmed), you really need the independent transaction? can you justify using autonomous transactions, in this procedure?

select *
  from clm_min_doc_to_process;

MND_ID                 MND_DOC_NAME       MND_DOC_CODE
---------------------- ------------------ --------------------
1                      Driving Licence    DL
2                      SA Report          SARPT
3                      Estimate           EST
4                      Photos             PHOT    

select *
  from clm_relevent_doc;

RD_ID                  RD_JOB_NO       RD_DOC_NAME    RD_CREATED_USER   RD_CREATED_DATE  RD_ADD_DOC_NAME  RD_UPDATE_USER   RD_REQUEST RD_REQUEST_METHOD RD_STATUS RD_RECEIVED_DATE_TIME
---------------------- --------------- -------------- ----------------- ---------------- ---------------- ---------------- ---------- ----------------- --------- --------------------- 

set serveroutput on;
begin
  relevent_doc_after_insert(123, 'Photos');
end;

anonymous block completed
3 rows inserted

select *
  from clm_relevent_doc;

RD_ID                  RD_JOB_NO       RD_DOC_NAME     RD_CREATED_USER RD_CREATED_DATE     RD_ADD_DOC_NAME RD_UPDATE_USER RD_REQUEST RD_REQUEST_METHOD RD_STATUS RD_RECEIVED_DATE_TIME
---------------------- --------------- --------------- --------------- ------------------- --------------- -------------- ---------- ----------------- --------- ---------------------
1                      123             Driving Licence system          2013-01-21 06:43:23                                                             pending
2                      123             SA Report       system          2013-01-21 06:43:23                                                             pending
3                      123             Estimate        system          2013-01-21 06:43:23                                                             pending                        

Tags: Database

Similar Questions

  • Insert several lines in trigger?

    can someone tell me how can I insert several lines in a trigger. I tried several ways, and so far nothing works.

    create or replace

    USER_GROUPS_TRIG RELAXATION

    before INSERT ON USER_GROUPS

    FOR EACH LINE

    DECLARE

    number of max_id;

    BEGIN

    SELECT TO_NUMBER (new_id) + 1 as new_id in max_id OF NEW_ID_VW;

    INSERT THE TBL1

    (USER NAME)  VALUES

    (max_id,: NEW.) (NEW); -It works very well and needs no adjustment, 1 inserted row.

    MERGE INTO GROUP_MAPPING HAS

    USING (SELECT USER_ID, GROUP_ID ADMIN_GROUPS_VW) B

    ON (A.USER_ID = B.USER_ID)

    WHEN NOT MATCHED THEN

    INSERT (A.USER_ID, A.GROUP_ID)

    values (b.user_id, b.group_id);

    -FOR V IN 1.10 IN LOOP

    -INSERTION IN GROUP_MAPPING (user_id, group_id)

    -(select user_id, group_id from admin_groups_vw);

    -END LOOP;

    -INSERT IN GROUP_MAPPING

    --(USER_ID, GROUP_ID) VALUES

    -(max_id, (select group_id from admin_groups_vw));

    -None of these POPs an error, just does not have the insert (there are several records, so there should be several inserted rows), I tried to insert, loop and fusion.

    END;

    Thanks for any help.

    Hello

    Whenever you have a problem, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements) of all the tables involved, so that people who want to help you can recreate the problem and test their ideas.

    Also post the exact results you want from this data, as well as an explanation of how you get these results from these data, with specific examples.

    If you ask on a DML statement, such as CREATE TABLE, INSERT, INSERT statements must re-create the tables as they are to the DML, and the results will be the content of the or a modified tables when it's all over.

    In this case, after complete relaxation and a DML statement that triggers, too.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: Re: 2. How can I ask a question on the forums?

    Is admin_groups_vw a notice?  This it is, and the view depends on the table you are inserting (user_groups), then you will get a runtime error because the picture is changing.  A FOR EACH ROW trigger on user_groups can't question user_groups.  You said: "none of these POPs an error", but are you sure you're not getting a runtime error and just hide?

  • Insert several lines with dynamic data

    Hello
    When I do an insert into a table that has several lines of dynamic information. on
    a page, it inserts all rows that are dynamically filled. I want only what he
    to insert the lines that I choose the initials on. How can I do? Let's say I
    have 5 items that are displayed on a page and I want to insert only original
    the first 2 because the last 3 are left blank, how should I do this? I tried
    implementation of an if statement that says:

    < cfif "form. "Help of # PNR_Approval_Initials #" NEQ "" > "".

    Then make the insertion in the table

    < cfelse >
    < / cfif >

    I have this game were also up in a loop that says:

    < cfloop index = "help" list = "" #form.listofids # "delimiters =",">"

    Here is the code for just the insertion. I also have a code here
    Update another table. I got this to work, so I just try to get the insertion
    works fine for the moment. I can not use this where the query statement:
    Where ItemID = #id # because I'm trying to insert into the table of approval, not
    the items table. The table is just updated with some other info. in
    a few other input boxes.

    < cfloop index = "help" list = "" #form.listofids # "delimiters =",">"
    < cfif "form. "Help of # PNR_Approval_Initials #" NEQ "" > "".

    < cfquery Datasource = '#application. DataSource #">"
    Insert into accreditation (APV_ItemID,
    APV_ECID,
    Document_Type,
    Approval_Initials)

    Values (' #Evaluate ("form.) (' ItemID # help # ") #',
    ' #Evaluate ("form. ("ECID # help #") #',
    < cfif isDefined (form '. ') ("Help of # PNR_Doc_Type # ') and
    "form. "Help of # PNR_Doc_Type #" NEQ "" > "".
    ' #Evaluate ("form. ("Help of # PNR_Doc_Type # ') #',
    < cfelse >
    NULL,
    < / cfif >

    < cfif isDefined (form '. ') ("Help of # PNR_Approval_Initials # ') and
    "form. "Help of # PNR_Approval_Initials #" NEQ "" > "".
    ' #Evaluate ("form. (Aide de # PNR_Approval_Initials #») #
    < cfelse >
    Null value
    (< / cfif >)

    < / cfquery >

    < / cfif >
    < / cfloop >

    On the page display, just a table of dynamic info. Here are the 4
    things that I have on this page that needs to be inserted to the database.

    < input type = "hidden" name = "' ECID #ItemID #" value = "#ECID #" > "
    < input type = "hidden" name = "' ItemID #ItemID #" value = "#ItemID #" > "
    < input type = "hidden" name = "" PNR_Doc_Type #ItemID # ' value = "PNR Req" > "

    < td align = "center" >
    < cfif Approval_Initials is not "" > "".
    #Approval_Initials #.
    < cfelse >

    < select name = "PNR_Approval_Initials #ItemID #" >
    < option value = "" > select initials < / option >
    < cfloop query = "ShowInitials" >
    < Cfif Engineer_Initials EQ 1 >
    < option value = "#Initials #" > #Initials # < / option >
    < / cfif >
    < / cfloop >
    < / select >

    < / cfif >
    < table >

    Can someone help me please on just the insertion in the database so that it
    will insert on the lines that I chose the initials on and not others? Thank you.

    Andy

    You almost managed, but I see that you have commented.

    (" The help of # PNR_Approval_Initials # ') AND form ["PNR_Approval_Initials # help #" ""] NEQ "" >

    Do things here

  • Insert the statement with the subquery to insert several lines

    Hi friends,

    Please find below mentioned query and error. Also suggest me to go forward.

    SQL > INSERT INTO FM_TRAN_DOC_NO (TDOC_COMP_CODE,

    2 TDOC_TRAN_CODE,

    TDOC_ACNT_YEAR 3,.

    TDOC_CUR_NO 4,.

    TDOC_MAX_NO 5,.

    TDOC_CAL_YEAR 6,.

    TDOC_PERIOD 7,.

    TDOC_DIVN_CODE 8,.

    TDOC_DEPT_CODE 9,.

    TDOC_CR_UID 10,

    TDOC_CR_DT 11,

    TDOC_UPD_UID 12,

    13 TDOC_UPD_DT)

    14 SELECT '001',

    15 (SELECT DISTINCT FM_TRAN_DOC_NO TDOC_TRAN_CODE

    16               '6',

    17               '0',

    18 '9999',

    19 NULL,

    20 NULL,

    21 NULL,

    22 NULL,

    23 "AGT,"

    24 TO_DATE (SYSDATE),

    25 NULL,

    26 TO_DATE (SYSDATE) FROM DUAL;

    (SELECT DISTINCT FM_TRAN_DOC_NO TDOC_TRAN_CODE),

    *

    ERROR on line 15:

    ORA-01427: einreihig subquery returns multiple rows

    +Untested.

    When values except 'TDOC_TRAN_CODE' are hardcoded, there is no need to select double.

    Something like that?

    INSERT INTO FM_TRAN_DOC_NO)

    TDOC_COMP_CODE,

    TDOC_TRAN_CODE,

    TDOC_ACNT_YEAR,

    TDOC_CUR_NO,

    TDOC_MAX_NO,

    TDOC_CAL_YEAR,

    TDOC_PERIOD,

    TDOC_DIVN_CODE,

    TDOC_DEPT_CODE,

    TDOC_CR_UID,

    TDOC_CR_DT,

    TDOC_UPD_UID,

    TDOC_UPD_DT

    )

    SELECT DISTINCT

    '001',

    TDOC_TRAN_CODE,

    « 6 »,

    '0',

    "9999",

    NULL,

    NULL,

    NULL,

    NULL,

    "AGT,"

    TO_DATE (SYSDATE),

    NULL,

    TO_DATE (SYSDATE)

    OF FM_TRAN_DOC_NO;

  • Need help to insert several lines using PL/SQL

    Hi gurus,

    I wrote a simple PL/SQL to insert the recrods in a table. It works fine if the sql script that is stored in the column to the table TEST_VALIDATION SCRIPT returns a single line. Can you get it someone please let me know a better way to insert multiple results returned by the script? Rest columns can be duplicated.

    DECLARE

    p_rows default NUMBER of 0;

    CURSOR C1_TV
    IS
    SELECT ID, DESCRIPTION, TEST_VALIDATION SCRIPT;

    BEGIN

    FOR C1_TV_REC in C1_TV
    LOOP

    Run immediate C1_TV_REC. SCRIPT in p_rows;

    INSERT INTO THE VALIDATION
    (END_DATE,
    VALIDATION_ID,
    VALIDATION_DESCN,
    VALIDATION_COUNT
    )
    VALUES
    (
    (select sysdate to DOUBLE),
    C1_TV_REC.ID,
    C1_TV_REC. DESCRIPTION,
    p_rows
    );

    COMMIT;

    END LOOP;

    END;
    /

    Please let me know if this isn't clear.

    Thank you
    Shash

    You need something like that

    declare
      p_rows dbms_sql.number_table;
      i pls_integer;
    begin
      execute immediate SCRIPT bulk collect into p_rows;
      i:=1;
      loop
        exit when i>p_rows.count;
        insert... p_rows(i)....
        i:=i+1;
      end loop;
    end;  
    

    or the much faster method (if it works in your case)

    declare
      p_rows dbms_sql.number_table;
      i pls_integer;
    begin
      execute immediate SCRIPT bulk collect into p_rows;
      forall i in p_rows.first..p_rows.last
         insert into table (field) values (p_rows(i));
    end;  
    

    And why you use

    (select sysdate from DUAL)
    

    Just use

    sysdate
    

    Published by: Oleg Gorskin the 12.01.2010 06:51
    Add method with forall

  • Insert several lines of table1 from table2

    $selectSQL = sprintf ("SELECT * FROM 'completetransaction'")

    WHERE "merchant_id" = %s

    (AND "com_tran_date" = %s", GetSQLValueString ($merchantid,"text"), GetSQLValueString ($tran_com_date, 'date'));

    $Result1 = mysql_query ($selectSQL, $conn) or die (mysql_error ());

    for example, the above query returns two rows

    How can I insert it to table (deposit_transaction) another

    How should I fetch the data from the query above and insert it into deposit_transaction.

    If I need to use the loop... How should I build it

    $insertSQL = sprintf ("INSERT INTO ' deposit_transaction'('transactionid', 'merchantid', 'quantité', 'rolling_reserve', 'tdr', 'merchant_money', 'depositdate') VALUES (%s, %s, %s, %s, %s, %s %s)", GetSQLValueString ($transactionid, "int"), ")

    GetSQLValueString ($merchantid, "text"),

    GetSQLValueString ($amount, "int"),

    GetSQLValueString ($rr, "int"),

    GetSQLValueString ($tdr, "int"),

    GetSQLValueString ($mm, "int"),

    GetSQLValueString ($depositdate, 'date'));

    $Result1 = mysql_query ($insertSQL, $conn) or die (mysql_error ());

    Looks good except that your SELECT statement does not include the column 'depositdate' the insertion fails. Fix that and it should work.

    I also ask you to standardize on your database table and column name conventions. You have some with underscores and other free features. It should be consistent. Also, make sure that your column names clearly have their meaning. That means "tdr"?

  • Insert several lines of Radio button

    I need to do multiple inserts in an Access table from a form her you choose multiple of any number of questions answers. As the fields of the form are radio buttons I can't loop through a list to process inserts. I'm struggling with the creating a loop to do inserts since each form field response boxes each has a different/unique name. Any suggestions on how to configure the loop would be appreciated. Here is a code example.

    The solution that solved the problem is the code "["Answer"& loop] #orm # I initially tried "#form." Answer ' & loop # ", but once I applied your code, the loop worked fine.
    Thanks for the help.

  • Database Connectivity Toolkit (insert multi line)

    Hi all. I recently got the toolkit of connectivity (DBCT) database on LabVIEW 2016 and I try to insert several rows in a database.

    Using a sine signal input I tried to insert 50 rows in an iteration, but each method I tried returned 50 values in a line. The end of the constant of the line and table using chain worksheet, returned what looked like 50 lines, but when I questioned "SELECT COUNT (*) FROM... "the number of rows equals the number of iterations.

    On another post on the forum, someone suggested that it is not possible to insert several lines using the DBCT. Can anyone confirm this?

    I wrote a code that allows me to insert 3 rows in an iteration, under a single connection. However, this method is very time consuming and would not work for large amounts of data.

    Can anyone think of a better way to do it?

    Thanks in advance,

    Lisa

    Create your own query, and use the query execute VI.

  • How to insert multiple lines using a single query

    Hi all

    How to insert multiple lines using a single query to the emp table?
    I have the number of rows to insert into table x. consumes a lot of time. I tried to insert several lines using a single query, but get errors. I know exactly the query to do this.


    Thank you
    Sunil

    Like this?

    SQL> create table test(id number , dt date);
    
    Table created.
    
    SQL> insert into test values(&a,&b);
    Enter value for a: 1   --- It asked me and I entered 1
    Enter value for b: sysdate  --- It asked me and I entered sysdate
    old   1: insert into test values(&a,&b)
    new   1: insert into test values(1,sysdate)
    
    1 row created.
    
    SQL> 
    

    g.

  • How to insert a line checked several

    Hi friends,

    IM facing a scenario. Let me explain.

    I have a page with a report and a button (these two in a homepage).

    I have a tabular presentation based on a table that opens in a pop-up window by pressing a button located on the home page. In this sick in tabular form be select several lines and if I press Add button in the pop - up, then all the lines checked must insert in the table report located in the home page.

    How can I achieve this.

    Can someone help me with this problem.

    Brgds,
    Mini

    Mini,

    I've updated my example for you.

    There are several ways to accomplish what you're looking for, here are two options:
    1. make an ajax call on beforerefresh pop-up report.
    2 persists the values checked in a page element and use it instead of an array.

    In my example, I used the second option. Instead of using an item hidden, I used a text field you can see the selected values. Here are the changes I made:

    1. Add a new region and an article about her, I called my article "P33_SELECTED_WIDGETS".
    2. in the declarations of global variables in your definition of the page, add the following text:

        var pkArray = [];
    

    3. change the report query to refer to the element on the page and ensure that the State of the check box reflects the values that you have seaved in your page element.

    select
        SEQ,
        APEX_ITEM.CHECKBOX2(
          2,
          SEQ,
          'class="pk-selector" ' || SEQ_CHECK
        ) SEQ_CHECK,
        NAME,
        READY_DATE,
        COMMENTS
      from(
          select
              SEQ,
              case
                 when instr(':' || :P33_SELECTED_WIDGETS || ':',
                            ':' || SEQ || ':') > 0 then
                     'checked="checked"'
                 else ''
              end SEQ_CHECK,
              NAME,
              READY_DATE,
              COMMENTS
            from widgets_broken
    )
    

    4. create a dynamic action to manage the persistence the checked values.

    * Name: * bind_click_handler
    * Event: * after refresh
    * Type selection *: region
    * Region: *
    Real actions:
    * Seq *: 10
    * Fire on Page Load *: Yes
    * Execute JavaScript Code *:

    $('.pk-selector').bind('click',function(){
      $this = $(this);
      var checkVal = $this.val();
    
      if($this.prop("checked")){
        pkArray.push(checkVal); //save checked value
      }else{
        pkArray.splice( $.inArray(checkVal, pkArray), 1 ); //remove unchecked value
      }
      $s('P33_SELECTED_WIDGETS',pkArray.join(':')); //update page item with new values
    });
    

    Edit
    I left a decisive step. In your background report, ensure that this partial page refresh is enabled and P33_SELECTED_WIDGETS builds page elements to present the attribute.

    Finally, change the proceudure files add to refer to the page instead of globl table element.

    BEGIN
    
        insert into widgets(NAME,READY_DATE,COMMENTS)
        select name, ready_date, comments
          from widgets_broken
         where instr(':' || :P33_SELECTED_WIDGETS || ':', ':' || SEQ || ':') > 0;
    
        delete from widgets_broken
          where instr(':' || :P33_SELECTED_WIDGETS || ':', ':' || SEQ || ':') > 0;
    
        :P33_REC_CNT := SQL%ROWCOUNT;
    END;
    

    See you soon,.
    Janet Tyson

    Published by: Tyson Janet January 3, 2012 13:13

  • How to identify the name of the procedure that inserts into a table in the TRIGGER

    Hello
    There are several procedures in my DB that perform the INSERT operation on a main table - MYTAB say.

    I created a trigger on the table MYTAB, to follow closely, what procedure is insert data in there. Is there a function that captures the name of this object?

    For example: PROC_A, PROC_B, PROC_C insert into the table MYTAB. And my query is - the trigger on table MYTAB should document these object names where the lines fit.
    Please let me know your suggestions...

    SQL> create table t (no integer, dt timestamp, who_inserted varchar2(4000));
    
    Table created.
    
    SQL> create or replace procedure p
      2  as
      3  begin
      4    insert into t (no, dt) values (1, systimestamp);
      5  end;
      6  /
    
    Procedure created.
    
    SQL> show err
    No errors.
    
    SQL> create or replace trigger t_trig before insert on t for each row
      2  begin
      3     :new.who_inserted := dbms_utility.format_call_stack;
      4  end;
      5  /
    
    Trigger created.
    
    SQL> show err
    No errors.
    
    SQL> begin
      2    p;
      3  end;
      4  /
    
    PL/SQL procedure successfully completed.
    
    SQL> select * from t;
    
            NO DT                             WHO_INSERTED
    ---------- ------------------------------ ----------------------------------------
             1 31-OCT-14 04.58.53.668465 AM   ----- PL/SQL Call Stack -----
                                                object      line  object
                                                handle    number  name
                                              3a7ddbea0         2  KARTHICK.T_TRIG
                                              3ac979f30         4  procedure KARTHICK.P
                                              3a822deb8         2  anonymous block
    
  • Help to extract data Clob to a column in a table that has several lines in a table

    Help to extract data Clob to a column in a table that has several lines in a table

    It works for only the first line

    CREATE or REPLACE DIRECTORY XMLDIR AS ' / orabackups';

    Grant read, write on DIRECTORY XMLDIR to the public;

    () dbms_xslprocessor.clob2file

    beef in CLOB,

    XMLDIR IN VARCHAR2,

    "testfile2.txt" IN VARCHAR2);

    DECLARE

    buf CLOB.

    BEGIN

    SELECT H15_DOC

    IN buf

    OF H15TEST. H15_STAGE

    where rownum = 1;

    dbms_xslprocessor.clob2file (buf, 'XMLDIR', 'testfile2.txt');

    END;

    /

    -This error code

    CREATE or REPLACE DIRECTORY XMLDIR AS ' / orabackups';

    Grant read, write on DIRECTORY XMLDIR to the public;

    () dbms_xslprocessor.clob2file

    XData in CLOB,

    XMLDIR IN VARCHAR2,

    "testfile2.txt" IN VARCHAR2,

    CSID in NUMBER: = 0);

    DECLARE

    CURSOR xmlmycur IS SELECT H15_DOC

    OF H15TEST. H15_STAGE

    where rownum = 102140;

    l_clob CLOB.

    XData CLOB.

    BEGIN

    DBMS_LOB.CREATETEMPORARY (l_clob, true);

    DBMS_LOB.CREATETEMPORARY (xdata, true);

    OPEN xmlmycur.

    LOOP

    SEEK xmlmycur INTO xdata;

    dbms_xslprocessor.clob2file (xdata, 'XMLDIR', 'testfile2.txt');

    EXIT WHEN xmlmycur % notfound;

    END LOOP;

    CLOSE Xmlmycur;

    END;

    /

    ORA-21560: 3 argument is null, invalid or out of range

    ORA-06512: at "SYS." DBMS_LOB", line 991

    ORA-06512: at "XDB". DBMS_XSLPROCESSOR', line 324

    ORA-06512: at line 15 level

    FYI, it seems that the file being created will exceed 5 gig

    Yes, it is a known issue with DBMS_XSLPROCESSOR.clob2file with big files.

    Here is a slightly modified version of the code that I posted earlier, fixing WRITE_ERROR except:

    DECLARE

    v_file utl_file.file_type;

    -write a unique to clob

    procedure write_clob (p_content in clob) is

    v_buffer varchar2 (32767).

    V_POSITION pls_integer: = 1;

    v_amount pls_integer: = 32767;

    Start

    loop

    Start

    DBMS_LOB. Read (p_content, v_amount, v_position, v_buffer);

    exception

    When no_data_found then exit;

    end;

    UTL_FILE.put_raw (v_file, utl_raw.cast_to_raw (v_buffer), true);

    V_POSITION: = v_position + v_amount;

    end loop;

    end;

    BEGIN

    -Open the file

    v_file: = utl_file.fopen ('TEST_DIR', 'testfile2.txt', 'wb', 32767);

    -loops through the lines

    for r in)

    Select h15_doc

    of h15test.h15_stage

    )

    loop

    write_clob (r.h15_doc);

    end loop;

    UTL_FILE.fclose (v_file);

    END;

    /

  • How can I insert several CSVs in dreamweaver in a table based on ID

    How can I insert several CSVs in dreamweaver in a table based on ID? I recorded each sheet in the doc excel as a CSV file and now I want to import all the CSVs in one table by pulling the information attached to the ID of the line.

  • Update of several lines using the join condition

    Hi all

    CREATE OR REPLACE
    PROCEDURE update_t
    IS

    BEGIN
    SheikYerbouti IN (SELECT EMPLOYEE_ID, FIRST_NAME, LAST_NAME FROM hr.employees)
    LOOP
    UPDATE
    HR.employees1
    SET
    FOCA =)
    Select concat (FIRST_NAME, LAST_NAME) in the hr.employees where SheikYerbouti. EMPLOYEE_ID = 197);
    END LOOP;
    END update_t;
    /

    I'm trying to update column Foca Employees1 table. When I run this procedure, I get the error

    Error report:
    ORA-01427: einreihig subquery returns multiple rows
    ORA-06512: at "SYSTEM. UPDATE_T", line 13
    ORA-06512: at line 1
    01427 00000 - "einreihig subquery returns several lines.

    Please let me know a solution for this.

    Thank you
    Mathon

    Hello Mathieu,
    in your internal SQL result set is not limited to just one line.
    Try this

    UPDATE hr.employees1 SET
    FIRST_LAST= (select concat(FIRST_NAME,LAST_NAME) from hr.employees where emp_rec.EMPLOYEE_ID=hr.employees.employee_id);
    

    Your version had no restrictions on selected lines of hr.employees. You gave a where condition clause that is not related to the query.

    The best solution for your problem is to avoid completely any PL/SQL loop. You can try something like this:

    update
       (select
           e1.first_last,
           e.first_name,
           e.last_name
        from
           hr.employees1 e1,
           hr.employees e
        where
           e1.employee_id=e.employee_id) set
       first_last=first_name||last_name;
    

    But beware, the updates on the joints work only under certain restrictions. The key of the table to be updated must be the join key. (key preserved is the word to look for).

    Hope that helps,
    dhalek

  • insert this line does not exist

    Hi all

    I need to insert a line using the daily procedure. Insert must only be performed when this line does not exist in the table. Please suggest me a decision. I know it's simple question, sorry for disturbing (Burns my brain).

    Hello

    Use MERGE.
    http://download.Oracle.com/docs/CD/B28359_01/server.111/b28286/statements_9016.htm#sthref9082
    If you use Oracle 10 (or higher) then you don't need a section "WHEN MATCHED.

    If you want to know, post a small example of data (CREATE TABLE and INSERT statements, showing all the tables involved, as they exist prior to the INSERTs in question). Put one or two unconditional instructions INSERT (including an example of each matching rows found and not found) and the results you want (that is, the content of the table changed after the INSERTs).
    Always tell what version of Oracle you are using.

  • Maybe you are looking for

    • software issue

      is there a software out there that can change the clothing of what a person has on an image?  I mean, it's an image, if a person has on a T-shirt and blue jeans could the pic be changed towards a business suite? put overalls on it or even change a T-

    • Equium L10-142 - battery won't load

      I've had my Equium L10-142 for about four years now, and I know that it is long enough for a laptop. Last year I had problems with the battery that refuses to load at all and more in the past months, the cable ca now seems to be worse and worse. Now

    • Browsers are too slow - need help

      Hello Suddenly, since a few days - my browsers [Safari & Chrome] becomes too slow... I even deleted the history too I need assistance her please Yet one thing... is there any photo editor/Paint Brush in iMAC... applications data? See you soon Pruthvi

    • Wired connection

      I just bought the Sony BDP-S370 and I tried to connect using a wired connection. I put my settings in and nothing I also did with 'AUTO' settings and nothing. I called Sony and they could not help I called comcast and none help so am hoping that some

    • How to fix plug-in on yahoo messenger it always says error and I try setting but I can't seem to fix the plug-in at all.

      How to fix the plug-in on yahoo messenger if i can hear music on it someone can please help me all I get is error and I try to fix it, but I can't seem to solve this

    EditEditCopyCopyDeleteDelete4005Leaseinfo2100003007002014 01-02
    EditCopycopyDeleteDelete4006Leaseinfo250001503502014 01-02