Copying recordings to another column in the table that has NULL values

Hello

I am trying to copy the email address from one table to another table that has the NULL value in the column email
SQL> select
  2     count(*)
  3  from
  4     users a, cvProperties b, cvDetails c
  5  where
  6     a.user_id=b.user_id and b.cv_id=c.cv_id and a.userType like '1'
  7  and
  8     c.email is NULL
  9  /

  COUNT(*)
----------
         7

SQL> insert into cvDetails(email)
  2  VALUES(
  3  (select
  4     a.login
  5  from
  6     users a, cvProperties b, cvDetails c
  7  where
  8          a.user_id=b.user_id and b.cv_id=c.cv_id and a.userType like '1'
  9  and
 10          c.email is NULL)
 11  );
(select
 *
ERROR at line 3:
ORA-01427: single-row subquery returns more than one row
Please notify

Thank you in anticipation

Check to see if that helps...

MERGE INTO cvdetails c
     USING (SELECT a.login, b.cv_id
              FROM users a, cvproperties b
             WHERE a.user_id = b.user_id AND a.usertype = 1) xx
        ON (xx.cv_id = c.cv_id)
WHEN MATCHED
THEN
   UPDATE SET email = xx.login
           WHERE c.email IS NULL;

Vanessa B.

Tags: Database

Similar Questions

  • Add the constraint not NULL in the existing table that has null values

    Hello

    I want to add a constraint not null to and an existing table, but the table already contains values null in this column.

    EMP

    Emp_id name

    1 axada

    2

    3 sdkdd

    Here is already the data IE 2 empid is Null as name. I must add a fool of constraint not null which new values will not be null, but I don't want to change the data of exisitng alreadt which is null.

    Hello

    "The opposite": NOVALIDATE does not validate the data that is ALREADY in the table, but do not allow the insertion of a NULL value.

    Have you tried my sample code?

    CREATE TABLE MaTable (x NUMBER PRIMARY KEY, y NUMBER);

    INSERT INTO myTable VALUES (1, 123);

    INSERT INTO myTable VALUES ( 2, NULL );

    INSERT INTO myTable VALUES (3, 456);

    ALTER TABLE mytable MODIFY (y NOT NULL NOVALIDATE );

    INSERT INTO myTable VALUES (4, 678);

    INSERT INTO myTable VALUES ( 5, NULL );

    SELECT * FROM MyTable;

    '2' line was inserted with null before the creation of the NOT NULL constraint, this line remains "as what" at the end of the trial.

    '5' line trying to insert a NULL value after creating the NOT NULL constraint, which is denied.

    Best regards

    Bruno.

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

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

    It works for only the first line

    CREATE or REPLACE DIRECTORY XMLDIR AS ' / orabackups';

    Grant read, write on DIRECTORY XMLDIR to the public;

    () dbms_xslprocessor.clob2file

    beef in CLOB,

    XMLDIR IN VARCHAR2,

    "testfile2.txt" IN VARCHAR2);

    DECLARE

    buf CLOB.

    BEGIN

    SELECT H15_DOC

    IN buf

    OF H15TEST. H15_STAGE

    where rownum = 1;

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

    END;

    /

    -This error code

    CREATE or REPLACE DIRECTORY XMLDIR AS ' / orabackups';

    Grant read, write on DIRECTORY XMLDIR to the public;

    () dbms_xslprocessor.clob2file

    XData in CLOB,

    XMLDIR IN VARCHAR2,

    "testfile2.txt" IN VARCHAR2,

    CSID in NUMBER: = 0);

    DECLARE

    CURSOR xmlmycur IS SELECT H15_DOC

    OF H15TEST. H15_STAGE

    where rownum = 102140;

    l_clob CLOB.

    XData CLOB.

    BEGIN

    DBMS_LOB.CREATETEMPORARY (l_clob, true);

    DBMS_LOB.CREATETEMPORARY (xdata, true);

    OPEN xmlmycur.

    LOOP

    SEEK xmlmycur INTO xdata;

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

    EXIT WHEN xmlmycur % notfound;

    END LOOP;

    CLOSE Xmlmycur;

    END;

    /

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

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

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

    ORA-06512: at line 15 level

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

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

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

    DECLARE

    v_file utl_file.file_type;

    -write a unique to clob

    procedure write_clob (p_content in clob) is

    v_buffer varchar2 (32767).

    V_POSITION pls_integer: = 1;

    v_amount pls_integer: = 32767;

    Start

    loop

    Start

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

    exception

    When no_data_found then exit;

    end;

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

    V_POSITION: = v_position + v_amount;

    end loop;

    end;

    BEGIN

    -Open the file

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

    -loops through the lines

    for r in)

    Select h15_doc

    of h15test.h15_stage

    )

    loop

    write_clob (r.h15_doc);

    end loop;

    UTL_FILE.fclose (v_file);

    END;

    /

  • What is the name of the table that has the name of the custom in the Oracle database Section?

    What is the name of the table that has the name of the custom in the Oracle database Section?

    Thank you

    Nefertari

    The names of the custom Sections are stored in commonExtendedAttributeML, the extended attribute table.

  • AF:Switcher, handfuls of line column values based on another column in the table

    Hello

    I have a question if you can help me on this. It's on af:switcher.

    What I'm trying to do this - is in a table of the adf, based on the value of a column, I want another column to display as a link or not.
    For example, if the status column is 1, then the id column display as a link (I just put a h:outputLink around outputText to do), if it is then show him without bond.

    For this I put two different facets and opportunities switcher to decide what facet of show which line.

    BUT what is happening is that only on opportunities is made. Either / or scenario. It is not made each line according to the value of the status column.

    What is planned.

    I just tried with the dept table.

                    
                    
                    
                      
                    
                    
                    
                        
    
                      
                    
    

    The lines for which the deptno > 20, I wanted to display the pass as link and for the deptno<=20, log="" will="" be="" an="" input="" text.="" it="" works="" fine="" for="" me.="" probably,="" you="" may="" need="" to="" get="" rid="" of="" h:outputlink="" and="" use="" commandlink="" golink="">

    Arun-

  • Query took too much time when adding new column to the table and the index set on this

    I added a new column to the table that contains thousands of records. and created the composite index with three columns (those newly added + two existing column)

    for the specifics. TBL table there are two columns col1, col2

    I added the new column col3 to TBL and created composit index (col1, col2, col3).

    Now for all the records in col3 is NULL. When I choose on this table, it takes too long...

    Any idea what my I do bad., I have check the query plan, it is using the index

    It is solved using collection of statistics using the

    DBMS_STATS. GATHER_TABLE_STATS

    @Top.Gun thanks for your review...

  • How to check the index, on the number of columns in the table is created

    How to check on the number of columns in the table the index has been created. ??

    OR

    How check index, on the number of columns in the table that it is been created?

    890306 wrote:
    How to check on the number of columns in the table the index has been created. ??

    >

    OR

    How check index, on the number of columns in the table that it is been created?

    query USER_IND_COLUMNS

    SQL> desc user_ind_columns
     Name                            Null?    Type
     ----------------------------------------- -------- ----------------------------
     INDEX_NAME                             VARCHAR2(30)
     TABLE_NAME                             VARCHAR2(30)
     COLUMN_NAME                             VARCHAR2(4000)
     COLUMN_POSITION                        NUMBER
     COLUMN_LENGTH                             NUMBER
     CHAR_LENGTH                             NUMBER
     DESCEND                             VARCHAR2(4)
    

    Handle: 890306
    Status level: Beginner
    Join date: October 8, 2011
    Messages total: 13
    Total Questions: 5 (5 open)

    Why all the question still pending?

    Published by: sb92075 on December 3, 2011 17:21

  • Query for a list of null columns in the table

    Hello experts!

    It may be a silly question but I'm stuck in a this simple query:

    Question: I have a table with 10 columns and 10000 records, I want a query which can only show me the names of columns that contains null values. I just want to know the number of columns is there in my table that contains null values.

    Thank you!

    Hello
    You can query user_tab_columns:

    select column_name from user_tab_columns where table_name= and num_nulls>0
    

    HTH

  • Add the new column to the table, having trouble adding to an existing form

    I added a new column to a table that has an existing report and on this form. I was able to get the new column in the report, but I can't seem to get in shape. Can anyone give me a suggestion as how to proceed without having to recreate the form?

    Have you added a new element of the new column and set the source type on DATABASE_COLUMN then the value from the source to your new column name?

    -Jeff

  • IDREF tag the xref element has no value

    I use FM 8 on Windows.

    I have a structured document where several sections of the document will be making reference to a table.

    More specifically, I have an XRef element with an Idref attribute that will point to an element TableTitle in the target table.

    Almost all of them work, but once from time to time one of the Idref attributes will be = < value > and tinted red in the Structure view.

    The reference is correct, I can Alt-Ctrl-click on the referral and it will take me to the correct table. But when I export to format XML the Idref is empty and my XSLT logic that tries to follow this reference collapses because it cannot find the target.

    It doesn't seem to matter where I set the goal, I can re assign the xref to point to another table that another Idref have no problem with, and it shows even < value >. I can remove the XRef element and add it, set up the target and it's still no < value >.

    What I have to do is find another element of the xref that has a valid Idref, make a copy of this Xref element and attribute, then re - assign this Idref to my desired target cross reference and it will go then find the correct Id value in the title of the table.

    While this works, I'm confused as to why Framemaker creates crossreference < worthless > in the first place.

    Thanks for any idea!

    -Michael

    Michael,

    The reference dialog box has four options selects the target (called source) of the cross-reference. Two of them create the marker-based referrals who work in FrameMaker and PDF but create attribute values. Did you check that?

    -Michael HD

  • Addition of constraint not Null to a column that contains null values

    All,

    Could you please suggest me how to add the constraint not null to an existing column that has null values?

    SQL > create table nn (number n, s varchar2 (10));

    Table created.

    SQL > insert into nn values (1, 'test');

    1 line of creation.

    SQL > insert into values nn (2 '');

    1 line of creation.

    SQL > commit;

    Validation complete.

    SQL > alter table nn edit n number not null;

    Modified table.

    SQL > nn desc;

    Name                                      Null?    Type

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

    N NUMBER NOT NULL

    S                                                          VARCHAR2(10)

    SQL > alter table nn edit n number null.

    Modified table.

    SQL > nn desc;

    Name                                      Null?    Type

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

    N                                                  NUMBER

    S                                                  VARCHAR2(10)

    SQL > alter table nn change s varchar2 (10) not null;

    ALTER table nn change s varchar2 (10) not null

    *

    ERROR on line 1:

    ORA-02296: impossible to activate (SCOTT) - found null values

    SQL >

    Thank you

    Use NOVALIDATE:

    SQL > alter table nn change s varchar2 (10) not null;
    ALTER table nn change s varchar2 (10) not null
    *
    ERROR on line 1:
    ORA-02296: impossible to activate (SCOTT) - found null values

    SQL >
    SQL > alter table nn change s varchar2 (10) not null NOVALIDATE;

    Modified table.

    SQL > insert into values nn (3, null);
    insert into nn values (3, null)
    *
    ERROR on line 1:
    ORA-01400: cannot insert NULL into ('SCOTT'. "' NN '. » S »)

    SQL > select * from nn;

    N S
    ---------- ----------
    1 test
    2

    SQL >

    SY.

  • Hide columns in Table B, based on values LOV in another row of the table:

    Hello

    Jdev 12.2.1.0

    I have two tables A and B and I hide columns b based on the value of row of table A LOV. For example, I have a line in A table that has a column with the x, y, z values lov. Now, if I select the row in the table has and change the LOV to x, I had to hide some of the columns in the table (B) is there a way to get this feature? Any help would be appreciated.

    Thank you

    Assume:

    1 table a call "DepartmentId" column this column has LOV.

    B 2-table a column "ColumnInB" this column will be visible depending on the value of "DepartmentId".

    Try to do the following:

    1 - from data controls, drag "DepartmentId" attribute and drop it on the page as inputText then together make this inputText to false (you can remove it, but don't forget the corresponding binding in pageDef. not deleted).

    2. copy the value of the inputText which will be as "#{bindings." DepartmentId.inputValue}"and go to the"ColumnInB"column and visible property beyond the copied value.

    3 - the ColumnInB visible will be the condition as:

    4-set DepartmentId autoSubmit = 'true '.

    5-set table partialTriggers table B has id and id of DepartmentId LOV

  • Try to update the new column in the TABLE one by reading another table

    I had to add another column to a table and for updating this column, I need to read two other paintings, according to the REF_TYPE_CD.




    Update CUST_RQST_DROP c
    Set crd_mktr_no = (select mka_mktr_no from marketer_account
    where mka_acct_no = c.crd_ref_no
    and c.entry_dt between mka_eff_dt and mka_exp_dt
    and c.crd_ref_type_cd = 'A');

    Update CUST_RQST_DROP c
    Set crd_mktr_no = (select aeq_mktr_no from acct_enroll_que
    where aeq_work_q_no = c.crd_ref_no
    and c.crd_ref_type_cd = 'P');


    I don't know how to combine in a single query.

    Any suggestions would be greatly appreciated

    Well, I still had to build all of the DDL and DML statements me:(dans l'avenir, je recommanderais ajouter ceci dans votre post, vous aurez BEAUCOUP plus de gens prêts à aider si vous le faites.) Just a suggestion for your benefit.

    It should work assuming you have a relationship with each other between tablea and b and c... AND you never have more than one row in the child table (b or c to a given value in one).

    create table tablea
    (
    account_no      number,
    entry_dt     date,
    ref_type     varchar2(1),
    refno          number,
    mkt_no          number
    );
    
    create table tableb
    (
    id               number,
    account_no      number,
    mkt_no          number
    );
    
    create table tablec
    (
    id               number,
    account_no      number,
    mkt_no          number,
    eff_dt          date,
    exp_dt          date
    );
    
    insert into tablea values (123, to_date('04/01/2010','mm/dd/yyyy'), 'P', 9983, null);
    insert into tablea values (124, to_date('04/02/2010','mm/dd/yyyy'), 'A', 3452, null);
    insert into tablea values (125, to_date('04/02/2010','mm/dd/yyyy'), 'P', 9984, null);
    
    insert into tableb values (9983, 123, 10001);
    insert into tableb values (9984, 125, 11232);
    
    insert into tablec values (3452, 124, 10333, to_date('01/01/2010','mm/dd/yyyy'), to_date('05/19/2010','mm/dd/yyyy') );
    
    ME_XE?Update TableA a
    set mkt_no =
    (
         select mkt_no from tableb b where b.account_no = a.account_no and a.ref_type = 'P'
         union all
         select mkt_no from tablec c where c.account_no = a.account_no and a.ref_type = 'A' and a.entry_dt between c.eff_dt and c.exp_dt
    )
    where mkt_no is null;
    
    3 rows updated.
    
    Elapsed: 00:00:00.12
    ME_XE?select * from tablea;
    
            ACCOUNT_NO ENTRY_DT             R              REFNO             MKT_NO
    ------------------ -------------------- - ------------------ ------------------
                   123 01-APR-2010 12 00:00 P               9983              10001
                   124 02-APR-2010 12 00:00 A               3452              10333
                   125 02-APR-2010 12 00:00 P               9984              11232
    
    3 rows selected.
    
    Elapsed: 00:00:00.15
    
  • display / hide column of the table running

    Are there known issues with display / hide a column of the table at run time?

    I have a table that contains a column with a check box and another with a radio button.  If the user is allowed to select more than one row in the table (as indicated by a form variable), then I want to hide the column of radio and checkbox column.  If not, I want to show / hide the contrary.

    I show / hide the column header too.  When I preview the form, however, the data in the table appears "scoot" left and placed in the column that is hidden, so to speak.

    Here is a view of the design of the table:

    tableDesignView.jpg

    And a view of the execution of the table.  You can see the radio is hidden, but the "account number" column wants to crush in the (hidden) radio column,

    tableRunTimeView.jpg

    Here is the script, I'm very confident in this small snippet of code because the lines of account were filling wonderfully until I added the column of radio buttons and the script to show/hide.

    Put the account data in the table

    function

    setAccountData (objAccountRow, objAccountItem) //Pass in the line and data to complete line

    {

    stuff the line

    objAccountRow.accountNumber.rawValue

    = objAccountItem.accountNumber;

    objAccountRow.accountName.rawValue

    = objAccountItem.accountName;

    objAccountRow.accountBalance.rawValue

    = objAccountItem.accountBalance;

    display the check box or radio button, depending on the number of accounts they are allowed to select (as specified by the form variable)

    var searchNumAccounts = objFragment.resolveNode("searchNumAccounts").value; Variable //Form

        if (searchNumAccounts==1)

    { //show the column of radio buttons and hide the checkbox column }

    hideObject (objResultsSubform.accounts.HeaderRow.txtSelect);   <-it's exaggerated here, to hide the table for each row header column,...

    hideObject (objAccountRow.accountSelected);

    showObject (objResultsSubform.accounts.HeaderRow.txtRadioSelect);

    showObject (objAccountRow.radioSubform.radioGroup.selected);

    }

    on the other

    { //show the checkbox column and hide the column of radio }

    hideObject (objResultsSubform.accounts.HeaderRow.txtRadioSelect);

    hideObject (objAccountRow.radioSubform.radioGroup.selected);

    showObject (objResultsSubform.accounts.HeaderRow.txtSelect);

    showObject (objAccountRow.accountSelected);

    }

    }

    OK I got it. The table object implements a container to contain the fields. You hid the ok fields, but you then never reset the row in the table to have only two columns. I copied the parameter of the XML source so that I would have the exact width and then deleted the one I wanted to hide. Now everything works fine.

    See the example updated the.

    Paul

  • How to remove columns from the table on the master 1-0?

    I have an array of 96 columns with strings. I also have the array of int 96-elemets (mask) with 1 and 0.

    What I want to do is to is to remove (or hide - but I read that it is not possible) all the columns with index corresponding to 0 in the mask table.

    example:

    columns in the table

    1 2 3 4 5

    mask

    0 1 0 0 1

    I want to remove the columns 1, 3 and 4 and leave only 2 and 5 in my table.

    How can I do?

    If I create loop for with i as the index of the column, when I do DeleteTableColumns() columns number decreases, and I get an error of range out of

    Or do I have an option to hide the unnecessary columns (not set their width to 1, it's very ugly-looking)?

    Please help me (())

    Hello rovnyart!

    1. removal of columns in the table:

    I suspect that the reason why you get the out-of-range error is due to fact that in your loop, you delete the columns in the table, you'll eventually end up by referring to a column that no longer exists, because the other columns before it have been deleted. While you remove each column of your table in the loop for example, the column index number will move, because you deleted the other columns in front of her.

    To resolve this, even if you delete a column in your loop, make sure that you take also into account that the index of the column is moved because of the removed columns.

    2 hide columns in table:

    You can use the ATTR_COLUMN_VISIBLE attribute to hide columns in the table:

    http://forums.NI.com/T5/LabWindows-CVI-idea-exchange/add-attr-column-visible-attribute-for-table-Col...

    http://zone.NI.com/reference/en-XX/help/370051Y-01/CVI/uiref/cviattrcolumnvisible_column/

    3 alternatives:

    Note that another alternative would also use a tree instead, control as the tree control also supports the hidable columns:

    http://forums.NI.com/T5/LabWindows-CVI/table-hide-column/TD-p/569773

    Best regards!

    -Johannes

Maybe you are looking for

  • When you buy logical, it is Pentecost all samples and libraries? Someone told me that weighs 50 GB?

    When you buy logical, it is Pentecost all samples and libraries? Someone told me that weighs 50 GB? -What you have downloaded all?

  • Satellite L500 FN buttons do not work with Win 7 32 bit

    Hello try to install the value-added package 1.2.28 from the DVD driver (shipped with my laptop and newer computer as the pilot on toshibas website).Installtion works well and the keyboard shortcut does not work after restarting.I even try the old dr

  • Difference between VI and executable execution.

    I have a dynamic number of buttons in a cluster that I position by program on my front screen based on the upper-left position of the bunch.  When running in development mode, everything is fine and the cluster remained in this post after the executi

  • WiFi and bluetooth missing?

    I have an Acer Apire TC - 603 i6714 NL = dt.sqxeh.019 office. I assumed that the bluetooth 4.0 and wifi are inside the desktop computer. The problem is that I can't explore any wifi or bluetooth adapter or settings in windows 8.1. I bought this compu

  • decoder for dvd

    I ordered a decoder for my dvd player and I need the serial number of my computer before that they will install it where to find the serial number