Problem with Union All

Hello Experts,

I'm still on the learning curve in PL/SQL and I have 2 different. I need to create a view that will merge these 2 tables.
create view eft_view as
select 
  BILL_TO_RETAILER      ,
  RETAILER_NAME         ,
  NAME_ON_BANK_ACCOUNT  ,
  BANK_ABA              ,
  BANK_ACCT             ,
  ON_LINE_AMOUNT        ,
  INSTANT_AMOUNT        ,
  TOTAL_AMOUNT          ,
  SOURCE                ,
  INSERTED_DATE         ,
  CDC                   from weekly_eft_temp union all
select 
  BILL_TO_RETAILER  ,
  RETAILER_NAME     ,
  STATUS            ,
  ON_LINE_AMOUNT    ,
  INSTANT_AMOUNT    ,
  NON_SWEPT_AMT     ,
  TTYPE             ,
  EXCEPTION_REASON   from weekly_bill_expt_temp;
I used the union of all, but it doesn't seem to work. I don't know where it's track. I searched on the net but his send me examples for 2 tables tat are similar.

Any suggestions please

You must replicate the columns that do not exist fill them with NULL values.

Perhaps;

create view eft_view as
  select bill_to_retailer,
         retailer_name,
         name_on_bank_account,
         bank_aba,
         bank_acct,
         null status,
         on_line_amount,
         instant_amount,
         total_amount,
         source,
         inserted_date,
         cdc,
         cast (null as number) non_swept_amt,
         null ttype,
         null exception_reason
    from weekly_eft_temp
  union all
  select bill_to_retailer,
         retailer_name,
         null name_on_bank_account,
         null bank_aba,
         null bank_acct,
         status,
         on_line_amount,
         instant_amount,
         null total_amount,
         null source,
         null inserted_date,
         nul cdc,
         non_swept_amt,
         ttype,
         exception_reason
    from weekly_bill_expt_temp;

Tags: Database

