How do you alias the results of a case statement

I am trying to create a derived table and I get the error
"each calculated column must have an explicit name"
I added the as shiptype to the end of the line and that did not work. Any thoughts?
shiptype = case when araddr.invno is not null then 'ADDR' else (case when arcadr.custno is not null then 'CADR' else 'CUST' end) end as shiptype,
Thanks
Jeff

Hi Jeff,
your select statement should look like this...
select column1,column2,(case when araddr.invno is not null then 'ADDR' else (case when arcadr.custno is not null then 'CADR' else 'CUST' end) end) as shiptype from Table
This will work....
Cheers,
Ravichandra K

Similar Messages

  • How do I return the results of two SELECT statements in to one result?

    I want to do this without using UNION.
    Here's an example of what I'm trying to do:
    I have a table called COUNTRY with the following columns:
    COUNTRY
    COUNTRY_CODE
    DATE_VISITED_LAST
    POPULATIONI have another table called STATE_COUNTY with the following columns:
    STATE_COUNTY
    COUNTRY_CODE
    STATE_COUNTY_CODE
    DATE_LAST_VISITED
    POPULATIONI have a third table called TOWN with the following columns:
    TOWN
    COUNTRY_CODE
    STATE_COUNTY_CODE
    TOWN_CODE
    DATE_LAST_VISITED
    POPULATIONNow through the interface I have, a user will supply a country code. I need a SELECT statement that will return a table with the following result set:
    The COUNTRY_CODE entered including the DATE_LAST_VISITED and POPULATION for this country
    ------> All the associated STATE_COUNTY's belonging to this country along with the DATE_LAST_VISITED and POPULATION for each STATE_COUNTY_CODE.
    -------------> All the associated TOWN_CODE's belonging to this state_county and country along with the DATE_LAST_VISITED and population for each TOWN.
    So the table will have 9 columns:
    COUNTRY
    DATE_LAST_VISITED_COUNTRY
    POPULATION_COUNTRY
    STATE_COUNTY
    DATE_LAST_VISITED_STATE_COUNTY
    POPULATION_COUNTY
    TOWN
    DATE_LAST_VISITED_TOWN
    POPULATION_TOWNAny ideas how this can be done?
    Thanks.

    Hi guys,
    Would it be ok to do it like this (with a join):
    SELECT      
         c.country_code,
         c.date_last_visited AS DATE_LAST_VISITED_COUNTRY,
         c.population AS POPULATION_COUNTRY,
         s.state_county_code,
         s.date_last_visited AS DATE_LAST_VISITED_STATE_COUNTY,
         s.population AS POPULATION_COUNTY,
         t.town_code,
         t.date_last_visited AS DATE_LAST_VISITED_TOWN,
         t.population POPULATION_TOWN,
    FROM
         country c
         LEFT OUTER JOIN state_county s ON s.country_code = c.country_code
         LEFT OUTER JOIN town       t ON t.country_code = s.country_code
    AND                                       t.state_county_code = s.state_county_codeThe results required would be something like:
    Country_Code     DATE_LAST_VISITED_COUNTRY     POPULATION_COUNTRY     STATE_COUNTY_CODE         DATE_LAST_VISITED_STATE_COUNTY         POPULATION_COUNTY     TOWN_CODE     DATE_LAST_VISITED_TOWN     POPULATION_TOWN
    UK               14-JAN-09                     56,00000               London                    18-JUL-99                              23,0000               Ascot         30-JUN-89                  12,000
                                                                                                                                                                 Brixton       28-JAN-92                  4,684
                                                                          Birmingham                12-SEP-09                              55,678                Solihull      12-OCT-81                  6.768 Does this make sense?
    Thanks!
    Edited by: Sastry on Nov 2, 2009 2:04 AM

  • How can i display the result of java class in InputText ?

    Hi all,
    How can i get the result of java class to InputText Or OutputText ???
    also can every one in the forum give me road map for dealing with java in oracle adf because i'm beginner in oracle adf
    i saw some samples in oracle adf corner but it's difficult for me.

    User,
    Always mention your JDev version, technologies used and clear usecase description (read through this announcement : https://forums.oracle.com/forums/ann.jspa?annID=56)
    How can i get the result of java class to InputText Or OutputText ???Can you elaborate on your requirement? Do you mean the return value of a method in a class as output text? Or an attribute in your class (bean?) as text field?
    -Arun

  • From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    Hi,
    Use NVL or COALESCE:
    NVL (col_a, col_b)
    Returns col_a if col_a is not NULL; otherwise, it returns col_b.
    Col_a and col_b must have similar (if not identical) datatypes; for example, if col_a is a DATE, then col_b can be another DATE or it can be a TIMESTAMP, but it can't be a VARCHAR2.
    For more about NVL and COALESCE, see the SQL Language manual: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions119.htm#sthref1310
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • No longer use this email account but how do you backup the email that is...

    No longer use this email account but how do you backup the email that is in the "example" folder, So that I can delete the account on my mail app?

    Not sure what you mean. Deleting a POP account only deletes the messages stored in the account’s mailboxes, not any messages stored in custom “On My Mac” mailboxes, if that’s what you mean. It’s not that Mail goes after your mail trying to delete as much as it can. It’s just that if a mail account is deleted, then its mailboxes cannot exist anymore...
    That said, instead of deleting the account right away, you can just disable it (i.e. turn OFF Preferences > Accounts > Advanced > Enable this account), leave it that way for some time, and delete it only after making sure you didn’t miss anything while the account was disabled.
    BTW, if you back up your data, and the ~/Library/Mail folder in particular, you won’t have to worry about accidentally losing anything as a result of doing something like that...
    Note: For those not familiarized with the ~/ notation, it refers to the user’s home folder. That is, ~/Library is the Library folder within the user’s home folder, i.e. /Users/username/Library.

  • How I can displsy the results in a nice readable format

    I have this query in a cursor
    I is displaying the data like this
    Major/Minor RestrictionEnglish English and Theater Envir St-English
    How I can make it to display something like this
    Must be enrolled in one of the following Majors:
    English, English and Theater, Envir St-English
    looks easy but the descripton come from the union (cllumn    stvmAjr_desc)
         SELECT
         DISTINCT
           ssrrmaj_major_ind,
            DECODE (
                       ssrrmaj_major_ind,
                       'I', g$_nls.get ('BWCKSCH1-0088',
                               'SQL',
                               'Must be enrolled in one of the following Majors:' ,'<BR />'
                       'E', g$_nls.get ('BWCKSCH1-0089',
                               'SQL',
                               'May not be enrolled in one of the following Majors:','<BR />'
                          indicator1
                FROM ssrrmaj,
            scbcrse,
           ssbsect
          WHERE     scbcrse_subj_code = ssbsect_subj_code
          AND SCBCRSE_CRSE_NUMB = ssbsect_crse_numb
           AND ssrrmaj_crn = ssbsect_CRN
          --- AND ssrrmaj_majr_code = stvmajr_code
           AND ssrrmaj_term_code = ssbsect_term_code
           AND ssrrmaj_major_ind IS NOT NULL
           and SSRRMAJ_TERM_CODE = term  
           and ssbsect_subj_code = subj
           and ssbsect_crse_numb = crse_numb      
           UNION
           SELECT
           DISTINCT
             stvmajr_code,
           stvmAjr_desc
         FROM ssrrmaj,
            scbcrse,
           ssbsect,
          stvmajr
      WHERE     scbcrse_subj_code = ssbsect_subj_code
          AND SCBCRSE_CRSE_NUMB = ssbsect_crse_numb
           AND ssrrmaj_crn = ssbsect_CRN
           AND ssrrmaj_majr_code = stvmajr_code
           AND ssrrmaj_term_code = ssbsect_term_code
           and SSRRMAJ_TERM_CODE = term 
           and ssbsect_subj_code =  subj
           and ssbsect_crse_numb =crse_numb
           ORDER BY ssrrmaj_major_ind DESC;
      the second query display the data after the union
    like this
    1250 Earth and Oceanographic Sci
    1310 English and Theater
    1300 English
    1450 Envir St-English
    I guess I can deal with the dis play like
    this I only need the desc not the code
    Earth and Oceanographic Sci
      English and Theater
      English
    Envir St-English
    This is how I am displaying the results, the results are correct, I just need to diaplay the data in a more friendly format
    HTP.p ('<h4>Major/Minor Restriction</h4>');         
           FOR  ssrrmaj_major_REC IN  ssrrmaj_major_c (term_in,ssbsect_rec.ssbsect_subj_code,ssbsect_rec.ssbsect_crse_numb)
            LOOP
                IF  ssrrmaj_major_REC.ssrrmaj_major_ind IS NOT NULL
                THEN
                ----HTP.p ('<h4>Major/Minor Restriction</h4>');
                 twbkfrmt.p_printtext (ssrrmaj_major_REC.indicator1);  HTP.p ('<BR />') ;
                  ELSE
                  HTP.p ('<h4>Major/Minor Restriction N/A</h4>');
                  END IF;
                END LOOP ;   

    Just a thought...I suggest to use XSLT for doing these type of formatting. Its more flexible to get XML for te query columns and then define the formatting at XSLT level. This way you dont have to keep changing the procedure or query. Just XSL change will do the job..

  • How do you verify the completeness of a restoration drill?

    One responsibility of the DBA is to ensure the database backups are usable. Running the restore / recover commands in rman is easy. However, how would you verify the correctness of the restoration? Or do you believe that when rman says it's Ok and oracle merrily open the database, then it's OK? And how about point-in-time recovery (which seems even more difficult to verify)?
    (Even though this is a generic question, here is the a database version if needed as basis of discussion:
    Oracle: 10.2.0.4
    OS: RHEL 4
    Edited by: thtsang on Oct 15, 2010 11:06 AM

    I would prefer the verification to be done in database perspective. If there is no data loss / inconsistence in the database, it should also be OK for the application.
    And if queries on key tables were used, has any one experienced any issue? If so, what's the cause and what's the resolution? And for restoration for hot backup or point in time recovery, it is difficult to confirm what's correct result, because the data was not fixed during the restoration.

  • How do you set the duration for multiple stills in iMovie 2013?

    How do you set the duration for multiple stills in iMovie 2013?
    Before upgrading to the latest version of iMovie last month, I was able to set the duation of all of the stills included in an iMovie project at one time by clicking the apply to all still box in the adjustment pop up. That option is no longer apparent. If it is available I cannot find it, and I have tried several different ways to accomplish it. I have tried the iMovie help section and can find nothing to help.
    Apple, do I really have to adjust close to 500 pictures to a 5 second duration individually???
    REALLY??!!

    ...why wouldnt people want that level of accuracy when animating, especially when working to music at a specific duration?
    Because often people are animating to words or beats in the music.  Music is rarely performed with a computer-precise beat and tempo.  Musicians aren't robots: they swing the beat sometimes.  They use rubato.  They change tempo.  They change time signatures.  As a result, you have to FIND those words and beats.  It's not a situation where you can say, "There!  I've found the duration of one beat!  Now it's easy to find the rest of them!" 
    If you try it, you will be very disappointed.
    Try finding the precise end of a piece of music that fades or ends on a big chord with a ring-out.  You'll see that it's trial-and-error: what's the point where it becomes inaudible?  It depends on how high your speakers are turned up.  You might have them way up, you set an end point for the layer, and then you do a RAM Preview at a more reasonable volume.  You might say, "Hey!  The music ends before the layer ends!"...  but you KNOW you set the layer's out point when the audio file goes silent.
    AE has layer markers that can be used on an audio layer to mark beats, words, etc. They come in very handy.
    I guess it comes down to this: because AE can do so much different stuff, there are very few automated procedures.  Oh, Adobe tries with effects that convert audio levels to keyframes, but they're not 100% reliable... especially on something like a capella choral works.  For true accuracy, you need  find the timings yourself. 
    If you want something simpler, try a different application. But be prepared for lower level of accuracy.

  • How do you set the number of rows in a spreadsheet, so that even when you drag data in, in writes over those rows instead of adding a new row?

    How do you set the number of rows you want in a spreadsheet, so that even when you drag data in, in writes over those rows instead of adding a new row?

    After the discovery reported above, I filed this report :
    Bug ID# 10073038
    Summary:
    When Numbers is used on a system with decimal comma a csv file may be good AND wrong
    Steps to Reproduce:
    With Numbers v2, you introduced an interesting enhancement.
    In system using the comma as decimal separator, Numbers requires csv files using the semi-colon as values delimiter.
    In fact it’s true if we OPEN the document dragging its icon on Numbers one or thru the open dialog.
    This said.
    (1) Drag and drop a csv built with the 'semi-colon' standard on a table or on a sheet
    (2) Drag and drop a csv built with the 'comma' standard on a table or on a sheet
    Expected Results:
    Every normally constituted user assume that in
    case (1) he will get a perfectly built table
    case (2) he will get every cells of a row in a single cell
    Actual Results:
    In fact you forgot the drag and drop way of use and in
    case (1) every values separated by semi-colon are inserted in a single cell
    case (2) values separated by comma are correctly spread in a table
    isn’t it ridiculous ?
    Regression:
    Except looking in  QuickView to see which is exactly the structure of the file to decide the way we will insert it in a Numbers document, we may use an applescript fair enough to replace the semi-colons by TAB characters
    or
    to replace the commas by TABs and the decimal periods by commas
    Notes:
    While I am on this subject, I wish to make two proposals:
    (1)  It would be fine to format the date according to the ISO format year-mm-dd when you export a Numbers doc to csv.
    Doing that, dates would be imported correctly in every countries.
    At this time, on an English system, you export as mm/dd/year.
    If the doc is open on a system using the format dd/mm/year, the results will be odd.
    On a system using the format dd/mm/year, you export this way and so, if the doc is open on a system using the format mm/dd/year the results are odd too.
    As every localized versions accept the ISO format (at least on entry), using it in the export scheme would give a correct behavior everywhere.
    (2) It would be fine to add the format Tab Separated Values in the Export pane.
    TSV + ISO date format would give documents opening flawlessly everywhere.
    Yvan KOENIG (VALLAURIS, France) dimanche 4 septembre 2011 21:27:41
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community

  • How do you know the best iMac display size

    how do you know the best iMac display size
    Only on them fits in the screen window and that makes the font so tiny.  The others are too wide or too tall.  I usually view at 150 - 200% for vision issues.

    You say it's better to do the Media Browser?  I'm fairly new to movie, dvd and garage band.  How would I go about using the Media Browser instead of straight to iDVD?
    Select Your project - go up to Share - Share to Media Browser and as Large (Not HD)
    In iDVD select a nice theme - click on Media button - click on Movie - Select Your movie.
    NOW - Save as a DiskImage - and test this before burning DVDs - if this Plays OK then either burn the Image by using Disk Util tool (and set down burn-speed to x4) - or burn via iDVD (will take more time)
    I want to keep as much quality as I can.
    Then don't use iMovie'08 or 09 or 11 - as they all discard every second line resulting in less quality on the DVD. I use iMovie HD6 or FinalCut any version.
    Also...I tried to split my project in iMovie...but couldn't find a way.  I wound up just making a copy and then deleting out a handful of scenes from the copy...I still have the original at 4:12hrs.  Is there a way in iMovie to split a project? 
    I would make a copy and cut away a bit from the end - calling this Part 1 and from start of the other copy Part 2.
    OR - there are other programs that can squees in more to a DVD e.g. Roxio Toast™ - BUT this has two cons.
    • It costs - to me it was well spent mony as it can so much more e.g. back engineer a DVD to an editable form
    • Squeesing in more on a DVD - costs in QUALITY - and as You want as much as it can be - then 90 minuts portions encoded with Pro-Quality encoding and full quality interlasced material from a video-editor that delivers this is the way to get 100% of what DVDs can do.
    DVD is as standard only SD-Video - HD not possibly. Then You need Blu-Ray. (also Roxio Toast™)
    Yours Bengt W

  • How do you match the audio and text with the typer writer effect in Final Cut Pro?

    I am making a video and I want to sync up the text with the audio using the typer writer effect.  For example I want when the music makes a bing noise I want a letter to pop up.  How do you set the exact time for each letter that comes up instead of just choosing the duration.
    Thank you!!!!
    Virginia

    The most common cause is user error in understanding how these things are recorded in the acquisition system. You've got to first determine in it's easily solved by properly transcoding or if you're actually just seeing a display lag. Mismatched sync is based on different timebase scales so the offset gets worse the longer a clip plays.
    The most common solution is to unlink the components, time them precisely to the frame, and change the speed of one component to match precisely the length of the other. It's easy and usually results in a slight pitch change that is indiscernible.
    But you want to figure out the cause, not just he solution, so you can fix it in production instead of in post.

  • How do you change the colors of individual cells within a 2D array?

    How do you change the colors of individual cells within a 2D array of numeric indicators?
    I want the VI to check a data value and if it is failing, white out a square at a specific index coordinate.  I have it working with color boxes, but I'm not sure how to use the property node function, to change the color of individual cells, by coordinates.
    I have attached the VI using color boxes. If you run the VI, the box corresponding to the Step control should turn white.
    I want to do the same thing, using numeric indicator boxes inside the array.
    Thanks for any suggestions...
    Attachments:
    Fill DME matrix.vi ‏95 KB

    Get rid of all these sequences! That's just bad form.
    Your code has a few logical problems. Why do you create a boolean array if you later only look at the last element (Yes, the FOR loop does nothing useful, except in the last iteration because your outputs are not indexing. All other iterations are useless, you only get the result of the last array element. My guess is that you want to color the index white if at least one of the numbers is out if range. Right?
    It is an absolute nightmare to manage all your numeric labels. Just read them from a 2D array. Now you can simply find the index of the matched elements and don't have to spend hours editing case structure conditions.
    Attached is a simple example how you would do what I meant (LV7.1). Modify as needed.
    Message Edited by altenbach on 04-04-2006 02:04 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Fill_2DME_matrixMOD.vi ‏70 KB

  • How do you hold the Magic Mouse?

    I've had my Magic Mouse for about a month now and the one thing that's really got me on the verge of swapping it out is how I inadvertently move the canvas when I'm working with Photoshop, Illustrator, etc.  With standard mice you don't really have to care about the state of your index finger  after you click or how it may slightly touch the surface as you move the mouse around, but with the MM it's something to be conscious of.  When I stop to inspect the mechanics of how I use a mouse, it's amazing how often my index finger inadvertently bounces back and forth from the surface.  When I'm lifting up, setting back down, considering a click, scrolling, etc.  I'm gonna try to consciously keep my index finger down when I'm moving the mouse around in hopes that it'll stop this unwanted result.
    So how do you hold the Magic Mouse?  Is your index finger always down when you move it around?

    Good question. Seems i use the middle finger for everything except for when I need to swap desktops or do other stuff with mission control.

  • How do you count the multiple columns of a field in a table

    How do you count the multiple columns of a field in a table

    Hi,
    4396bf34-e890-4202-a6b0-4e08c9ff0e89 wrote:
    How do you count the multiple columns of a field in a table
    Whenever you have a problem, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002
    "Field" isn't a standard database term.  Some people say "field" when they mean "column", but I don't think that's what you mean ("How do you count the multiple columns of a column ..").  Do you want to know how many times a column is used (as opposed to NULL), or the number of different values in a column?  You really need to show what you want.

  • How do you include the actual CLOB value as ASCII when writing XML?

    When using the XDK for PL/SQL ( creating XML from query ) and the table that you query has a CLOB column the value in the resulting XML document is
    written as:
    <column>(CLOB)</column>
    how do you get the api to write the actual CLOB data?

    That article is talking about choosing HOW to STORE an XML document.
    I want to know how to write the contents of a CLOB column along with the other columns in a table in a single XML document.
    I know how to store an XML doc as a clob I know how to store an XML doc object relationally.
    I I have a table with 5 varchar2 columns 5 number columns and 1 clob column and I create an xml document as a clob from a select * on that table. I then write that clob to the file system. What is the clob columns data going to look like?
    its gonna be <column>(CLOB)</column> THATS NOT WHAT I WANT. I want the actual data that was in that CLOB column.
    Thank you for all responses.

Maybe you are looking for