inserting several rows of a particular column

It comes to my table

Select * from emp1.

EMP_ID DEPT DEPTNO

---------- ------------------------------ ----------

100 ICC

112 tests

Tesla 103

104. IT

S/N 105

106 icc

107. IT

101 S/N

tests of 111

112 tests

I want to update the deptno column only with a set of values totally 10 values.

I did the below,

SQL > start

2 3 insert into emp1 (deptno) values (100);

4 insert in emp1 (deptno) values (101);

5 insert in emp1 (deptno) values (102);

6 insert in emp1 (deptno) values (103);

7 insert in emp1 (deptno) values (104);

8 insert in emp1 (deptno) values (105);

9 insert in emp1 (deptno) values (106);

10 insert into emp1 (deptno) values (107);

11 insert in emp1 (deptno) values (108);

12 insert in emp1 (deptno) values (109);

13 end;

14.

I messed up the table when trying to insert some values of this column and now my table looks as seen below after using a block anonymous plsql

SQL > select * from emp1.

EMP_ID DEPT DEPTNO

---------- ------------------------------ ----------

100 ICC

112 tests

Tesla 103

104. IT

S/N 105

106 icc

107. IT

101 S/N

tests of 111

112 tests

EMP_ID DEPT DEPTNO

---------- ------------------------------ ----------

100

101

EMP_ID DEPT DEPTNO

---------- ------------------------------ ----------

102

103

104

105

106

107

108

109

PLSQL block used

Start

Insert in emp1 (deptno) values (100);

insert into emp1 (deptno) values (101);

insert into emp1 (deptno) values (102);

insert into emp1 (deptno) values (103);

insert into emp1 (deptno) values (104);

insert into emp1 (deptno) values (105);

insert into emp1 (deptno) values (106);

insert into emp1 (deptno) values (107);

insert into emp1 (deptno) values (108);

insert into emp1 (deptno) values (109);

end;

/

Please help me correct the table.

You know what EMP_ID should be given what DEPTNO and corresponding use updated.

SY.

Tags: Database