Similar Questions

  • with the clause with union all?

    Hello

    I tried to use 'by' article with union all. .but it gives me error...
       with t1 as 
            (select '1'col1 from dual union all
             select '2' col2 from dual)select * from t1
             union 
            with t2 as 
            (select '3' col1 from dual union all
             select '4' col1 from dual )
              select * from t2
                
    What harm am I doing here? Thank you very much!!

    Use the WITH clause, once for you all the subqueries, and then add the main request;

    with t1 as
     (select '1' col1
      from dual
      union all
      select '2' col2
      from dual),
    t2 as
     (select '3' col1
      from dual
      union all
      select '4' col1
      from dual)
    select *
    from t1
    union
    select *
    from t2;
    
  • Problem with Union

    Hello

    I have a request below which I need the merger of two of them to get the result in a single query result, here's the query
    but the error me do is ORA-12704: incompatibility of character set, please let me know wat is the error in the query below

    Select rpad ('Roster_num', 20, "") 'Roster_num '.
    of the double

    UNION ALL

    SELECT
    SEPARATE
    RPAD (AP. EMPLOYEE_CODE, 20, "") 'Roster_num '.

    AR_EMPLOYEE_PERSONAL AP,
    AR_ADDRESS AA,
    AR_V_ROSTER_EMPLOYEE_DEF AD,
    AR_STATE_PROV_REGION ASP,
    AR_DEFINITION_TERRITORY ADT

    WHERE
    BDM PROJECT = 81 AND
    BPM EMPLOYEE_ID = AA. EMPLOYE_ID AND
    BPM EMPLOYEE_ID = AD. EMPLOYEE_ID (+) AND
    BAM STATE_PROV_REG_ID = ASP STATE_PROV_REG_ID AND
    BDM DEFINITION_TERRITORY_ID = ADT. DEFINITION_TERRITORY_ID (+)



    Thank you
    Sudhir

    Explanation with some examples:

    SQL>desc t_test;
    Name                           Null     Type
    ------------------------------ -------- -----------------
    COL1                                    NUMBER
    COL2                                    NUMBER
    COL3                                    NUMBER
    COL4                                    NCHAR(30)   
    

    We see that COL4 in the table is of type NCHAR.

    SQL>select * from t_test;
    COL1                   COL2                   COL3                   COL4
    ---------------------- ---------------------- ---------------------- ------------------------------
    1                      123                    3                      Roster
    2                      3                      4                      RKött
    3                      4                      2
    9                      10                     12
    11                     23                     43                                                    
    
    SQL>select rpad('Roster_num',20,' ') "Roster_num"
    from dual
    union all
    select RPAD(col4,20,' ')  "Roster_num" from t_test;
    
    Error starting at line 7 in command:
    select rpad('Roster_num',20,' ') "Roster_num"
    from dual
    union all
    select RPAD(col4,20,' ')  "Roster_num" from t_test
    Error at Command Line:7 Column:7
    Error report:
    SQL Error: ORA-12704: character set mismatch
    12704. 00000 -  "character set mismatch"
    *Cause:    One of the following
               - The string operands(other than an nlsparams argument) to an
               operator or built-in function do not have the same character
               set.
               - An nlsparams operand is not in the database character set.
               - String data with character set other than the database character
               set is passed to a built-in function not expecting it.
               - The second argument to CHR() or CSCONVERT() is not CHAR_CS or
               NCHAR_CS.
               - A string expression in the VALUES clause of an INSERT statement,
               or the SET clause of an UPDATE statement, does not have the
               same character set as the column into which the value would
               be inserted.
               - A value provided in a DEFAULT clause when creating a table does
               not have the same character set as declared for the column.
               - An argument to a PL/SQL function does not conform to the
               character set requirements of the corresponding parameter.
    *Action:
    

    Error returned for incompatibility of character as data types are not compatible.

    SQL>select rpad('Roster_num',20,' ') "Roster_num"
    from dual
    union all
    select TO_CHAR(RPAD(col4,20,' '))  "Roster_num" from t_test;
    
    Roster_num
    ------------------------------------------
    Roster_num
    Roster
    RKött                                                                                                                                                                                                    
    
    6 rows selected
    SQL>
    

    After the converted to the TO_CHAR problem solved

  • Problems with almost all of the adobe after Yosemite upgrade programs.

    It seems that each program has become a little bit broken.

    Here are some of my most frequent problems with creative cloud:

    -Photoshop (after having been opened for several minutes) cannot put items. "Photoshop cannot complete your request because of an error". Only solution restarts.

    -InDesign crashes at every second, I have change the pictures on the slips. Oddly precise timing but I tested.

    -Edge Animate freezes and crashes often.

    MacBook Pro (retina, 15 inches, mi 2014)

    Intel Core i7 2.2 GHz

    16 GB 1600 MHz DDR3

    Intel Pro Iris 1536 MB

    Please refer to:

    1Compatibility Mac OS X Yosemite (10.10) FAQ | CC

    2.adobe Creative Cloud CC Yosemite 10.10 difficulty

    Concerning

    Baudier

  • show all columns with union all

    Hi all
    select m_id, total, cat_id
    from scott.maintenance
    where prod_id = 1
    union all
    select m_id, total, prod_id
    from scott.maintenance
    where prod_id = 4
    How can I view all (and not common) columns of the two tables when I use union all like
    m_Id, total, cat_id, prod_id

    Thank you
    Johnny

    Hi, Johnny,.

    user9542267 wrote:
    Hi all

    select m_id, total, cat_id
    from scott.maintenance
    where prod_id = 1
    union all
    select m_id, total, prod_id
    from scott.maintenance
    where prod_id = 4
    

    How can I view all (and not common) columns of the two tables when I use union all like
    m_Id, total, cat_id, prod_id

    Thank you
    Johnny

    There is no need to make a trade UNION for this:

    SELECT  *
    FROM    scott.maintenance
    WHERE   prod_id IN (1, 4)
    ;
    

    If you really need to do a UNION and basic tables were the same or had the same number and types of columns, then you can use SELECT * in the two branches of the UNION:

    SELECT  *
    FROM    scott.maintenance
        --
    UNION ALL
        --
    SELECT  *
    FROM    foo.maintenance
    ;
    

    If the columns have different names in the two tables, the names of the first branch of the UNION will be used in the output.

    In all cases, you can add literal NULL values to the SELECT one or more branches of the UNION clause:

    SELECT  ename     AS name
    ,       hiredate
    ,       deptno
    FROM    scott.emp
        --
    UNION ALL
        --
    SELECT  dname     AS name        -- alias not necessary, but helpful
    ,       NULL      AS hiredate    -- alias not necessary, but helpful
    ,       deptno
    FROM    scott.dept
    ;
    

    Depending on your tables and your requirements of yor, you might be able to use SELECT * in a branch of the UNION.

    Published by: Frank Kulash, February 15, 2011 12:29

  • Adding columns with union all?

    --------------------------------------------------------------------------------------------------------
    SELECT BAGLANTIDATE, CABONE
    FROM SEDEF_BILGI
    WHERE CABONE = '1' AND
    BAGLANTIDATE BETWEEN TO_DATE('10-JUN-2009','DD,MON-YYYY')
    AND TO_DATE('11-JUN-2009','DD-MON-YYYY')
    
    UNION ALL
    
    SELECT KAYITDATE, ABONE
    FROM SEDEF_ISEMRI
    WHERE ABONE = '1' AND
    KAYITDATE BETWEEN TO_DATE('10-JUN-2009','DD,MON-YYYY')
    AND TO_DATE('11-JUN-2009','DD-MON-YYYY')
    ------------------------------------------------------------------------------------------------------------
    
    BAGLANTITARIH        ABONE
    ------------------------      ----------------
    10-JUN-09 03.01.52.546000000 AM 1          
    10-JUN-09 05.02.06.453000000 PM 1          
    10-JUN-09 01.01.20.421000000 PM 1          
    10-JUN-09 07.01.42.062000000 AM 1          
    10-JUN-09 09.44.59.515000000 AM 1          
    10-JUN-09 09.58.07.843000000 AM 1          
    10-JUN-09 09.01.50.546000000 PM 1    
    10-JUN-09 09.52.57.796000000 AM 1
    10-JUN-09 02.13.32.343000000 PM 1
    
    9 rows selected
    How can I add a column in the tables on that?

    Published by: niennamiriel on August 18, 2009 12:12 AM

    Yes it is possible.

    SELECT BAGLANTIDATE, CABONE, MSISDN
      FROM SEDEF_BILGI
      ...
    UNION ALL
    SELECT KAYITDATE, ABONE, null
      FROM SEDEF_ISEMRI
    
  • Problems with showing all text in pdf file

    Hi all
    I have this problem. When I download a pdf file on the Web site of our company as a link and then when I open the link, most of the text in the file is as symbols. The pdf file is a brochure and is exported from CorelDraw. The brochure consists of photos and text. For me, very important is to solve the problem, because most of our customers use Mozilla firefox and they must be able to see everything on the brochure.

    Thank you in advance.

    Best wishes

    Martina

    Hello again, yes the development version of the pdf viewer addon is a snapshot at the beginning of what will go into future versions of firefox. so when the display problem is not obvious in the version of the pdf viewer dev, this means that no bug must be filed and the solution is already underway to enter in the next update of firefox.

    I can't give you an exact date on what will be your problem in firefox, because without a real pdf taste it is not possible to know what bug caused the problem. However, according to the pdf.js developers a difficulty which is already present in the current version of the developer at least will make in firefox (scheduled for the end of April) 29.

    you could test yourself if the problem is still present in firefox (beta) 28 or 29 (aurora) firefox: https://www.mozilla.org/firefox/channel/

  • Confused problem with INSERT all THE

    OK, I'm really confused...

    I have a command INSERT EVERYTHING involving 5 tables and lots of columns

    My source query is a simple select issues from a single table.

    Some of my source query values have null for columns that are marked NOT NULL in the target tables.

    So, I don't NVL (COLUMN_NAME, 'Default value') AS COLUMN_NAME for these areas, but complains about the check constraint Oracle throw me an error for these fields!

    It's as if Oracle is completely ignoring my NVL... why? Is this because those check constraints are not marked delayed?

    Here's a quick example:

    INSERT ALL
    IN a (A, B, C) - C is marked NOT NULL
    VALUES (D, E, F)
    SELECT D, E, NVL(F, 'Default') AS F
    X WHERE...

    I tried to put the NVL in the VALUES (...)
    I tried to rename it to unique alias so as not to be confused with the original name of the column
    I was watching my query carefully to make sure I had the right position for this column (so that I'm not going to put this value in the wrong column)

    None of this does not work...

    The only thing that has worked... If instead of F I put just downright 'Default' values (...)

    What the hell?

    Published by: trant June 27, 2011 16:41

    Trant says:

    sb92075 wrote:

    Look for the section with the title "insertion of values with a subquery: example"& as it shows.

    This example is a unique table insert, my example is more like the one under "multi-table insert: examples.

    I have additional IN THE TABLE (...) VALUES (...) in the actual sql and WHEN conditions, but I feel it's not important of clutters so much information

    First of all do work, then make it fancy.
    Your test example was for a single table, then why don't he up SYNTAX error?
    If you can't INSERT work for a single table, you stand so NO chance to operate more than one

  • Problem with my all-in-one c309a print - prints not bed.

    I erased a jam in tray by pulling the rear paper on top by force.  Now the printer is trying to find a document in the feeder (pins turn, racing) and will not recognize a print job on the glass.  He throws a sheet Virgin the platen.  Is there any solution for this?

    I think so... Go to hp.com, C309a, solve a problem, the jams and the problems of food and go through the solutions here. The "Original Jam, clear Jam and press OK... article has been most useful, but one of the others also applies.»

    The printer still considers that there is something in the ADF, then don't look at the bed first. The foregoing can fix that.

    Chris W.

  • Problem with F4280 all-in-one to scan / Vista

    Document scanning or the picture comes out as a total black page. Has been no change before problem appeared.

    Best regards

    Sossou

    Hi Schouw,

    Looks like it could be the scanner bulb or the material.  Please try the following steps:

    1 make a copy black & white of any document you have handy. Keep a close eye on the print, if you see the machine starts printing a large band of black on the page, and then press the button "Cancel" (red X) to stop printing.  In this case, it is the material.

    In an attempt to adjust the equipment, please follow: lines or streaks in the Copies or Scans

    If this does not work, you will have to HP to find out what your phone options: http://welcome.hp.com/country/w1/en/support.html

    However, if the copy is ok, then could be a software problem. Please try this instead: http://support.hp.com/us-en/document/c00040499

  • Firefox becomes very slow with the all new Yahoo Mail

    Problems with the all-new Yahoo! Mail version: everything worked very well, but since the two latest updates of Firefox I started to notice that Yahoo was consuming a lot of CPU (it varies from 35% to 40% and is on the top list of programs CPU consumption) and the browsing experience is not so pleasant - slow. If I quit Firefox and reopen it, becomes faster, but after about 30 min slow / high CPU consumption again. Then I had to go back to the classic version of Yahoo Mail and everything works fine and consumed less CPU. Did I live it? Is it a question of Yahoo Mail? Is there a solution? (Macbook Pro early 2011 / Mac OS X 10.7.4 / Firefox 12.0) Thank you!

    Try to start Firefox in safe mode. This mode disables all extensions, customizations, hardware acceleration, etc., temporarily for the diagnosis and troubleshooting. If Firefox works fine in Safe Mode, then it is probably a problem with the add-on. Restart Firefox in normal mode, and then type "subject: addons" (without the quotes) in the address bar. Disable your extensions, restart Firefox between each one, until you find the troublemaker.

  • Problems with synchronization of Skype

    Hello

    I had a problem with Skype - all the messages that I sent to my group conversation did not go through. On this site, I have seen different fixes and tried. Unfortunately, none of them worked. One of them was by removing my %APPDATA%\microsoft\windows\sendto Skype folder, and so I did.

    It is important, because Skype has now no recent chat history. I find this curious, however, because both Skype on my Iphone and Skype Online recent conversations - including group chat, which, in both cases, work without problems.

    However, for some reason any Skype on my PC not will be not acquired data - I suppose that it supposed to download from a server? - and I can't check even if the focus group finally, works because it does not appear in my recent chat history or in my favorite contatns, in which I put it through Skype online.

    Except that most of my contacts on Skype PC lack their mood messages, which are present online Skype and Skype Mobile.

    Help, please

    Maybe it's a matter of time. The avatar must be updated when the user is displayed as being online on Skype.

  • problem with wireless pavilion 14-V041TX

    Hello

    I just buy Pavilion 14-V041TX and using windows 7 ultimate 64-bit.
    but I have problem with detecting all wify.
    I already install all drivers from the HP site for windows 7 64 bit and always show "no connection are available.

    In the Device Manager-> network-> only 2 drop-down menu card: 1. Broadcom BCM43142 802.11bgn card2 Wi - Fi. Realtek PCIe FE Family Controller.

    Note: no problem with my wify connection, because I can not used with my smartphone.

    Hello

    Please find the link given below might help you solve your problem. In case you have tried these steps made me know.

    http://support.HP.com/us-en/document/c02543015

  • Problems with Windows updater under Windows 7

    Hey Ive had problems to install the following Windows 7 updates:

    Update cumulative security for Internet Explorer 8 for Windows 7 (KB978207)

    Update security for Windows 7 for x 64-based systems (KB975560)

    Whenever I try to install these updates I receive error 800b0100 code and 8007065E. I tried to make these updates with my disabled antivirus software to see if that was causing the problem, but it still doesn't work. I use Windows 7 Professional 64-bit. Oh I also forgot to mention that it is only these updates I have a problem with. All other updates installed fine.

    Other features of the model

    2.6 ghz AMD Phenom II X 4
    4 GB OF RAM
    1 TB HD

    Run you Win7 64-bit, or is this a brand new supplied with Win7 64 bit computer preinstalled?

    What application or antivirus security suite is installed and your current subscription?  What anti-spyware (other than Defender) applications?  What third-party firewall (if applicable)?

    A (another) Norton or McAfee application has already been installed on the computer (for example, a free trial version which is preinstalled when you bought it)?

    The foregoing despite...

    Visit the Microsoft Solution Center and antivirus security for resources and tools to keep your PC safe and healthy. If you have problems with the installation of the update itself, visit the Microsoft Update Support for resources and tools to keep your PC updated with the latest updates.

    ~ Robear Dyer (PA Bear) ~ MS MVP (that is to say, mail, security, Windows & Update Services) since 2002 ~ WARNING: MS MVPs represent or work for Microsoft

  • SCAN UTILITY DOES NOT WORK WITH MY ALL-IN-ONE PRINTER

    Dear team,

    I am facing a problem with my all-in-one printer model "HP officejet 6500 e709 a" as it comes to the Analysis ToolPak.

    In other words, I am unable to scan documents because the sistem highlights me that it requires the software HP Photosmart (... I don't really know the reason why it back doesn't work anymore)

    Unfortunately I'm not able to find the original cd supplied with the printer, so what I can do to fix the problem.

    Thank you indeed for support kindly

    Annita bottle

    [email protected]

    Hello Annita1950,

    Please try the below mentioned steps...

    1 > open the directory C:\program imaging\bin HP and then search for the following file: hpiscnapp.exe
    2 > right click on it and then select Creat shortcut on the desktop.
    3 > now get on the desktop and double-click the shortcut for hpiscnapp.exe open a window.
    4 > click new scan to start the search.

Maybe you are looking for