Update records double with different data

Hi all

I have a specific problem of migration. Data from a large table were migrated in another table, but the data for the destination column are absent due to some problems (which are not specific to this topic).

Currently I am updating the data for the missing column in the new table.

The problem is due to the current data in the newtable, there the duplicate lines and I have not found a way to make a map of lines so that the data for the missing column can be updated.

create the table ancienne_table

(

fileNo varchar (10),

folder varchar (10),

fileType varchar (10),

col_1 varchar (10),

col_2 varchar (10),

col_3 varchar (10),

col_4 varchar (10)

);

INSERT INTO ancienne_table (fileNo, folder, file type, COL_1, COL_2, COL_3, COL_4) VALUES ('ABC', "Folder1", "Type1", '111', '111', ' 111', null);

INSERT INTO ancienne_table (fileNo, folder, file type, COL_1, COL_2, COL_3, COL_4) VALUES ('ABC', "Folder1", "Type2", '111', '111', ' 111', null);

INSERT INTO ancienne_table (fileNo, folder, file type, COL_1, COL_2, COL_3, COL_4) VALUES ('GHI', 'Folder3', 'Type3', '333', '333', ' 333 ', ' 333');

INSERT INTO ancienne_table (fileNo, folder, file type, COL_1, COL_2, COL_3, COL_4) VALUES ('JKL', 'Folder4', 'Type3', '444', '444', ' 444 ', ' 444');

INSERT INTO ancienne_table (fileNo, folder, file type, COL_1, COL_2, COL_3, COL_4) VALUES ('MNO', 'Folder5', 'Type4', '555', '555', ' 555 ', ' 555');

INSERT INTO ancienne_table (fileNo, folder, file type, COL_1, COL_2, COL_3, COL_4) VALUES ('PQR', 'Folder6', 'Type4', '666', '666', ' 666 ', ' 666');

INSERT INTO ancienne_table (fileNo, folder, file type, COL_1, COL_2, COL_3, COL_4) VALUES ('STU', 'Folder7', 'Type5', '777', '777', ' 777 ', ' 777')

create table NewTable

(

fileNo varchar (10),

folder varchar (10),

fileType varchar (10),

col_1 varchar (10),

col_2 varchar (10),

col_3 varchar (10),

col_4 varchar (10)

);

INSERT INTO NewTable (fileNo, folder, file type, COL_1, COL_2, COL_3, COL_4) VALUES ('ABC', "Folder1", null, ' 111 ', '111' ', 111', null);

INSERT INTO NewTable (fileNo, folder, file type, COL_1, COL_2, COL_3, COL_4) VALUES ('ABC', "Folder1", null, ' 111 ', '111' ', 111', null);

