How to update a Column with specific Serial ?

I have serial in the first table on primary key from 1 to 4 , and I want to repeat this serial in the foreign key in the second table .
that what I want to appear in the foreign key , I want the repeating take place till the end of the last record in the second table.
*1*
2
3
4
1
2
3
4
1
2
3
4
1
2
3
4
1
*2*
I tried with FOR .. LOOP but doesn't work with me :-(
What should I do ?!

CREATE SEQUENCE seq_cycle START WITH 1 MAXVALUE 4  CYCLE CACHE 3;
SELECT seq_cycle.NEXTVALUE FROM dual;
/

Similar Messages

  • How to update a column with default in a tabular form.

    We have a tabular form that has a submit button that does a multi row update. We would like to update a column with a defaut like APP_USER = updated user when the row is updated. Is this possible and how?

    used lovs and conditions.

  • How to update a column with different values but all other row values r sam

    Hi,
    I have a table like this.
    Col1 col2 col3 col4
    10 20 30
    10 20 30
    10 20 30
    i need to update col4 with different values coming from other table like this
    Col1 col2 col3 col4
    10 20 30 xxxx
    10 20 30 yyyy
    10 20 30 zzzz
    how can i update the table. pls let me know how to use the where condition in the update stmt.
    thanks,
    jay
    Edited by: user2558790 on Nov 20, 2009 12:26 PM

    what is the logic for this kind of update...????
    Greetings,
    Sim

  • SQLLDR: How to fill empty columns with specific default data ?

    Hello,
    We are in 11G
    Here is a complete exemple:
    1) The table definition:
    create table IMPORT_PRJ_TIMESHEETS
      RESSOURCE_CODE VARCHAR2(20),
      REFERENCE_DATE VARCHAR2(20),
      STATUS         VARCHAR2(20),
      PROJET_CODE    VARCHAR2(50),
      TACHE_ID       VARCHAR2(100),
      TACHE_DESC     VARCHAR2(250),
      RAF            NUMBER,
      JOUR1          NUMBER,
      JOUR2          NUMBER,
      JOUR3          NUMBER,
      JOUR4          NUMBER,
      JOUR5          NUMBER,
      JOUR6          NUMBER,
      JOUR7          NUMBER,
      IMPORT_DATE    DATE
    );2) the CTL:
    LOAD DATA
    CHARACTERSET WE8ISO8859P1
       APPEND INTO TABLE IMPORT_PRJ_TIMESHEETS
    -- Pour eliminer la ligne d'en-tete
    WHEN PROJET_CODE != 'ID projet'
       FIELDS TERMINATED BY '*-*' OPTIONALLY ENCLOSED BY '"'
    ( RESSOURCE_CODE       CONSTANT '!RESSOURCE_CODE!'
    , REFERENCE_DATE       CONSTANT '!REFERENCE_DATE!'
    , STATUS               CONSTANT '!STATUS!'
    , PROJET_CODE          CHAR
    , TACHE_ID             CHAR
    , TACHE_DESC           CHAR
    , RAF                  CHAR "TO_NUMBER( :RAF, '999G999D99')"
    , JOUR1                CHAR
    , JOUR2                CHAR
    , JOUR3                CHAR
    , JOUR4                CHAR
    , JOUR5                CHAR
    , JOUR6                CHAR
    , JOUR7                CHAR
    , IMPORT_DATE          SYSDATE
    {code}
    3) the datafile :
    {code}
    ID projet*-*ID tâche*-*Tâche/Description*-*RàF*-*lun. 13/07*-*mar. 14/07*-*mer. 15/07*-*jeu. 16/07*-*ven. 17/07*-*sam. 18/07*-*dim. 19/07*-*
    FR-FR-NT2300135*-* *-*GAMMAWEB - Coordination*-*0,00*-* *-* *-* *-*8,00*-*8,00*-* *-* *-*
    *-* *-*Holiday*-* *-* *-*8,00*-* *-* *-* *-* *-* *-*
    *-* *-*Special leave*-* *-*8,00*-* *-* *-* *-* *-* *-* *-*
    *-* *-*Vacation*-* *-* *-* *-*8,00*-* *-* *-* *-* *-*
    {code}
    - As you can see, the datafile delimiter is "*-*" .... there's no pb about this.
    - Also, there are 5 lines in the datafile. Currently, the _*load status*_ is :
       - Line 1 is the header  >>> not loaded, and that's fine with me.
       - Line 2 is successfully loaded
       - Line 3 / Line 4 / Line 5 : are not loaded .. but I need these lines ...
    *What I'd like to get is to successfully load lines 3 to 5 with a default values for the first 3 columns (project/task ID/ task desc)*
    I hope it's clear enough and that you will be able to provide a good answer ..
    Thanks in advance,
      Olivier                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Thanks for your reply ... it was helpful..
    here is the current CTL I use with the datafile above:
    LOAD DATA
    CHARACTERSET WE8ISO8859P1
       APPEND INTO TABLE IMPORT_PRJ_TIMESHEETS
       FIELDS TERMINATED BY '*-*' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    ( RESSOURCE_CODE       CONSTANT '!RESSOURCE_CODE!'
    , REFERENCE_DATE       CONSTANT '!REFERENCE_DATE!'
    , STATUS               CONSTANT '!STATUS!'
    , PROJET_CODE          CHAR "NVL(:PROJET_CODE, 'INDIRECT')"
    , TACHE_ID             CHAR
    , TACHE_DESC           CHAR
    , RAF                  CHAR "TO_NUMBER( :RAF, '999G999D99')"
    , JOUR1                CHAR
    , JOUR2                CHAR
    , JOUR3                CHAR
    , JOUR4                CHAR
    , JOUR5                CHAR
    , JOUR6                CHAR
    , JOUR7                CHAR
    , IMPORT_DATE          SYSDATE
    {code}
    I have removed line "  WHEN PROJET_CODE != 'ID projet'   "  , because when I use it, because column is NULL .. it doesn't take the NULL into consideration... and as a results, there is only one line loaded, and not the 3 others !
    Now, when I remove line "  WHEN PROJET_CODE != 'ID projet'   " , I get the results that I want (4 lines loaded), BUT a BAD file is created (with the first row, the one that starts with 'ID projet' )   
    I understand that this is normal behaviour with this CTL.
    But would it be possible to not put this 'ID projet' line into the BAD file (so that the directory is not polluted with numerous BAD files)
       I was thinking with something like this :   "  WHEN NVL( PROJET_CODE, 'none') != 'ID projet'  "
           But this doesn't work..
    Do you have any advice to provide ?
    Thanks in advance
      Olivier                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Update multiple columns with single update statement..

    HI all,
    i am reading the columns value from different table but i want to update it with signle update statement..
    such as how to update multiple columns (50 columns) of table with single update statement .. is there any sql statement available i know it how to do with pl/sql..

    As I understood, may be this. Here i am updating ename,sal, comm columns all at once.
    SQL> select * from emp where empno=7369;
         EMPNO ENAME      JOB              MGR HIREDATE                   SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17/12/1980 12:00:00        800                    20
    SQL> UPDATE emp
      2     SET ename = lower (ename),
      3         sal = sal + 1000,
      4         comm = 100
      5   WHERE empno = 7369;
    1 row updated.
    SQL> select * from emp where empno=7369;
         EMPNO ENAME      JOB              MGR HIREDATE                   SAL       COMM     DEPTNO
          7369 smith      CLERK           7902 17/12/1980 12:00:00       1800        100         20
    SQL> UPDATE emp
      2     SET ename = (SELECT 'ABCD' FROM DUAL),
      3         sal = (SELECT 1000 FROM DUAL),
      4         comm = (SELECT 100 FROM DUAL)
      5   WHERE empno = 7369;
    1 row updated.

  • How to make text columns with adobe muse

    Hi,How to make text columns with adobe muse (like InDesign)?

    Multiple columns can be acheived with CSS - http://www.w3schools.com/css/css3_multiple_columns.asp
    div
    -moz-column-count:3; /* Firefox */
    -webkit-column-count:3; /* Safari and Chrome */
    column-count:3;
    I'm surprised that Muse does not support text columns yet, but perhaps the custom CSS can be added in style tags on page properties. Haven't tried it, but don't see why it wouldn't work.

  • How can i register column with in the query

    hi all
    how can i register column with in the query?

    Thanks.
    In my business one, the column width was registed.
    But I don't know how can I do it.
    So I try to save the query again after change column width.
    Then the query was opend with changed column width.
    Is it right function?
    Is there any way to register the column width?
    It's very troublesome to change column width every time.
    seiichi

  • How to update two tables with trigger

    Hi:
    how to update two tables with trigger ?
    I have two tables :
    (1)ASIA
    MI number;
    (2)ASIA_P
    ID number;
    When I insert a new value into the asia.MI ,I also can
    insert the same value into the asia_p.id field.
    I have write a trigger as follows but it does't work.
    create or replace trigger MI_TRG
    before insert on asia
    for each row
    declare
    seq number;
    begin
    select MI_SEQ.Nextval into seq from dual;
    :new.MI:=seq;
    insert into ASIA_PRO(MI_ID)
    values
    (seq);
    end MI_TRG;
    How to realize it ?
    thanks
    zzm

    Why do you say it does not work?

  • HT1529 how to find my iphone with the serial number

    hi
    could you please tell how to find my iphone with the serial number ?

    Sorry, there is no way to do that.
    What To Do If Your iDevice or Computer Is Lost Or Stolen
    iPhone, iPod Touch, and iPad
    If you activated Find My Phone before it was lost or stolen, you can track it only if Wi-Fi is enabled on the device. What you cannot do is track your device using a serial number or other identifying number. You cannot expect Apple or anyone else to find your device for you. You cannot recover your loss unless you insure your device for such loss. It is not covered by your warranty.
    If your iPhone, iPod, iPod Touch, or iPad is lost or stolen what do you do? There are things you should have done in advance - before you lost it or it was stolen - and some things to do after the fact. Here are some suggestions:
    This link, Re: Help! I misplaced / lost my iPhone 5 today morning in delta Chelsea hotel downtown an I am not able to track it. Please help!, has some good advice regarding your options when your iDevice is lost or stolen.
      1. Reporting a lost or stolen Apple product
      2. Find my lost iPod Touch
      3. AT&T. Sprint, and Verizon can block stolen phones/tablets
      4. What-To-Do-When-Iphone-Is-Stolen
      5. What to do if your iOS device is lost or stolen
      6. 6 Ways to Track and Recover Your Lost/Stolen iPhone
      7. Find My iPhone
      8. Report Stolen iPad | Stolen Lost Found Online
    It pays to be proactive by following the advice on using Find My Phone before you lose your device:
      1. Find My iPhone
      2. Setup your iDevice on iCloud
      3. OS X Lion/Mountain Lion- About Find My Mac
      4. How To Set Up Free Find Your iPhone (Even on Unsupported Devices)
    Mac Computer
           Find My Mac can be used from Find My Phone at iCloud.com and via Find
           My Phone on your iDevice.
          The following is third-party anti-theft software:
               1.  STEM 2.1
               2.  MacPhoneHome 3.5
               3.  MacTrack 7.5.0
               4.  VUWER 1.7
               5.  Sneaky Bastar* 0.2.0
               6.  Undercover 5.1.1
               7.  LoJack for Laptops
               8. Hidden 2.0

  • HT4623 How to update ipod touch with software version 4.1????

    How to update ipod touch with software version 4.1????

    Open itunes on your computer, connect ipod.
    That's it.  It will prompt you to update to the latest available version.

  • How tu update a column having type 'Long raw' in oracle table with an image

    Hello,
    I must change the image loading in a column with 'long raw' type in the table. I find an image data already in the table.
    I have my new imgae in a file .bmp.
    What SQL instruction I mut use to update this column to load my new image ?
    I work in Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod.
    thanks for your helps.
    Regards.

    Unless I'm missing something MSFT are making it unecessarily complex by not implementing the SQL/XML standard...
    SQL> alter table emp add ( emp_xml xmltype)
      2  /
    Table altered.
    SQL> update emp set emp_xml = XMLELEMENT("EMPLOYEE",xmlattributes(EMPNO as "id"), XMLElement("Name",ENAME))
      2
    SQL> /
    14 rows updated.
    SQL> set pages 0
    SQL> select EMPNO, EMP_XML from EMP
      2  /
          7369
    <EMPLOYEE id="7369">
      <Name>SMITH</Name>
    </EMPLOYEE>
          7499
    <EMPLOYEE id="7499">
      <Name>ALLEN</Name>
    </EMPLOYEE>
          7521
    <EMPLOYEE id="7521">
      <Name>WARD</Name>
    </EMPLOYEE>
          7566
    <EMPLOYEE id="7566">
      <Name>JONES</Name>
    </EMPLOYEE>
          7654
    <EMPLOYEE id="7654">
      <Name>MARTIN</Name>
    </EMPLOYEE>
          7698
    <EMPLOYEE id="7698">
      <Name>BLAKE</Name>
    </EMPLOYEE>
          7782
    <EMPLOYEE id="7782">
      <Name>CLARK</Name>
    </EMPLOYEE>
          7788
    <EMPLOYEE id="7788">
      <Name>SCOTT</Name>
    </EMPLOYEE>
          7839
    <EMPLOYEE id="7839">
      <Name>KING</Name>
    </EMPLOYEE>
          7844
    <EMPLOYEE id="7844">
      <Name>TURNER</Name>
    </EMPLOYEE>
          7876
    <EMPLOYEE id="7876">
      <Name>ADAMS</Name>
    </EMPLOYEE>
          7900
    <EMPLOYEE id="7900">
      <Name>JAMES</Name>
    </EMPLOYEE>
          7902
    <EMPLOYEE id="7902">
      <Name>FORD</Name>
    </EMPLOYEE>
          7934
    <EMPLOYEE id="7934">
      <Name>MILLER</Name>
    </EMPLOYEE>
    14 rows selected.
    SQL>

  • How to update two columns in two tables?

    hi friends
    I have two tables linked to each other through SaleNo and SaleDT. their structure as below
    Sales Table============
    SaleNo int PK auto increment
    SaleDT Datetime PK
    Qnty decimal
    Units decimal
    Invoices table
    =================InvoiceNo int PK Auto incremented
    InvoiceDT Datetime
    SaleNo int FK
    SaleDT Datetime FK
    Note that SaleDT column is NOT assigned with getDate() expression.
    1. what I need to do is update the SaleDT column of Sales table and Invoices table with the value '2013-01-31 10:31:55.813', how do I do this without manually breaking the link between the tables?
    2. Assume SaleNos 15 to 27 needs update the SaleDT to '2013-06-12 10:31:55.813', how do I do this complex operation where I I have update SaleDt column of two table of SaleNo range from 15 to 27?
    thanks
    I use Visual studio 2012 Ultimate and SQL server 2008 developer edition!

    Why not below? May be you will not be able to change your design now, but just want to share.
    Sales Table============
    SALEID int PK autoincrement
    SaleNo int
    SaleDT Datetime
    Qnty decimal
    Units decimalUNIQUE (Saleno,SaleDT)
    Invoices table
    =================InvoiceNo int PK Auto incremented
    InvoiceDT Datetime
    SALEID int FK

  • How to update old instances with values

    Hi,
    i am using albpm 5.7 version.
    i have a requirement i need to update the oldinstances with updated data.
    suppose i have added new external variable to process how it will update the old instances.
    plz suggest how to solve this problem.
    Regards,
    Srinivas.

    Hi,
    The standard behaviour is that new instances of the process will use the most recent version of the process that has been deployed to the database. This allows you to deploy new versions of the processes without impacting on processes which are already in progress.
    When the workflow engine determines what activity to run next in the process, the engine checks what the start date of the process instance was, so that it can check what version of the process was active at that time. If you update the start date for each running process, so that it reflects the date that you saved the most recent version of the flow, then the workflow engine will use the latest version instead of the version that it was running.
    This is not supported. I would never suggest that you do this in a production environment - it does not make sense to be making frequent changes to the process in a production environment, since there is no supported mechanism for forcing existing flows to use the new definition. The engine is designed specifically to run the same version of the process for the duration of the process instance - what you want to do is to blow this out of the water completely. If you do change this, then all timing that is recorded against the activities becomes useless, and the other impact on the workflow process us something that you would need to consider incredibly carefully before deciding whether you want to take the risk.
    HTH,
    Matt
    WorkflowFAQ.com - the ONLY independent resource for Oracle Workflow development
    Alpha review chapters from my book "Developing With Oracle Workflow" are available via my website http://www.workflowfaq.com
    Have you read the blog at http://thoughts.workflowfaq.com ?
    WorkflowFAQ support forum: http://forum.workflowfaq.com

  • How do I reinstall Aperture with only serial number?

    I had to have a new hard drive installed and due to software corruption on my old drive I had to erase any software.  My photo library was in Aperture and I can not access any of my images.  I upgraded from a free trial and only have a serial number for version 3.2.4.  How do I reinstall Aperture without having to repurchase the download?  Thank you for any advice!

    Try if this download link for the trial version still works: if yes, you can install Aperture 3 from this link, then unlock it with your serial number:
    http://appldnld.apple.com.edgesuite.net/content.info.apple.com/Aperture/061-8328 .20101020.AprE3/ApertureTrial3.1.dmg
    Then use software update to upgrade to 3.3.
    Keep a copy of the Trial installer, just in case you ever need to reinstall.
    Regards
    Léonie

  • How to update Nested tables with xsu

    Hello,
    I have three tables.
    1) DEPARTMENT_TAB
    2) EMPLOYEE_TYP
    3) ADDRESS_TYP
    ADDRESS_TYP is a collection and it is nested inside EMPLOYEE_TYP.
    EMPLOYEE_TYP is a collection and it is nested inside DEPARTMENT_TAB.
    created with below scropt
    CREATE TYPE ADDRESS_TYP AS OBJECT (CITY VARCHAR2(10), STATE VARCHAR2(2));
    CREATE TYPE ADDRESS_TYP_NT AS TABLE OF ADDRESS_TYP;
    CREATE TYPE EMPLOYEE_TYP AS OBJECT (EMPNO NUMBER(4), ENAME VARCHAR2(10), ADDRESS_VAR ADDRESS_TYP_NT);
    CREATE TYPE EMPLOYEE_TYP_NT AS TABLE OF EMPLOYEE_TYP;
    CREATE TABLE DEPARTMENT_TAB (DEPTNO NUMBER(4), DNAME VARCHAR2(10), EMPLOYEE_VAR EMPLOYEE_TYP_NT)
         NESTED TABLE EMPLOYEE_VAR STORE AS EMPLOYEE_TAB
         ( NESTED TABLE ADDRESS_VAR STORE AS ADDRESS_TAB);
    I inserted two rows in DEPARTMENT_TAB and their nested tables using normalsql. and i generated below xml content using XSU java API
    oracle.xml.sql.query.OracleXMLQuery
    My Question is How to UPDATE a row in ADDRESS_TAB using XSU java API
    oracle.xml.sql.dml.OracleXMLSave.
    (When i was trying to update address_tab nested table's row with xml input file. it is deleting other existing rows)
    Thanks.

    Why do you say it does not work?

Maybe you are looking for