Columns of Union two problem using the TO_CLOB function

Hello

Let me start by you (a simplified version of) showing the query I'm running:

SELECT
l.Person,
TO_CLOB(l.letter_code ||) "letter has been sent.") Note
letters l

UNION

Select
n.Person
n.Note
n notes

And here's the table structure

LETTERS)
l.Person varchar2 (10);
l.letter_code varchar2 (2);
*)*

NOTES)
n.Person varchar2 (10);
CLOB n.note;
*)*

Each request runs on its own without any problem but when I union together I get a ' * ORA-00932: inconsistent data types: expected - got CLOB * "error. I can't understand what is the cause. The TO_CLOB in the first query is to convert the varchar2 column in a CLOB then why would he be oppose to be clauses with the second query?

Any advice would be much appreciated! Thanks :)

You may not use the set operations, UNIONS, MINUS, INTERSECT with CLOB columns etc. simple as that.

Tags: Database

Similar Questions

  • Problem using the DECODE function

    I'm trying to decode what follows, but I seem to have a problem of syntax:
    decode
    (
           p.balls,p.strikes,
           1,0 '1-0 Count',
           2,0 '2-0 Count',
           3,0 '3-0 Count',
           0,1 '0-1 Count',
           0,2 '0-2 Count',
           1,1 '1-1 Count',
           2,1 '2-1 Count',
           3,1 '3-1 Count',
           0,2 '0-2 Count',
           1,2 '1-2 Count',
           2,2 '2-2 Count',
    ) as Count,
    what I'm trying to take place is whenever the column of balls a '1' and the column to strike a '0' to decode the number of 1 - 0"etc...

    Hello

    Why use DECODE at all?

    TO_CHAR (p.balls) || ' -' || TO_CHAR (p.strikes) || ' Count'
    

    Assuming that you really need to use DECODE: it only works on a single value.

    You can combine your two values into one:

    DECODE ( (10 * p.balls) + p.strikes
           ,  0, '0-0 Count'
           ,  1, '0-1 Count'
           ,  2, '0-2 Count'
           ,  3, '0-3 Count'
           , 10, '1-0 Count'
    ...
           , 32, '3-2 Count'
           )
    

    or DECODE the two columns separately.

    DECODE ( p.balls
           , 0 '0-'
           , 1 '1-'
           , 2 '2-'
           , 3 '3-'
           )
    ||
    DECODE ( p.strikes
           , 0 '0 Count'
           , 1 '1 Count'
           , 2 '2 Count'
           )
    
  • Problem using the AVERAGE function

    So, I have the following query:

    Oracle 10g
                    select distinct
                                  avg(sum(plyr.avg_speed)) as tm_speed,
                                  sch.game_code,
                                  sch.home_team_name as team_name,
                                  tm.team_id
                                  
                           from
                                  soccer.soccer_optical_player_gm_stats plyr,
                                  soccer.soccer_optical_team_gm_stats tm,
                                  customer_data.cd_soccer_schedule sch
                           where  sch.season_id = 200921
                           and    tm.team_id = sch.home_team_id
                           and    sch.game_code = plyr.game_code
                           group by
                                  sch.game_code,
                                  sch.home_team_name, 
                                  tm.team_id
    When I try to execute the query I get the following error: not a function single-group grou.

    Some examples of data (and I've adjusted the query slightly to make it work with sample data):
    create table optical_player_gm_stats as (
               select 454654 game_code,32.546 avg_speed from dual union all
               select 887878,31.465 from dual union all
               select 454654,24.488 from dual union all
               select 454654,24.447 from dual union all
               select 887878,18.998 from dual union all
               select 255555,10.001 from dual union all
               select 200081,10.021 from dual
              );
              
    create table optical_team_gm_stats as (
               select 454654 game_code,5555 team_id from dual union all
               select 887878,1122 from dual union all
               select 454654,5555 from dual union all
               select 454654,5555 from dual union all
               select 887878,1122 from dual union all
               select 255555,5555 from dual union all
               select 200081,3144 from dual
              );
              
    create table soc_schedule as (
               select 454654 game_code, 'Cats' home_team, 200921 season_id, 5555 home_team_id from dual union all
               select 887878,'Sharks',200921,1122 from dual union all
               select 200081,'Grizzlies',200921,3144 from dual
              );
         
    --Adjusted query so it works with sample tables above     
      select distinct
                                  avg(sum(plyr.avg_speed)) as team_speed,
                                  sch.game_code,
                                  sch.home_team as team_name,
                                  tm.team_id,
                                  null
                           from
                                  optical_player_gm_stats plyr,
                                  optical_team_gm_stats tm,
                                  soc_schedule sch
                           where  sch.season_id = 200921
                           and    tm.team_id = sch.home_team_id
                           and    sch.game_code = plyr.game_code
                           group by -- plyr.avg_speed,
                                  sch.game_code,
                                  sch.home_team, 
                                  tm.team_id  
              
    Published by: user652714 on May 12, 2009 11:42

    Hello, you should not use SEPARATE functions of aggregation (aggregation will produce the DISTINCT records in which you are going to GROUP BY for aggregation). In addition, AVG (SUM (()) makes no sense: AVG() on its own is what you need - it is never necessary to nest functions of aggregation like that.)

    Therefore, try:

    select  avg(plyr.avg_speed) as tm_speed,
                                  sch.game_code,
                                  sch.home_team_name as team_name,
                                  tm.team_id
                           from
                                  soccer.soccer_optical_player_gm_stats plyr,
                                  soccer.soccer_optical_team_gm_stats tm,
                                  customer_data.cd_soccer_schedule sch
                           where  sch.season_id = 200921
                           and    tm.team_id = sch.home_team_id
                           and    sch.game_code = plyr.game_code
                           group by
                                  sch.game_code,
                                  sch.home_team_name,
                                  tm.team_id;
    
  • problems using the replace() function

    Hey everybody. :)

    I wrote a query that finds the address of a company (5 columns and concatenates into one). These columns are street, city, County, telno and faxno.
    Some of the companies have a null value for the County, that is when I write the query that it returns a similar result to... 3 main Street, Manchester, 0384758948, 04857846927, but if there was a County it would be 3 Main Street, Manchester, Greater Manchester, 0384758948, 04857846927.

    I tried to write the query then if it is not a County, it removes just the comma and the address becomes 3 Main Street, Manchester, 0384758948, 04857846927... but I can't seem to understand so I thought I'd come and ask the professionals. :)

    set linesize 100
    column suppname heading "name of the provider.
    Select suppname, street | ', ' || City | ', ' || County of | ', ' || Zip code | ', ' || telno | ', ' || faxno "address of supplier.
    from suppliers
    where the County is null
    Replace (County, County, ");

    It gives me an error "command not completed successfully", but I can't for the life of understand me why.

    Thank you in advance. :)

    If the County is optional, you can concatenate the like this:

    select suppname, street || ', ' || town || ', ' ||
        nvl2(county, county||', ', null)
               || postcode || ', ' || telno || ', ' || faxno "Supplier Address"
    

    (you can do the same for the other columns if necessary)

  • Do I need to use the NVL function for this request?

    I seem to have some problems using the NVL function on a date. I'm trying to create a query pulls back just a date a file was sent between the sysdate and the date_sent more a minute. Here is the code I use...

    Oracle: 10.2 G
    SELECT date_sent as date_sent
    INTO    iDateSent
    FROM    tableX
    WHERE  file_id= 9999
    AND    date_sent BETWEEN sysdate AND date_sent + 1/1440; 
    Currently Output (null):
    DATE_SENT
    Desired output when date_sent is null:
    DATE_SENT
    0:0:000 0:00:00
    Note:
    date_sent column is in a normal date - same format as sysdate format.

    The problem I encounter is when date_sent is null, the stored procedure, I built crashes because date_sent returns a null and a null value cannot be stored in the variable 'iDateSent '. I was thinking about using the NVL function here to resolve, however, I'm not entirely sure who will work with the above query. Any thoughts?

    Published by: user652714 on July 9, 2010 12:58

    Published by: user652714 on July 9, 2010 13:11

    Hello

    you said: "desired output when date_sent is null: date_sent: 0".
    It is not possible to have a date of 'zero '.

    "and a null value cannot be stored in the variable 'iDateSent'. '.

    I do not think: If this variable is declared normally (without any not null not constrained to this topic) so that it can contain a null value. (it's 99% of the time in PL/SQL).

    I think it's that your SQL retrieves no rows, to manage what you should put an exception handler:

    begin
    SELECT date_sent as date_sent
    INTO    iDateSent
    FROM    tableX
    WHERE  file_id= 9999
    AND    date_sent BETWEEN sysdate AND date_sent + 1/1440;
    exception when NO_DATA_FOUND then
     iDateSent:=null;
    end;
    

    So what you can do if you don't want the date empty a nvl:

    return(nvl(iDateSent,sysdate));  -- or another date ...
    

    Published by: user11268895 on July 9, 2010 22:09

  • problems using the snap have amd, playback of Jpeg files

    Original title: I'm having problems using the component feature snap-in.

    Sometimes a single document disappears. When this happens while the document program is managed by then will not work. The document seems to be flying around the office. The last time this happened I had a doc JPEG upward and now I can't see what is JPEG. I don't know why the document wants to fly around, and I don't know how to get my use of the JPEG back.

    Hey Graham,.

    To view all jpeg images in the Viewer Windows photo or any other photo software visualization, you must configure this software as a default value in the default programs.

    Check out the link that allows you to configure the program as default.

    http://Windows.Microsoft.com/en-in/Windows7/change-which-programs-Windows-uses-by-default

    You can try to run the Aero Troubleshooter and see if that makes a difference.

    http://Windows.Microsoft.com/en-in/Windows7/open-the-Aero-Troubleshooter

    If the problem persists, provide us newspapers observer of events, as well as the error message if you receive a message.

    http://Windows.Microsoft.com/en-in/Windows7/open-Event-Viewer

  • I'm having a problem using the slideshow module in LR 6.3. The slideshow contains the background image as one of the images to display. Earlier, I had created a slideshow of practice and the background image was not displayed as an image in itself. How to

    I'm having a problem using the slideshow module in LR 6.3. The slideshow contains the background image as one of the images to display. Earlier, I have created a slideshow of practice and the background image was not displayed as an image in itself. How to make it behave?

    Another approach, perhaps a little more elegant (?). Create a collection that includes images for the slideshow. Include the background image in the collection. Drag the background image in the Panel to designate. Then, remove this image from the collection and create the slide show. I just tried and it works, too.

  • Photoshop CS4 - is - does anyone know how to find out if two people use the same file?

    Photoshop CS4 - is - does anyone know how to find out if two people use the same file?

    Yes, I assumed that was the case, and I thought that this link addressed to her.  I would have thought it was more a function of your network and the OS than Photoshop.

  • Problem in the export using the QUERY functionality

    Problem in the export using the QUERY functionality


    I'm trying to export some rows in a table using the query functionality
    and I have some errors... I'm using the syntax is

    system@orcl QUERY = scott.emp expdp: '"WHERE emp_no = 123455" '
    DIRECTORY = data_pump_dir DUMPFILE = data_pump.dmp
    LOGFILE = data_pump_12345.log INDEX = n

    Can someone tell me please the problem with that statement

    I also tried to use the simple export

    exp file system@orcl = orcl_export.dmp log = orcl_export.log
    tables = Scott.EMP index = QUERY = n------"WHERE emp_no\ = 123455\"

    and this error

    EXP-00008: ORACLE error 904
    ORA-00904: identify invalid

    My os is Solaris
    Please let me know what the problem

    Hello

    Try to create parfile and use that, otherwise, you will need to escape each clause correctly to run exp or expdp successfully.

    test.par

    tables=emp
    query="WHERE emp_no=123455"
    
    or
    tables=myobjects
    query="WHERE owner='SYS'"
    
    $> exp username/password parfile=test.par
    
    Export: Release 10.2.0.1.0 - Production on Thu Mar 19 10:17:48 2009
    
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining Scoring Engine options
    Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
    
    About to export specified tables via Conventional Path ...
    . . exporting table                      MYOBJECTS      22650 rows exported
    Export terminated successfully without warnings.
    

    Concerning

    Published by: OrionNet on March 19, 2009 10:21

  • Using the Replace function

    Hi all

    I have a column called supplements and it has values such as

    1. the payment is > 90 days
    2. the payment is < = 10 days

    Now, I want to use the Replace function to replace > and < to "greaterthan".
    and 'lessthan' RESP, but the problem is that, in the function replace, I can give that one argument. So what I do is in the region of fx for the column

    Replace (supplements,' > ',' greaterthan')

    This replaces the > sign very well with string greaterthan and show me values such as

    1. the payment is greaterthan 90 days
    2. the payment is < = 10 days

    but I want to replace < "lessthen" also, how can I do? Can I undergo two replace statements? How can replace several string or special characters for a single column?

    Help, please.

    Thank you
    Ronny

    Try this
    CASE
    WHEN supplements LIKE ' % > %' THEN Replace(latepayment,'>','greaterthan')
    WHEN supplements LIKE ' %<=%' then=""><>
    END

  • PS elements 11 cannot use the text function. Error message could not initialize the text.

    When I try to use the text function the letters do not appear. Text feature appears frozen. Get the error message - unable to initialize the text.

    Recently PSE11 uninstalled and reinstalled. Downloaded 2 Google font. Was able to use the text function with Google fonts with no problems. Two days later, attempted to work with the text function and the typed letters appear on the screen/layer. Tried to add the text with fonts pre-installed PS - still once, no text appeared. Impossible to set up a text box. How can I fix it? Thank you

    Suggest that you reset the text tool, that only he can fix.

    I believe in PSEv.11, there is a small arrow, top of the page to the left on the tool options bar. Click on this.

    If the arrow is not there, look in the options bar to the text tool, on the right, for a box with lines inside. Adobe changed the location and icon in later versions of the program.

  • Problems with the Row_Number function

    I have problems with the Row_Number function. I use to assign line numbers to records where a student has a note of passage on a module and the exclusion of the modules failed (I want to show her a 0 as the line number for the modules failed). The problem is that when I try to use a condition, the report still assigns a line number to a defective module if it does not display it (it shows a 0 I wanted to show him). The results are displayed as follows:

    Line number Module Grade
    1ModuleAPass
    2ModuleBPass
    0ModuleCIn case of failure
    4 (instead of 3)ModuleDPass

    How can I make him jump to assign a line number to all the modules failed? Please help.

    Thank you.

    Thank you very much, Melanie. I made changes to query as per your suggestion, which is a union of the modules failed and passed (using row_number on success modules). Thanks for the solution.

  • How to use the NVL function to a parameter with comma delimited values

    Gurus,

    It is confusing to me.  I am trying to use the NVL function, but the setting that I'm passing in my cursor contains multiple values with commas.  The NVL function is confused when analyzing the values.

    'Where' cursor clause...

    and nvl (sn.c_attribute1,'x@#$%') in nvl (p_desig,'x@#$%'( )

    translated parameter values...

    and nvl (sn.c_attribute1,'x@#$%') in nvl ('SPRT''GOOD' 'BAD' 'x@#$%') -NVL does not parse the value correctly

    Any idea on how to get NVL recognize 'x@#$%' , if p_desig is null?

    Thank you

    Scott

    HI, Scott.

    Whenever you have a problem, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements) of all the tables involved, so that people who want to help you can recreate the problem and test their ideas.

    Also post the results you want from this data, as well as an explanation of how you get these results from these data, with specific examples.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002#9362002

    My best guess, based on what you posted bone is present, that your problem is discussed in the following:

    http://tkyte.blogspot.com/2006/06/varying-in-lists.html

    http://www.Oracle-base.com/articles/Misc/DynamicInLists.php

  • Very urgent - using the ISERROR function in HFR

    Hi all

    Its very urgent requirement for us.

    How can we use is the function of error in HFR.bcoz if the two values in the formula ex: has / b; a = 0, b = 0; then it shows some garbage value.i came to know that we can achieve this
    using the ISERROR function function.but i dnt know how to use it.

    Thank you
    Ravi

    Hello

    It can be done in this way using IfThen condition

    IfThen (IsErr ((ligne/colonne de référence), 0, (reference line/column)))

    where IfThen checks the condition

    Condition is ESTERR, it returns true when row/column reference forms, has a value of #error, so much affect you 0 (or any value you want) returns something else real calculated value of row/column of formulas.

    PS: Only the columns and rows formulas can cause #error.

    See you soon
    Vikas nasri

  • By using the Concat function - in Excel Source

    Hello
    I use an Excel file in a table source and oracle as a target.

    In the Excel file, I need to concatenate two columns and map it to the column oracle target based on a condition.

    I used the concat function in editor Expression, but its throwing an error "Undefined event" as our source is not an oracle.

    What should I do to run the ODI excel function?

    Thanks in advance
    RAM Mohan T.

    Hi Ram,

    Run this function by selecting "transit Zone". I mean select column and say to run on the staging of option button.

    Thank you
    G

Maybe you are looking for

  • Folder switch car Icloud?

    Hi, I would like to move all the folders and files on the Icloud drive on my desktop. I can't... I have cjhecked all the texts support and can't find an easy way to do... I would just drag files to disk on my desktop but it is not possible. Please he

  • Request to another DNS server if the connection fails with the current

    Hello I would like to ask whether there is an available addon or a feature hidden in Firefox, which allows him to activate try to use other DNS servers if a connection has failed to a server. Lets make an example, would be the best way to explain: 1.

  • Re: Satellite A200-175: driver Vista need Wireless HotKey Utility FN + F8

    Please need drivers Wireless HotKey Utility for Vista (FN + F8). TNX.

  • Deskjet 4400 series: How can I get to the HP Solutions Center?

    I can't find any Solutions HP Center on my computer. According to the on-site HP troubleshooting page, I navige'yi Windows icon all programs--> HP--> HP Solutions Center's-->.  But there is no HP very well under all programs.   I followed the instruc

  • problems with bluetooth

    Hello everyone. I have an aspire8290g with bluetooth button. My mobile samsung works with usb is plugged. I tried all of the updates. He won't know. Am I missing something easy? Thank you