INSERT INTO NewTable (fileNo, folder, file type, COL_1, COL_2, COL_3, COL_4) VALUES ('GHI', 'Folder3', null, '333 ', '333', '333' 333');

INSERT INTO NewTable (fileNo, folder, file type, COL_1, COL_2, COL_3, COL_4) VALUES ('JKL', 'Folder4', null, '444 ', '444', '444' 444');

INSERT INTO NewTable (fileNo, folder, file type, COL_1, COL_2, COL_3, COL_4) VALUES ('MNO', 'Folder5', null, '555 ', '555', '555' 555');

INSERT INTO NewTable (fileNo, folder, file type, COL_1, COL_2, COL_3, COL_4) VALUES ('PQR', 'Folder6', null, '666 ', '666', '666' 666');

INSERT INTO NewTable (fileNo, folder, file type, COL_1, COL_2, COL_3, COL_4) VALUES ('STU', 'Folder7', null, '777 ', '777', '777' 777')


Select * from ancienne_table;

FILENO FILETYPE COL_1, COL_2 COL_3 COL_4 FOLDER

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

Type1 Folder1 ABC 111 111 111

Type2 Folder1 ABC 111 111 111

IGS Folder3 Type3 333 333 333 333

JKL Folder4 Type3 444 444 444 444

Folder5 Type4 555 555 555 555 MNO

nPQR Type4 of Folder6 666 666 666 666

STU Folder7 777 777 777 777 Type5

Select * from NewTable.

FILENO FILETYPE COL_1, COL_2 COL_3 COL_4 FOLDER

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

Folder1 ABC 111 111 111

Folder1 ABC 111 111 111

IGS Folder3 333 333 333 333

JKL Folder4 444 444 444 444

Folder5 555 555 555 555 MNO

PQR Folder6 666 666 666 666

STU Folder7 777 777 777 777

When you try to update the column of file type for all records-

Update NewTable set FileType = (select FileType from ancienne_table where Fileno = newtable.fileNo and folder = NewTable. File);


It would work fine for all other cases with the exception of the first two that are currently double.

It won't work of course because it would give - "row subquery returns more rows" error because of these duplicate records.

I'm trying to update the file type column to the first two rows with values 'Type1' and 'Type2 '.

Out of these two files, it won't matter whose recording of newtable is updated with 'Type1' and you get 'Type2 '.

Please help with ideas around update duplicate records with the ancienne_table-specific data into newtable.

Him below will work... You can update using ROWID, but the lines are duplicated. Must therefore first to define any id for these two lines replicated using row_number and then correspond with rn for the IDENTIFIER specified.

MERGE INTO NewTable nt help

(WITH qry1 AS

(SELECT ot. File type,

ot.fileNo,

OT. Folder,

ROW_NUMBER() ON rn (PARTITION BY ot.fileNo, ot.folder ORDER BY 'A') - you can get the line number based on any order

Of ancienne_table ot

),

qry2 AS

(SELECT nt. File type,

nt.fileNo,

NT. Folder,

ROW_NUMBER() over (PARTITION BY nt.fileNo, nt.folder ORDER BY 'A') rn,-you can get the line number based on any order

NT. ROWID rd

OF NewTable nt

)

SELECT q1.filetype,

Q2.Rd

OF qry1 q1

JOIN qry2 q2

ON q1. Folder = q2. Folder

AND q1.fileNo = q2.fileNo

AND q1.rn = q2.rn

AND q2. FileType IS NOTHING - if necessary add this condition

) q1 ON (nt. ROWID = q1.rd)

WHEN MATCHED THEN

Updated the VALUE of filetype = q1.filetype;

Tags: Database

Similar Questions

  • iCloud full - found two backups with different dates

    My 20g iCloud storage is full.  When I went to manage my data, there were 2 backups of my iPhone with different dates.  Can I remove 1 of them (the older one I guess) without affecting my current phone?  I guess that's when I upgraded my iPhone 4 to 5

    Of,.

    Yes, as long as you can identify with certainty the backup latest.

  • I show two updates of security with a date of 1969 is that right

    I show two updates of security with a date of 1969 are those just my Fox fire beginning very slow very very slow

    This has happened

    Each time Firefox opened

    Is a month ago

    Firefox must have had a problem getting the time to update your system clock, and so the timing of this update is zero. Time (beginning of time) for Unix is 01/01/1970 midnight GMT, less your GMT offset - what makes 12/31/1969 and 2 to 6 pm on North America.

  • Why have I not two record creative Cloud suddenly with different data in each folder (a folder called Creative Cloud Files (unknown))

    This morning, I've connected and started working as usual. When I went to save on I noticed a new folder in the Bridge, called "Creative Cloud Files (unknown) without data in it. Weird, but what ever. So I recorded my file and dinked around a structure of files and cleaned a little. I have noticed that my sharing icon disappeared from records and questioned on this subject, but kept the job because I'm on a deadline.

    So now it is wobbly data to the new file folder that does not match the original file of CC. I don't know where are my latest files and some files are all simple missing. I'm increased and confused about what is happening. Can someone shed some light on this?

    With the recent update of the application of Creative Cloud Desktop (1.9.1.474), we have unfortunately introduced a bug that causes the creation of a new Creative Cloud Files folder and re-synchronization of all content. This will happen only the first time that the synchronization application runs after the update. This caused an understandable pain and confusion, for which we really apologize.

    Creative application Cloud Files contains a logic that supports the use of several Adobe ID. This allows to disconnect from an ID and in, but keeps the contents of your separate creative cloud. When you sign out and change identifiers, the app moves the previous creative Cloud Files folder and it's content and he adds with the already signed in ID (User@AdobeID). Then, it creates a main folder and begins to synchronize the content of the identification of new.

    The bug I mentioned earlier occurs, as the app believes an ID selector took place and as such, moves the current record of Creative Cloud Files and attempts to annex the already signed in ID. As no switch actually took place, it manifests as (unknown).  The application then creates a main folder to synchronize the data.

    What you end up with is essentially a creative Cloud Files folder with your new synchronized data and a creative Cloud Files (unknown) folder that contains duplicate data.

    This happens once, after the last update.

    The solution is to simply delete the (unknown) Creative Cloud Files folder.

    I recommend that ensure you that you have no pending change you can do offline and you check the contents of the folder new, main designer Cloud Files contains everything you expect of him.  If this is not the case, check the contents of the creative Cloud files (unknown).

    If there is still an incompatibility with your data, you can check on creative.adobe.com to confirm that your data is there.

    If you have any other problems or questions on this topic please email [email protected]

  • Updated several lines with different values

    Hello!
    I have a problem. I need to update more than 1000 lines with different values. How can I do?
    For exsample I have table:
    ID; color, date,
    1 red
    2 green
    3 white

    I need to update the date field.

    Update table
    Set date = '01.02.03'
    where id = 1

    Update table
    Set date = '01.03.03'
    where id = 2


    Maybe it's how to update multiple rows in a single request?

    Sorry for my bad English.
    Thank you!

    Hello

    You can try this

    UPDATE TABLE SET DATE = CASE
                        WHEN ID = 1 THEN TO_DATE('01-02-03','DD-MM-RR')
                        WHEN ID = 2 THEN TO_DATE('01-03-03','DD-MM-RR')
                        END
    

    see you soon

    VT

  • regexp: how to deal with different date formats?

    the date comes as varchar2 with '-'and':' as separators for day part and part time respectively. but it may come with different formats such as

    1993-05-17
    1993-05-17 13:04:23
    1993-05-17 13:04
    1993-05-17 13:4
    1993-05-17 13:04
    1993-05-17 13:4:2
    1993-5-17-13:4:2
    1993-5-7-13:4:2

    and so on. date of final format should be ' YYYY-MM-DD HH24-SS'. is it possible to have an intelligent way to deal with different formats of date with separators above and convert the final using regexp format, so that it is compact and universal as possible with assumptions/examples above?

    Thank you

    As others have said, the smartest way is to keep your input in a format method and store your data in a date column.
    But is a simple way to deal with this mess, without regexp,

    with test as (
    select '1993-05-17' d from dual
    union all select '1993-05-17 13:04:23' from dual
    union all select '1993-05-17 13:04' from dual
    union all select '1993-05-17 13:4' from dual
    union all select '1993-05-17 13:4:2' from dual
    union all select '1993-5-17 13:4:2' from dual
    union all select '1993-5-7 13:4:2' from dual
    union all select '1993-05-17 1:4 PM' from dual
    )
    select d
         , to_date( translate( d, 'xampAMP', 'x' )
                  , 'yyyy-mm-dd hh24:mi:ss'
                  )
         + case when instr( upper( d ), 'P' ) > 0 then 0.5 else 0 end cd
    from test
    
  • Creating a line chart series multi with different data providers

    I have 3 providers of data of the same structure that is ArrayCollection of data collection and that you want to use to create a line chart multiseriate. I don't have just 1 dataProvider that can be used but 3 different data providers of the same structure I want to use each different series.

    [Bindable] private var orangeSales: ArrayCollection = collection

    new ArrayCollection collection)

    [{sale: 101000, month: new Date (January 1, 2008 "")},]

    {sale: 960000, month: new Date (February 1, 2008 ')},

    {sale: 475000, month: new Date (March 1, 2008 ')},

    {sale: 425000, month: new Date (April 1, 2008 "")}

    ] );

    [Bindable] private var appleSales: ArrayCollection = collection

    new ArrayCollection collection)

    [{Sales: 991000, month: new Date (January 1, 2008 "")},]

    {sale: 140000, month: new Date (February 1, 2008 ')},

    {sale: 565000, month: new Date (March 1, 2008 ')},

    {sale: 255000, month: new Date (April 1, 2008 "")}

    ] );

    [Bindable] private var bananaSales: ArrayCollection = collection

    new ArrayCollection collection)

    [{sale: 891000, month: new Date (January 1, 2008 "")},]

    {sale: 147560, month: new Date (February 1, 2008 ')},

    {sale: 295000, month: new Date (March 1, 2008 ')},

    {sale: 574000, month: new Date (April 1, 2008 "")}

    ] );

    I want to create a line chart with orangeSales, appleSales and bananaSales as three different lines on the graph for different specified dates.

    < mx:ColumnChart showDataTips = "true" >

    < mx:horizontalAxis >

    < mx:CategoryAxis

    dataProvider = "{orangeSales}".

    categoryField = 'months '.

    / >

    < / mx:horizontalAxis >

    < mx:series >

    < mx:LineSeries displayName = "OrangeSales" yField = "sale" xField = "month" dataProvider = "{orangeSales}" / >

    < mx:LineSeries displayName = "AppleSales" yField = "sale" xField = "month" dataProvider = "{appleSales}" / >

    < mx:LineSeries displayName = "BananaSales" yField = "sale" xField = "month" dataProvider = "{bananaSales}" / >

    < / mx:series >

    < / mx:ColumnChart >

    Help, please!

    Sorry for the confusion. In fact I do something wrong, such as using ColumnChart to display a line chart or something like that.

    Now, I realized that a multi series line graph can be built by the presence of a different data provider for each of the LineSeries object.

    If the code below would create a multi series line graph:

    [Bindable] private var orangeSales: ArrayCollection = collection

    new ArrayCollection collection)

    [{sale: 101000, month: new Date (January 1, 2008 "")},]

    {sale: 960000, month: new Date (February 1, 2008 ')},

    {sale: 475000, month: new Date (March 1, 2008 ')},

    {sale: 425000, month: new Date (April 1, 2008 "")}

    ] );

    [Bindable] private var appleSales: ArrayCollection = collection

    new ArrayCollection collection)

    [{Sales: 991000, month: new Date (January 1, 2008 "")},]

    {sale: 140000, month: new Date (February 1, 2008 ')},

    {sale: 565000, month: new Date (March 1, 2008 ')},

    {sale: 255000, month: new Date (April 1, 2008 "")}

    ] );

    [Bindable] private var bananaSales: ArrayCollection = collection

    new ArrayCollection collection)

    [{sale: 891000, month: new Date (January 1, 2008 "")},]

    {sale: 147560, month: new Date (February 1, 2008 ')},

    {sale: 295000, month: new Date (March 1, 2008 ')},

    {sale: 574000, month: new Date (April 1, 2008 "")}

    ] );

    I want to create a line chart with orangeSales, appleSales and bananaSales as three different lines on the graph for different specified dates.

    <>

    dataProvider = "{orangeSales}".

    categoryField = 'months '.

    />

  • to join two columns with different data types

    Hello experts,

    I have two tables...
         create table1
       (
         col1 varchar2(20)
        );
        
      create table2
        (
          col1 number(10)
        );  
    
      
    with their data as below
              with table1 as
      (  select 'xx' col1 from dual union all 
         select 'yy' col1  from dual union all
         select '01' col1  from dual union all
         select '02' col1  from dual union all
         select '03' col1  from dual union all
         select '04' col1  from dual 
      ),table2 as 
       (
         select '01' col1 from dual union all
         select '02' col1 from dual union all
         select '03' col1 from dual union all
         select '04' col1 from dual 
        )
          
        
    My question
    How to join table1.col1 table2.col1? since they are different data types... .i tried to use To_char but then I got 0 zero,.
    is there is all the functions I can use?


    Thank you!!

    user642297 wrote:
    Hello experts,

    I have two tables...

    create table1
    (
    col1 varchar2(20)
    );
    
    create table2
    (
    col1 number(10)
    );  
    

    with their data as below

    Above, you said that table2.col1 was a NUMBER.
    Below, is a VARCHAR2:

    with table1 as
    (  select 'xx' col1 from dual union all
    select 'yy' col1  from dual union all
    select '01' col1  from dual union all
    select '02' col1  from dual union all
    select '03' col1  from dual union all
    select '04' col1  from dual
    ),table2 as
    (
    select '01' col1 from dual union all
    select '02' col1 from dual union all
    select '03' col1 from dual union all
    select '04' col1 from dual
    )
    

    Woudn't be a better approximation of your real tables:

       ),table2 as
        (
          select 1 col1 from dual union all
          select 2 col1 from dual union all
          select 3 col1 from dual union all
          select 4 col1 from dual
         )
    

    ?

    My question
    How to join table1.col1 table2.col1? since they are different data types... .i tried to use To_char but then I got 0 zero,.
    is there is all the functions I can use?

    Your postal code. I think the best way is to use TO_CHAR, but maybe you were using it differently.

    SELECT     *
    FROM     table1
    JOIN     table2     ON     NVL ( LTRIM (table1.col1, '0')
                       , '0'
                       )     = TO_CHAR (table2.col1)
    ;
    

    This assumes that table1.col1 never contains decimal points, unary + signs, exhibitors, or other things like that.
    He will be responsible for negative numbers, but if table1.col1 contains 0 in front after the sign less (for example '-0012' "), then the solution is a bit more complicated.

  • Date of record entry - with a date system that by default does not

    Hello

    I have a form that allows users to enter information. I want to have a field to record the date where they have updated the registration...

    in order to accomplish the above, here's what I did:
    (1) I created an article on the form (put the source as table_column that I use to record the date on the table)...
    (2) in the field by default, I put "sysdate" to enter the date of the day...
    (3) I made the point 'View' only so that no one should be able to change...

    well... when my users open the form they see the current date in the form...

    My challenge is when the user saves the form, all records that they are entering with the exception of the "record modified date"... Not sure if it's due date format or something else the cause, the date in my form format is LUN-JJ-AA and looks like on my table format is DD/MM/YYYY... If the date formatting issue then please advice how to fix...

    I saved a sample on APEX. ORACLE.COM for review and comment... Here is the log in details

    Workspace: tparvaiz
    Username: [email protected]
    Password: tparvaiz

    Application: 28899 default Date and white space
    Application Page no.: 24
    ID/PW: TEST/TEST

    Thank you

    You must use the text instead of the display element element. I changed to the text element and readonly by adding the following in the attributes of HTML form elements:

     readonly="readonly"
    

    You can change the border style, so if you want to show it without borders.

    See you soon,.

    Zahid

  • Restore rman 10g with different data file name.

    Hi all.

    I am successful restoration sauvegardΘ (Veritas Netbackup) one 10.2.0.5 database.

    The original database was a 2 node Rac 10.2.0.5 on asm without OMF.

    I'm trying to restore on another host with the same version 10.2.0.5 and even platform (Sparc Solaris), but single instance database.

    RMAN complete successfully, the restore, but the names of the data files are different from what is written in the controlfiles so

    the database can go up but not open.

    It is not only a question of path, the look of database for a file of data like this:

    System.261.622119076 (the right way of the asm source environment)

    but instead, rman restore this data as a file

    o1_mf_system_2ixfh90q_.dbf

    This seems a name OMF.

    I don't understand the reason.


    Can I use the command set newname for each data file?


    Thanks in advance.




    I restored the database successfully.

    In init.ora I don't use the setting as a CONVERT.

    I don't know why but I had to restore archived log first. something like

    DESTINATION ARCHIVELOG TO GAME ' / u01/app/oracle/oradata/PDM/arch;

    RESTORE ARCHIVELOG ALL;

    then:

    RMAN > RUN

    {

    SBT ALLOCATE CHANNEL t1 TYPE of AIRCRAFT;

    Restore controlfile;

    }

    After this:

    editing of database startup

    and I extracted the list of data files:

    + DATA /...

    + FLASH...

    then

    change the editing of the database;

    RUN {}

    SBT ALLOCATE CHANNEL t1 TYPE of AIRCRAFT;

    SBT ALLOCATE CHANNEL t2 TYPE of AIRCRAFT;

    SBT ALLOCATE CHANNEL t3 TYPE of AIRCRAFT;

    SBT ALLOCATE CHANNEL t4 TYPE of AIRCRAFT;

    the value of newname for datafile 1 to ' / u01/app/oracle/oradata/PDM/system.261.622119067';

    St newname for datafile 2 to ' / u01/app/oracle/oradata/PDM/undotbs1.262.783621567';

    the value of newname for datafile 3 to ' / u01/app/oracle/oradata/PDM/sysaux.263.622119149';

    the value of newname for datafile 4 to ' / u01/app/oracle/oradata/PDM/undotbs2.265.622119189';

    the value of newname for datafile 5 to ' / u01/app/oracle/oradata/PDM/users.266.622119281';

    the value of newname for datafile 6 to ' / u01/app/oracle/oradata/PDM/gcs_data.272.622547291';

    the value of newname for datafile 7 to ' / u01/app/oracle/oradata/PDM/gcs_indx.275.622548237';

    the value of newname for datafile 8 to ' / u01/app/oracle/oradata/PDM/gcs_lob.276.622548403';

    the value of newname for datafile 9 to ' / u01/app/oracle/oradata/PDM/pdm_data.273.622547535';

    the value of newname for datafile 10 to ' / u01/app/oracle/oradata/PDM/pdm_indx.274.622547861';

    the value of newname for datafile 11 to ' / u01/app/oracle/oradata/PDM/tbs_htmldb.277.623757195';

    the value of newname for datafile 12 to ' / u01/app/oracle/oradata/PDM/w3docdb_data.278.623757345';

    the value of newname for datafile 13 to ' / u01/app/oracle/oradata/PDM/w3docdb_index.279.623757371';

    the value of newname for datafile 14 for ' / u01/app/oracle/oradata/PDM/w3docdb_lob.280.623757407';

    the value of newname for datafile 15 to ' / u01/app/oracle/oradata/PDM/aspect_data.295.636897363';

    the value of newname for datafile 16 t to ' / u01/app/oracle/oradata/PDM/pdmct.319.650450905';

    the value of newname for datafile 17 to ' / u01/app/oracle/oradata/PDM/pdmct.320.650451825';

    the value of newname for datafile 18 to ' / u01/app/oracle/oradata/PDM/pdmpm.321.660676573';

    the value of newname for datafile 19 to ' / u01/app/oracle/oradata/PDM/undotbs3.327.783526691';

    the value of newname for datafile 20 to ' / u01/app/oracle/oradata/PDM/pdmed_data.330.787137071';

    the value of newname for datafile 21 to ' / u01/app/oracle/oradata/PDM/pdmed_idx.329.787137111';

    until ' to_date ('2015 - 12 - 02:13:00:00 ',' yyyy-mm - dd:hh24:mi:ss');

    RESTORE THE DATABASE;

    switch datafile;

    recover the database;

    }

    at database startup has tried to recreate the DATA + redolog in and + FLASH as well

    I've deleted all the possible redolog except the redolog that have been verified as CURRENT or ACTIVE

    (I don't understand why in montage mode I have active and current redolog).

    SELECT GROUP #, ARCHIVED, STATUS FROM V$ LOG;

    ALTER database drop logfile group x.

    For the rest of the redolog I used:

    change the database file rename '+ DATA/pdm/onlinelog/group_1.257.622119063' to ' / u01/app/oracle/oradata/PDM/group_1a ";

    change the database file rename '+ FLASH/pdm/onlinelog/group_1.257.622119065' to ' / u01/app/oracle/oradata/PDM/group_1b ";

    change the database file rename '+ DATA/pdm/onlinelog/group_5.259.622119065' to ' / u01/app/oracle/oradata/PDM/group_5a ";

    change the database file rename '+ FLASH/pdm/onlinelog/group_5.259.622119065' to ' / u01/app/oracle/oradata/PDM/group_5b ";

    change the database file rename '+ DATA/pdm/onlinelog/group_7.269.622123949' to ' / u01/app/oracle/oradata/PDM/group_7a ";

    change the database file rename '+ FLASH/pdm/onlinelog/group_7.263.622123951' to ' / u01/app/oracle/oradata/PDM/group_7b ";

    change the database file rename '+ DATA/pdm/onlinelog/group_8.270.622123951' to ' / u01/app/oracle/oradata/PDM/group_8a ";

    change the database file rename '+ FLASH/pdm/onlinelog/group_8.264.622123951' to ' / u01/app/oracle/oradata/PDM/group_8b ";

    alter database disable change tracking block;

    change the database open.

  • Receive error message when calculating the two fields with different date format

    I'm more familiar with SQL Server and Oracle, then after a search online without success, I ask here.

    I use developer PL/SQL with DB Oracle 11g Release 11.2.0.2.0 Enterprise 64-bit

    MyTable:

    ID_Number VarChar2

    Date of Date_Received

    Select ID_Number,

    Date_Received,

    To_Date (substr (ID_Number, 1.6), "YYMMDD") SentDate,.

    Date_Received - NumDays To_Date (substr (ID_Number, 1.6), "YYMMDD")

    FROM MyTable

    Where substr (ID_Number, 7.3) in ('ABC', 'ABD')

    and length (Trim (translate ((substr (ID_Number, 1,6)), '0123456789',' '))) a null value

    ID_Number Date_Received SentDate NumDays

    131002ABC1654106 10/16/10/2013-2013 14 2

    131004ABD8813899 4/12/2013-4/8/2013 4

    131014ABD1844832 10/16/10/14 OF 2013-2013 2

    Sometimes the first 6 characters in the ID_Number aren't the numbers and length (Trim (translate deletes records))

    I want just the records where NumDays > 2

    I tried to put the request in a subquery and using where NumDays > 2 outside.  I also tried using the calculation directly in the Where clause.  Without it in Where clause it works very well, with him in a place, I get the following error:

    ORA-01931: Date format picture ends before converting all of the input string


    I don't know how to put the two dates in the same format.  I tried to declare the format without result.  I don't understand how I can calculate in the selection, but do not use the same calculation in Where clause.

    Thank you for your help.

    Hello

    SQL is a language to describe the desired results.  How the system gets these results belongs to you don't have much say about which conditions will be applied when.

    One place where you can control the order of things is a CASE expression.  When you say

    CASE

    WHEN condition_1

    THEN expression_1

    END

    You can be sure that expression_1 will be evaluated only when cond_1 is set to TRUE.

    Try something like this:

    WITH got_sent_date AS

    (

    SELECT id_number, date_received

    CASE

    WHEN the TRANSLATION (SUBSTR (id_number, 1, 6)

    , 'x' 0123456789 '.

    , 'x'

    ) IS NULL

    THEN TO_DATE (SUBSTR (id_number, 1-6)

    , "YYMMDD".

    )

    END AS sent_date

    FROM MyTable

    WHERE (id_number, 7, 3) SUBSTR ("ABC", "ABD")

    )

    SELECT id_number

    date_received

    sent_date

    , date_received - sent_date AS num_days

    OF got_sent_date

    WHERE date_received > sent_date + 2

    ;

    If you would care to post some sample data (CREATE TABLE and INSERT statements) and the results desired from this data, I was able to test this.

    Of course, you'll still errors of execution if id_number starts with 6 digits, but they do not have to be valid, for example '131100' or '130229'.  This is one of the reasons why the date information storage in VARCHAR2 columns are a bad idea.  To work around this problem, see

    https://forums.Oracle.com/message/4255051

  • Commit photos with different data stores

    I have a question of space with one of my servers.  We have a 300 GB LUN with essentially a 300 GB VMDK (for simplicity).  We moved the file access to a data store VMX different with a lot of storage space so that when you take a snapshot he will have space to keep the delta files.  My question though is when he goes to renew their commitment, there will be more space required on the data store where the VMDK or recommit this space will be used on the data store where the VMX file?  I've always heard that instant reengagement essentially requires free space equal the size of instant collective delta files.  Does it matter if the VMDK is thick or thin?  Obviously thin can extend but I mean for snapshots.

    Thank you!

    John

    Therefore the Consolidation assistance snapshot gets created with all other delta files?

    The 'Consolidation' Helper is like another instant and only created if you remove snapshots, while the virtual machine is up and running.

    .. instant .single can only grow to the size of the VMDK (so thin provisioned space) parent...

    That's right, a single snapshot can only grow to the size of the basic disk (more a minor overload, see http://kb.vmware.com/kb/1012384), because it contains only modified data blocks and a mapping table.

    André

  • Mapping of columns with different data type of sql teradata source target

    Hello

    I get a problem after upgrading our version of the Golden Gate to Version 11.2.1.0.13 17435036.

    Source DB: Sql Server

    Target the DB: Teradata

    We have generated the definition file and put it in the target server.

    The table structure for one of the target server table differs from the source server. Average datatype of some columns in a table is different than it is in the source.

    During replication, it throws an error that incompatibility of data type.

    Is there a keyword in Oracle Golden Gate, that we can use in parameter files to eliminate this error where Golden Gate will automatically match the columns.

    Before this upgrade version of Golden Gate in the source and target, everything worked well.

    Any help in this direction will be really appreciated.

    Bipul Singh

    Hi, ok, I knew this could be the case, but wanted to check your DDL first, but a change in the way BIT data types are stored in the path took place between versions 11.1 and 11.2.  The ILO data are coming in the target as 0x00 and 0x01, which SQL Server manages without conversion, but other targets will have to use the @NUMBIN function in your COLMAP clause to convert the BIT smallint.  And I don't actually know that the SMALLINT will map correctly, but I believe that is should.

    Here is an example:

    card dbo.XXX, target "SCHEMA". "" XXX_T0 ", colmap (usedefaults Roving_Bit=@NUMBIN (Roving_Bit)...

    You will have to do for all types of data BIT also.

  • Update a field with different values of several tables

    Hello

    I have a table named AAA with 2 fields id and structure.
    And then I have other 3 tables with 2 fields id1 and structure1 id2, table1 and table2, id3 and structure3 to table3 organized.2.

    The number of AAA id is equal to the sum of the IDS of table1, table2, table3: #id = #id1 + id2 # + #id3).

    I want to update the structure of AAA table with values as well as field:
    where AAA.id = table1.id1-> AAA.structure = table1.structure1
    where AAA.id = table2.id2-> AAA.structure = table2.structure2
    where AAA.id = table3.id3-> AAA.structure = table3.structure3

    Can someone help me?

    I have Oracle11gR2.

    Thank you in advance.

    Oops...

    update  AAA
    set structure = (select structure1 from table1 where aaa.id = table1.id1)
    where aaa.id in (select id1 from table1)
    
  • Save pictures png with different names...

    Hello guys,.

    I'm not so familiar with Labview and I want help. I have a Vi which is actually control 32 RBG lights. We use the DMX Protocol... to each time a directed is on and then we take a picture, then the led goes out. The second goes on then end and on... We have 8leds in 4corners... So, we corner1_led1, corner1_led2 up to corner4_led8. Ultimately, we are 32 saves png pictures. What I want is to record photos with different names and numbers starting from 1 instead of 0... For example, if we choose the white light and save the images in 'News' images will be named 'new_white_0_0' instead of 'new_white_1_1 '. You have an idea how I can change it?

    Attached the names of current photos and Vi.

    Any comments would be useful.

    Thank you.

    The terminal of indexing ([i] in the loop for) starts at 0. When you create your file name, use the primitive "to increment" digital palette. Then your file names will start at 1 instead of 0.

    I noticed your VI that you do a lot of string concatenation to build the path/name of the file, you can use the format string and build the screw to make the somewhat simpler schema. You can also update the deprecated functions (for example, the file open) with modern equivalents.

Maybe you are looking for

  • iPhone ON

    Hello I am currently working to connect NZ, Apple authorized service provider in New Zealand as a technician. How are we eligible to become service provider ON iPhone? Thank you. Kind regards. RIMA Martin

  • What is the 55ms timer?

    I heard someone there may be issues to be resolved times less 55ms in LabVIEW with Windows.  Can anyone give me more information about this?  This applies only to older versions of Windows like 95 and earlier versions, or is this something that still

  • When I turn on my dell computer vostro 1700 with windows 7, I get a pop up box in the lower right corner that says "complete audit log. What should I do?

    Windows 7 log in

  • (Solved...) 0xc000007b

    Hello I built an exe of a project VC ++ published by the device manufacturer. When I run it, a 0xc000007b error. I tried a couple of checking and fixing of the works but no. Here's what I tried. -Check the existence of .net 4 (I installed 4.52 and th

  • String conversion, need help

    I have the String I need to convert a RichTextField Here is my String "Hello World. some text here I'm new here text here I really need help "Help me. I want to get Hello world some text here I'm new here of the text here I really need help Help me n