Similar Questions

  • Insert several rows in the data table table

    Hi all

    I have a requirement as to insert multiple rows in the table for this table data only (I need to replicate the data).
    In this table, the primary key is a composite primary key with all the keys.primary foreign key and the foreign key to the Date. I need to change that date to the insertion.


    INSERT
    IN myschema. Fact_page_performance
    (
    time_sk,
    Batch_ID,
    delta_msec,
    delta_user_msec,
    error_code_sk,
    content_errs,
    element_count,
    page_bytes,
    Available,.
    date_sk

    )
    VALUES
    (SELECT time_sk,
    Batch_ID,
    delta_msec,
    delta_user_msec,
    error_code_sk,
    content_errs,
    element_count,
    page_bytes,
    Available
    OF myschema. FACT_PAGE_PERFORMANCE_BACKUP
    WHERE date_sk = 20090509, 20090510
    );

    But it gives error like missing expression.
    Could someone please help me.

    Thanks and greetings
    Swetha.

    You can have either the VALUES or not SELECT the two

    INSERT
    INTO myschema.Fact_page_performance
    (
    time_sk ,
    batch_id ,
    delta_msec ,
    delta_user_msec,
    error_code_sk ,
    content_errs ,
    element_count ,
    page_bytes ,
    Available ,
    date_sk
    
    )
    SELECT time_sk ,
    batch_id ,
    delta_msec ,
    delta_user_msec,
    error_code_sk ,
    content_errs ,
    element_count ,
    page_bytes ,
    Available
    FROM myschema.FACT_PAGE_PERFORMANCE_BACKUP
    WHERE date_sk=20090509,20090510;
    
  • ORA-00904: "RENEWED_FD." "' OLD_FDR_NO ': invalid identifier...... HOW table TO INSERT SEVERAL ROWS of ONE TABLE to ANOTHER.

    Hi all

    I have two tables RENEWED_FD and KEC_FDACCT_MSTR.

    In the RENEWED_FD table, there are columns namely OLD_FDR_NO, ACCT_CUST_CODE, ACCT_TYPE, QUANTITY.

    In the KEC_FDACCT_MSTR table, there are columns namely ACCT_FD_NO, ACCT_CUST_CODE, ACCT_TYPE, QUANTITY.

    In the RENEWED_FD table, OLD_FDR_NO is present and rest all columns are empty, so I want to insert all other values of column in table KEC_FDACCT_MSTR

    where RENEWED_FD. OLD_FDR_NO = KEC_FDACCT_MSTR. ACCT_FD_NO.

    How to do this in Toad for ORACLE FORMS 6i or Oracle?

    Help me

    Thank you.

    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production


    I tried with the following code:

    Code:

    INSERT INTO RENEWED_FD

    (ACCT_CUST_CODE, ACCT_TYPE, SUM)

    SELECT ACCT_CUST_CODE, ACCT_TYPE, AMOUNT

    OF KEC_FDACCT_MSTR

    WHERE RENEWED_FD. OLD_FDR_NO = KEC_FDACCT_MSTR. ACCT_FD_NO;

    But I got this error:

    ORA-00904: "RENEWED_FD." "" OLD_FDR_NO ": invalid identifier

    Oh, you're on 9i db. In 9i the MATCHED and UNMATCHED aren't optional, and you must use both. FUSION has evolved through time, and it's a shame that you cannot make the most out of it because of your version.

    You use better UPDATE statement then.

    update of renewed_fd one

    Set)

    a.acct_cust_code

    a.acct_type

    a.amount

    ) =

    (

    Select b.acct_cust_code

    b.acct_type

    b.amount

    of kec_fdacct_mstr b

    where a.old_fdr_no = b.acct_fd_no

    )

    where

    There are)

    Select null

    of kec_fdacct_mstr b

    where a.old_fdr_no = b.acct_fd_no

    )

  • Inserting multiple rows - need help

    Hi all

    I need to insert several rows in the table with a single query, and the number of lines is 269470.
    Here one of the columns is determined by another sub query that returns multilple lines and the other 2 columns remain same for all.

    I came up with the following query, but need a loop to turn several times (269470 times).

    insert into EMLUSRRECV
    (user_id, storeent_id, receiveml)
    values
    (+ (select user_id from users including the user_id not in (select distinct user_id of EMLUSRRECV) and CURR = 'USD' and rownum = 1) +, 11154, 1);

    Thanks in advance.

    And how did you think of sql developer can help you with that?

    Why don't mark you this question ANSWER and post in the forum SQL and PL/SQL.
    SQL and PL/SQL

  • 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                        
    
  • How to insert multiple rows in a table by the user (pl/sql)

    Hello
    I was trying to insert several rows in a table by a user by some pl/sql, but not every time entry. :/
    What is happening is that the program requires each time ask the user for the new value but the loop
    1 values inserts actually four times (the loop is run four times). can any point on what I am
    doing wrong or solutions will be fun ;)

    what I wrote here

    ---------------------------------

    Set serveroutput on
    set verify off

    declare

    EmpNo number;
    EmpName varchar2 (20);

    Start

    because loop me in 1.4
    EmpNo: = & empno;
    EmpName: = '& empname';

    insert into values(empno,empname) of the employee;

    end loop;

    end;

    -------------------------------

    do not laugh at my code, I'm new to this oracle :D

    Thank you, prospects for the future for a response

    user13371438 wrote:
    Thanks for the info, looks like a nice tool will ;) try
    but I really want (my problem) in pl/sql

    Take a quick re-read my post above.

    PL/SQL is a process running on the database server. This process cannot interact with the client computer. He can't ask for user input, and it cannot display the output to the client. Client interface tools can only do. You are eager to get feedback from a user, if you need an interface tool to do. SQL * Plus can interface and application of entry, but only as variable substition, and it does not really provide a programming construct that allows you to run a program in a loop to do. Do this using SQL * Plus you must pair it with shell/dos scripting languages, but more ideally you should use an interface appropriate as Apex.

    I was wondering if it all works in pl/sql to release cached data (as fflush (stdin) in c ++)

    PL/SQL does not a customer entry, so there is no sense to have something to release the cached data. You pass the values of PL/SQL code using procedures or functions with parameters.

  • Prepare a document to insert a row that contains the Blob column. Is what sense this correct?

    When we prepare the statement to insert a row that contains the Blob column. Is what sense this correct? And what is the difference? Does anyone know?

    1 Preparestatement.setBlob(parameter number, blob type object)

    2 Preparestatement.setBlob(parameter number, inputstream type object)

    This link shows the test I did.

    https://community.Oracle.com/thread/3680185?SR=Inbox & customTheme = OTN

    When we prepare the statement to insert a row that contains the Blob column. Is what sense this correct? And what is the difference? Anyone know?

    1 Preparestatement.setBlob(parameter number, blob type object)

    2 Preparestatement.setBlob(parameter number, inputstream type object)

    I answered in your other thread and provided a link to the JDBC Dev Guide section, which explains how to work with type LOB and BFILE data.

    Have you read this article from doc?

    Did you read my response to your other thread?

    In java, a BLOB is just the index that gives you access to the content. In your case, you access by selecting a locator BLOB existing and getting his inputstream. This inputstream is what allows you to access the content real blob.

    The Locator is just that; It specifies the LOCATION of the blob content, but NOT the content.

  • CC2015: Shortcut to "insert a row below / right column.

    In DW CC, there was no way to make a shortcut for "insert a row below / right column.

    I asked for it here.

    Are there new options in DW CC 2015 that could solve this task?

    Adobe cut orders in a version before DW CC.

    I have no idea why.

    I work a lot with data tables and the shortcuts don't still miss a lot.

    Thank you.

    Hello

    There is no keyboard shortcut for this. Sorry for the inconvenience that you are experiencing because of this. We will examine that. But I hope you know that you can do the same using Table contextual menu option-"Insert rows or columns" or Menu Edit-> table-> 'inserted rows or columns. Now these options are also available n mode live view. Using Dreamweaver | Summaries news

    Thank you!

    Kusha

  • I create a form based on two tables that have sequences also. When I create insert only row is inserted in the fields in table first and second fields of the table are empty. Why?

    Mr President.

    I create a form based on two tables that have sequences also. When I create insert only row is inserted in the fields in table first and second fields of the table are empty. Why?

    formdoubletables.png

    the page source is

    <?xml version='1.0' encoding='UTF-8'?>
    <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
                    xmlns:f="http://java.sun.com/jsf/core">
      <af:panelFormLayout id="pfl1">
        <af:group id="Group">
          <af:inputText value="#{bindings.VoucherId.inputValue}" label="#{bindings.VoucherId.hints.label}"
                        required="#{bindings.VoucherId.hints.mandatory}" columns="#{bindings.VoucherId.hints.displayWidth}"
                        maximumLength="#{bindings.VoucherId.hints.precision}"
                        shortDesc="#{bindings.VoucherId.hints.tooltip}" id="it1">
            <f:validator binding="#{bindings.VoucherId.validator}"/>
            <af:convertNumber groupingUsed="false" pattern="#{bindings.VoucherId.format}"/>
          </af:inputText>
          <af:inputDate value="#{bindings.VoucherDate.inputValue}" label="#{bindings.VoucherDate.hints.label}"
                        required="#{bindings.VoucherDate.hints.mandatory}"
                        columns="#{bindings.VoucherDate.hints.displayWidth}"
                        shortDesc="#{bindings.VoucherDate.hints.tooltip}" id="id1">
            <f:validator binding="#{bindings.VoucherDate.validator}"/>
            <af:convertDateTime pattern="#{bindings.VoucherDate.format}"/>
          </af:inputDate>
          <af:inputText value="#{bindings.Credit.inputValue}" label="#{bindings.Credit.hints.label}"
                        required="#{bindings.Credit.hints.mandatory}" columns="#{bindings.Credit.hints.displayWidth}"
                        maximumLength="#{bindings.Credit.hints.precision}" shortDesc="#{bindings.Credit.hints.tooltip}"
                        id="it2">
            <f:validator binding="#{bindings.Credit.validator}"/>
          </af:inputText>
        </af:group>
        <af:group id="g1">
          <af:inputText value="#{bindings.Lineitem.inputValue}" label="#{bindings.Lineitem.hints.label}"
                        required="#{bindings.Lineitem.hints.mandatory}" columns="#{bindings.Lineitem.hints.displayWidth}"
                        maximumLength="#{bindings.Lineitem.hints.precision}" shortDesc="#{bindings.Lineitem.hints.tooltip}"
                        id="it3">
            <f:validator binding="#{bindings.Lineitem.validator}"/>
            <af:convertNumber groupingUsed="false" pattern="#{bindings.Lineitem.format}"/>
          </af:inputText>
          <af:inputText value="#{bindings.VoucherId1.inputValue}" label="#{bindings.VoucherId1.hints.label}"
                        required="#{bindings.VoucherId1.hints.mandatory}"
                        columns="#{bindings.VoucherId1.hints.displayWidth}"
                        maximumLength="#{bindings.VoucherId1.hints.precision}"
                        shortDesc="#{bindings.VoucherId1.hints.tooltip}" id="it4">
            <f:validator binding="#{bindings.VoucherId1.validator}"/>
            <af:convertNumber groupingUsed="false" pattern="#{bindings.VoucherId1.format}"/>
          </af:inputText>
          <af:inputText value="#{bindings.Debit.inputValue}" label="#{bindings.Debit.hints.label}"
                        required="#{bindings.Debit.hints.mandatory}" columns="#{bindings.Debit.hints.displayWidth}"
                        maximumLength="#{bindings.Debit.hints.precision}" shortDesc="#{bindings.Debit.hints.tooltip}"
                        id="it5">
            <f:validator binding="#{bindings.Debit.validator}"/>
          </af:inputText>
          <af:inputText value="#{bindings.Credit1.inputValue}" label="#{bindings.Credit1.hints.label}"
                        required="#{bindings.Credit1.hints.mandatory}" columns="#{bindings.Credit1.hints.displayWidth}"
                        maximumLength="#{bindings.Credit1.hints.precision}" shortDesc="#{bindings.Credit1.hints.tooltip}"
                        id="it6">
            <f:validator binding="#{bindings.Credit1.validator}"/>
          </af:inputText>
          <af:inputText value="#{bindings.Particulars.inputValue}" label="#{bindings.Particulars.hints.label}"
                        required="#{bindings.Particulars.hints.mandatory}"
                        columns="#{bindings.Particulars.hints.displayWidth}"
                        maximumLength="#{bindings.Particulars.hints.precision}"
                        shortDesc="#{bindings.Particulars.hints.tooltip}" id="it7">
            <f:validator binding="#{bindings.Particulars.validator}"/>
          </af:inputText>
          <af:inputText value="#{bindings.Amount.inputValue}" label="#{bindings.Amount.hints.label}"
                        required="#{bindings.Amount.hints.mandatory}" columns="#{bindings.Amount.hints.displayWidth}"
                        maximumLength="#{bindings.Amount.hints.precision}" shortDesc="#{bindings.Amount.hints.tooltip}"
                        id="it8">
            <f:validator binding="#{bindings.Amount.validator}"/>
            <af:convertNumber groupingUsed="false" pattern="#{bindings.Amount.format}"/>
          </af:inputText>
        </af:group>
        <f:facet name="footer">
          <af:button text="Submit" id="b1"/>
          <af:button actionListener="#{bindings.CreateInsert.execute}" text="CreateInsert"
                     disabled="#{!bindings.CreateInsert.enabled}" id="b2"/>     
          <af:button actionListener="#{bindings.Commit.execute}" text="Commit" disabled="#{!bindings.Commit.enabled}"
                     id="b3"/>
          <af:button actionListener="#{bindings.Rollback.execute}" text="Rollback" disabled="#{!bindings.Rollback.enabled}"
                     immediate="true" id="b4">
            <af:resetActionListener/>
          </af:button>
        </f:facet>
      </af:panelFormLayout>
    </ui:composition>
    
    
    
    

    Concerning

    Go to your VO Wizard, select the tab of the entity and to check if both the EO is editable or not.

    See you soon

    AJ

  • 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?

  • How to get the value of a particular column column name?

    Hi all

    How to get the column name for a particular column value.
    example:

    create table test (ID number, col2, col3 varchar varchar);

    Insert into test values (1, 'true', 'false');
    Insert into test values (2, 'false', 'true');
    commit;

    I want to choose the name of the data column 'true' with id = 1;

    That is to say) while waiting for answer is "col2". pls help someone.

    This might help:

    DECLARE
       c1 SYS_REFCURSOR;
    BEGIN
       OPEN c1 FOR
       SELECT col2,
              col3
       FROM   test
       WHERE  id = 1;
       --
       FOR c IN (SELECT rownum rn,
                        t2.column_value.getrootelement() name,
                        EXTRACTVALUE(t2.column_value, 'node()') value
                   FROM TABLE(XMLSEQUENCE(c1)) t,
                        TABLE(XMLSEQUENCE(EXTRACT(column_value, '/ROW/node()'))) t2)
       LOOP
          IF c.value = 'true' THEN
             DBMS_OUTPUT.PUT_LINE(c.name);
          END IF;
       END LOOP;
    END;
    
  • definition of particular column of all selected lines of Viewobject in MB

    I have two Radio buttons: one is for real and a fake.
    I have the button.
    I Table.I have the ability to select several rows at a time.
    One of the column in the table is only to be set to 'True' or 'False'. This column, I did as false and true containg LOV.

    When the user selects lines (more than one may also able to choose) in the table and select the 'real' radio button and click on the button right now I need to set the value LOV 'true' in all lines.
    If he select the 'false' radio button, this time value LOV should set to false.

    So is my requirement.

    Inside of the Managed bean, how can I set the particular column of all the rows selected in Viewobject.

    If anyone has the code for this please give me.

    Sanchez

    Hi Catherine,

    You can browse the selected table lines, get the key from the line, find the line in the view object using the key of this line and appropriate attribute set to false or true:

            DCBindingContainer dc = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
            DCIteratorBinding iter = dc.findIteratorBinding("");
            ViewObject vo = iter.getViewObject();
            Transaction trans = vo.getApplicationModule().getTransaction();
    
            RowKeySet rks = table1.getSelectedRowKeys();
            Iterator rksIter = rks.iterator();
            while (rksIter.hasNext()) {
                List l = (List) rksIter.next();
                Key key = (Key)l.get(0);
                //System.out.println(key);
               Row row = vo.getRow(Key);
               row.setAttribute("", );
            }
    
            trans.commit();
    

    where af:table is bound to table1 in managed bean

    Kind regards

    Branislav

  • Update of several rows of the same table using trigger

    Hello

    I have the following table

    ---------------------------------------------------------------------------------------------------------

    CREATE TABLE ATT_PERMISSIONS
    (
    DATE OF PRMONTHYR,
    EMPIDNUMBER (10)DEFAULT VALUE 0,
    FROMDATETIMEDATE,
    TODMTFDATETIMEDATE,
    NUMBER OF PERMMINS (3),

    SSLINASTRETCH NUMBER (3).

    PERMATTINELIGIBLENUMBER (1)DEFAULT VALUE 0
    );

    ------------------------------------------------------------------------------------------------------

    I want to update the column PERMATTINELIGIBLE in the same table when each line is inserted.

    I created following trigger for that

    CREATE OR REPLACE TRIGGER SSL_AFTER_UPDATE AFTER UPDATE ON ATT_PERMISSIONS

    FOR EACH LINE

    BEGIN

    Update ATT_PERMISSIONS set PERMATTINELIGIBLE =

    (

    SELECT THE CHECK BOX

    WHEN PERMMINS < = 60

    or

    (

    PERMMINS < = SSLINASTRETCH

    AND

    COUNT (CASE WHEN PERMMINS = 0 THEN NULL OTHERWISE 1 END)

    COURSES (PARTITION BY empid, prmonthyr) < = 1

    )

    THEN 1

    0 OTHERWISE

    END

    FROM ATT_PERMISSIONS where prmonthyr =:new.prmonthyr, empid =:new.empid

    ) where prmonthyr =:new.prmonthyr, empid =:new.empid;

    END;

    ---------------------------------------------------------------------------------------------------

    That is to say.

    When a row is inserted the PERMATTINELIGIBLE of all records for this employee for the month is recalculated.

    There would be only two or three records for an employee for a month.

    PERMMINS is the number of minutes to use as short leave.

    If it is less than 60 is eligible for the bonus to attendance for this employee.

    If this isn't normally the date is not eligible for the attendance for this employee premium.

    but an exception is that if a short leaves of DISP employee allowed a month (IE. ( SSLINASTRETCH ) in a straight line, IE. one day, that day is eligible for the bonus of presence.

    That is to say. Why the number of short leaves in a month is taken. If it's one and done minutes use is lower to SSLINASTRETCH, then the day is eligible for the attendance bonus.

    But when I try to create the trigger I get error, PL/SQL: ORA-00907: missing a right parenthesis.

    Help, please

    I use oracle 10g

    I want to update the column PERMATTINELIGIBLE in the same table, when each row is inserted.

    No - you do NOT want to do in a trigger.

    You cannot query the same table that the trigger is activated on. -C' is a MUTANT and you will get an exception.

    When a row is inserted is recalculated to the PERMATTINELIGIBLE of all the records for that employee for that month.

    There would be only two or three records for an employee for a month.

    PERMMINS is the number of minutes to use as short leave.

    If it is less than 60 is eligible for the bonus to attendance for this employee.

    If is not normally the day is not eligible for the premium of attendance for this employee.

    but an exception is that if a short leaves of DISP employee allowed a month (IE. SSLINASTRETCH) in a straight line, IE. one day, that day is eligible for the bonus of presence.

    That is to say. Why the number of short leaves in a month is taken. If it's one and done minutes use is less than SSLINASTRETCH, then the day is eligible for the bonus of presence.

    But when I try to create the trigger I get error, PL/SQL: ORA-00907: missing a right parenthesis.

    You can not do in a trigger. Even if correct you this error of syntax, you will get the exception that I mentioned above.

    Oracle is a multi-user system. Other users can modify the same table that you use.

    So even if you could try to interview "all the records for this employee" some of them may be locked if other users access them. Also, an insert statement could try to insert two rows for an employee and the trigger could not have seen the other lines still.

    If you want to work with data SETS (all records for an employee), you must write the PL/SQL code that LOCKS all lines updated to prevent others to interfere.

    Then you make your operations but NOT in a trigger. Perform inserts and then use an UPDATE query to set this value.

    Then VALIDATE to unlock the lines.

  • Could not use DB function call to insert a row into a table OBIEE

    Hello

    At the prompt of the OBIEE report, I create a DB function in a variable column of the guest, so whenever I'm in the dropdown variable ob column call the function DB call.

    The function call is insert a row into a table in the database. However, it seems impossible to insert the row into the table.

    I have test the function in the sqlplus and it works, if the function has no problem. The problem is OBIEE failed to insert something in the datebase, it can only read from it.

    Any ideas on how I could fix it?

    Thank you!

    Hello
    Use your Evaluate function and the variable correctly. In the case where u called this function evaluate in the report in a column, and he has 100 files it contains, it will call db 100 times.

    Kind regards
    Anitha.B

  • Failed to insert a new line with a column generated sequence id

    Hello

    I'm trying to insert a new row in a table containing a column of sequence according to db, used as the primary key.

    Here is the code for the custom method of the corresponding AM I use to insert the new line:

    Line row2 = getCaAppointments1 () .createRow ();
    row2.SetAttribute ("Member ID", Member ID);
    row2.SetAttribute ("Status", "Planned");
    row2.SetAttribute ("CreatedBy", coachId);
    row2.SetAttribute ("CreationDate", date);
    AppointmentId will be generated by the sequence
    DBSequence newId = row2.getAttribute("AppointmentId") (DBSequence);
    SequenceImpl s = new SequenceImpl ("XX_CA_APPOINTMENT_ID", getDBTransaction());
    Long next = newId.getSequenceNumber () .longValue ();
    System.out.println ("Got sequence as id:" + newId);
    row2.SetAttribute ("AppointmentId", newId);
    row2.SetAttribute ("CoachId", coachId);
    row2.SetAttribute ("Type", "0");
    row2.SetAttribute ("AppointmentNumber", 0);
    row2.SetAttribute ("PlannedDate", Department of justice);
    getCaAppointments1 (.insertRow (row2));

    I put the attribute EO 'AppointmentId' to use a DBSequence. I tried different combinations to get the sequence Id and insert a line. Nothing worked well and I'm unable to insert a new line.

    If I avoid using the attribute 'AppointmentId' and that you try to insert a row, it will fail with the error below:

    ORA-01400: cannot insert NULL into ('APPS'. "" "" XX_CA_APPOINTMENTS '. "" APPOINTMENT_ID") ORA-06512: at line 1

    Tried to insert the new row using BCTester but I am struck by the same error it (I was unable to change the value of the "AppointmentId" column when inserting the line because this column is read-only and it showed as - 2 value).

    I guess, since the attribute of column/is already marked to use a DBSequence, the value should be assigned by default and I shouldn't hit "cannot insert the value NULL to the column.
    Did I miss something necessary to trigger the sequence to automatically generate new Id and assign it to the new line before it is created?

    Please let me know the fix.

    Thanks in advance
    Rouhaud

    Hello

    Oracle changes this behavior each version, so I hope that its still OK.
    If you have a trigger on the table that inserts the value of the id if none is preset, then mark it as DBSequence, or be it the number.

    Now for your entity, just generate the impl class and override the method create, kind of old school, I know, but it never fails.
    In the create just add the code to your sequence you had:

    SequenceImpl seqImpl = new SequenceImpl("", thisTransaction);
    Number idValue= s.getSequenceNumber();
    setAttribute("Id", idValue);
    

    -Anton

Maybe you are looking for

  • Satellite A200 PSAE6 - 5.60 BIOS for XP - laptop freezes

    Hello everyone! I just installed new version 5.60 BIOS for XP. And my laptop with terrible Frost (and pulling in the games).He can be and how can I solve this problem?If anyone has the older versions of BIOS for XP please?

  • Read excel cells into variables

    I'm trying to read cells of an excel file and store the contents in variables. The idea is to pass information such as the numbers test, high/low limits, ect. I looked through the activex/excel samples and found excel2000dem which has a function call

  • What type of microphone is compatible with windows Vista?

    Like Dan (above) I use a unit but Logitech appearing incompatlble with Windows Vista. What kind of microphone will allow me to record an audiobook? Sally O

  • Get a USB device is to identify the virtual XP mode on Windows 7

    I tried to get a device from logitech, G25 steering wheel, to be identified in virtual XP mode running windows 7. However the device does not appear on the screen of the top USB devices tab or in my computer. The unit works perfectly on windows 7. Bu

  • Grant privileges on the index

    HelloI'm looking to try to manage the security of some object on the Oracle DB 12 c, and I came to the objects of the index.After watching the magical view: V$ OBJECT_PRIVILEGE, I came across the EXECUTE privilege on the index:Select * from v$ object