Issue NUMBER and VARCHAR CONCATENATE

I'm trying to concatenate a string and an integer. However, is the number that I'm trying to concatenate a number returned by the rank function, and it is part of a CASE statement. I realize that this seems a bit confusing, so here is an example of pseudo-device of what I'm trying to do:
WITH temp_table AS
(
 SELECT 1 AS col1 FROM DUAL UNION ALL
 SELECT 2 FROM DUAL UNION ALL
 SELECT 3 FROM DUAL UNION ALL
 SELECT 3 FROM DUAL 
)
SELECT CASE WHEN COUNT(*) OVER (PARTITION BY col1) > 1 
            THEN
                  RANK() OVER (ORDER BY col1) || 't'
            ELSE
                  RANK() OVER (ORDER BY col1)
       END AS test
FROM   temp_table;
Desired results set:
TEST
1
2
3t
3t
When I do the above, I get a ' incompatible data types: expected TANK got the NUMBER "exception. I tried to convert the "RANK() OVER (ORDER BY col1)' to a string via the function TO_CHAR and the CAST function, but none worked. I figure out how to reach my goal by creating a subquery, convert the column test tank and that the addition of the 't' character to it in the external SELECTION; I was wondering if it was possible to do what I asked in a query (without a subquery).

Apart from this is one of the sql statement more sophisticated that I've seen for a long time you can try this 'trick '.

WITH temp_table AS
(
 SELECT 1 AS col1 FROM DUAL UNION ALL
 SELECT 2 FROM DUAL UNION ALL
 SELECT 3 FROM DUAL UNION ALL
 SELECT 3 FROM DUAL
)
SELECT CASE WHEN COUNT(*) OVER (PARTITION BY col1) > 1
            THEN
                  RANK() OVER (ORDER BY col1) || 't'
            ELSE
                  RANK() OVER (ORDER BY col1) || ''
       END AS test
FROM   temp_table;

TEST
1
2
3t
3t

the result of the case statement must be the same type of data in each branch

concerning

Tags: Database

Similar Questions

  • number of issues: free and paid articles?

    Is it possible to do folio issue multi and publish questions free and paid it? Thanks for the info!

    Yes, you can have free and retail issues in your Multi number App. For details, you need to have in-app purchases set up in iTunes connect as well.

  • the model number and imei of iphone 6s can editable with the software or anything else?

    I want to know this weather model number and imei number can be changed to an iphone camera? my phone has been replaced but same issue was at new device but the imei and model number was the change of the new device. is this possible? that model number and imei number can be changed through software or reset of the device.

    No, they cannot be changed.

  • BlackBerry Smartphones that someone knows how to change the phone number and keep BIS on the numer again?

    I have existing BIS plan for a phone number in another city. Works fine, no problem. My phone is 9300.

    Now, I moved to another city, got a new phone number and want to use BIS with this new number on my existing device. (I'll be closing my old number for obvious reasons).

    My ISP is Airtel. So far, I have followed the procedure (send to 121) to request activation of the service on the new number, but a response saying the request has failed. Contating customer support is of no help.

    Does anyone know if there is a simple way to do it.

    Airtel on pre-paid. The new issue is also of Airtel.

    In response to my own question.

    I waited until my validity has timed out and then saved with the new number.

    So, moral of the story: you cannot save BIS on a new SIM card if you are already registered to BIS on your old SIM.

  • Change the number to varchar DataType

    Hello

    I need to change the data type for a column (from the number on the varchar type), it is an existing table so data are there.

    I'm runnning modify the command to do it, but he asked me to do all null values before treatment.

    Is it possible to do without any null values.

    In my view, a solution is

    (1) to get the data copied to another table, make the NULL column and change... load the data back at the table

    It is the only option?

    Hello

    First of all, make sure that you really want to lose the NUMBER column.  Why you change the column?  "" For example, if the column is temperature, and you change it so that you can enter values like ' 68 F ' or ' 20 C ', then perhaps you should allow the temperature of the column as a NUMBER and add a new column, temperature_scale VARCHAR2 (1).  (Better yet, convert all temperatures to a comments system, possibly with a trigger or a virtual column and save the original measurment, like ' 68 F"in a separate column, if you really need to know how it was entered.)

    Because you really need to change to a VARCHAR2 column, then one of the ways is

    (1) adds a new column VARCHAR2

    (2) fill in this column of the existing NUMBER column

    (3) add a NOT NULL constraint in the new column (if necessary)

    (4) delete the original column NUMBER

    (5) change the name of the new column to the original column was (if desired)

    If you deposit the entire table, then you lose all its indexes, triggers and subsidies.  If you come to add and remove columns, you do not lose these things.

  • IMEI number and series?

    I'd like to understand why a phone has both an IMEI number and also a serial number please? What is the purpose of having two unique numbers for a phone?

    All phones have IMEI numbers. They are the number used by the carrier to connect the device to their network (as well as the SIM card in the case of phones that use SIM cards). The serial number, just like the serial number for any piece of hardware, a way for the manufacturer to track the device. Apple could use just the IMEI instead of a serial number? Perhaps. But it is not as if having two numbers takes up extra space or anything like that.

  • Hello my MacBook Pro model (MacBook Pro (15 inch, early 2011 am Dubai bought the Sryalsh C02FD2CPDF8 number and I am in Iran that MacBook Pro not enter the device screen when I turned on the pink vertical lines can be seen, the problem is restless))

    Hello my MacBook Pro model (MacBook Pro (15 inch, early 2011 am Dubai bought the Sryalsh C02FD2CPDF8 number and I am in Iran that MacBook Pro not enter the device screen when I turned on the pink vertical lines can be seen, the problem is agitated and it is not difficult to work with him because I like and what I should I do?))

    Serial number C02FD2CPDF8V

  • At least one number and one letter in English are required in the password.

    At least one number and one letter in English are required in the password.

    Page of the router is not fully displayed

  • The Web of Toshiba site does not recognize of my drive hard number and P/N

    Hello

    There is a little less than two months, I bought my HDD Toshiba Canvio Basics 3.0 from Amazon. The hard drive has stopped working for some reason any (I drop or something, it simply stopped working).

    Of course, I was trying to use my warranty to repair or Exchange it, but the Web of Toshiba site does not recognize my serial number and product number. They are just there, black and white on the sticker on the back of my hard drive, but the site says they are not valid.

    Someone has an idea what is happening? I would rather not throw 50 euros by the window for less than two months of use.

    Product number is HDTB105XK3AA - and not to HDTB105 * E * K3AA like some sites say (including Amazon).

    Thanks for your help.

    Stand by. Have you contacted Amazon using Amazon options for repair under warranty or Exchange?

    Check please help Amazon option and collect detailed information on defective, damaged or significantly different returns.

    Two years ago I had problem with the mobile phone bought by Amazon and I send direct Amazon with bill Amazon.

    By the way: can you please post the link where you have tried to check the serial number of your HARD drive?

  • change my phone number and cannot change the keychain

    Dear,

    gently, I changed my phone number and cannot change the keychain

    You try to make the change in the preferences/iCloud/Keychain/Options of the system? What happens when you try?

    City link below.

    • The device that uses the SMS compatible phone number you provided when you set up first iCloud keychain. A verification code is sent by SMS to the phone number. If you can not access this number, Contact the Support of Apple, which can verify your identity so that you can run the installer on your new device.

    Frequently asked questions about iCloud Keychain - Apple Support

  • HP laptop: enter the model number and get a "game too many results.

    My HP laptop dies after 6 weeks. When I contact support, he asks the model number. I enter: say "15-ay041wm" is what the box and laptop. I get a reply that says.

    "Sorry, too many results match your search for 15-1y041wm.

    "So I try HP Notebook, I get the same mesaage above, except with the HP laptop ' instead of '15-ay041wm.

    Because no matter where I'm going, he wants the model number and I give, I can't help. No cat, no nothing.

    So someone can tell me how to get support?

    If HP is unable to handle the number of model of it's own computers, so I'm not very confident.

    Here are the free support number to call in the USA/Canada... 1 800-474-6836.

    Now here's another question, you can report to HP on if you want...

    You must stay online and listen to the automated assistant trying to talk to you to talk to a representative... visit the HP website... go to this support forum (which has no official presence in HP), etc.

    After a minute or two, the Assistant to say, if you can't get online, will stay on the line to speak to a customer services representative.

    This is when you will have the opportunity to speak with a support person and report the problem to open a pension case.

  • Hello, my Mac Mini was stolen before that I could save it to find my iPhone service.  Is it possible to set up another computer or device so I can find it? I have the serial number and and more.

    Hello, my Mac Mini was stolen before that I could save it to find my iPhone service.  Is it possible to set up another computer or device so I can find it? I still have the serial number and and other information.

    Nope

  • If I block a caller, can I delete the number and still blocked it

    If I block a caller, can I delete the number and still blocked it?

    Yes. It is possible to block a contact and then delete the contact. They will be still blocked.

  • How can I get a name of table 1, column A, if column B is a negative number and insert the names of table 2?

    How can I get a name of table 1, column A, if column B is a negative number and insert the names of table 2?

    What is the formula?

    You can do this with a column of "index" in table 1, as this assistance:

    The formula in C2, filled to the bottom:

    IF (B =<>

    That increments a counter each time that it finds a negative number in column B.

    In the second table, you can retrieve a list of negative values in this way:

    The formula in A2, filled to the bottom:

    = INDEX (array 1::A, CORRESPONDENCE (LINE (−1, Table 1::C), 0))

    It takes the line number, the formula is activated, subtracts 1 to the header line and look up the result in the column of table 1 C.  If it finds a match, it feeds the line number to the INDEX page with retrieves the value of the column of table 1A.

    To hide the red triangles of signage wrap the IFERROR formula, like this:

    = SIERREUR (INDEX (table 1::A, CORRESPONDENCE (LINE (−1, Table 1::C), 0)),"")

    Of course, you can also simply filter on column B without the need to set up a column from another table or index.

    SG

  • VISA devices with the same serial number and the vendor ID does not work (0xBFFF003A)

    Hi all

    I need to acquire the data of two meters of power YOKOGAWA with VISA driver (USB connection).

    They work very well if used alone, but they do not work when are used toghether. In particular, when I plug in and turn on the two of them, NOR MAX shows me the following error message:

    0XBFFF003A (VI_ERROR_INV_SETUP)

    viFindRsrc return 0xBFFF003A (cannot start the operation because the installer is not valid (because of attributes defined in an inconsistent state).)

    Please make sure that VISA is properly installed on this system.

    Possible causes of this error:
    1. more than one passport may be to attempt to claim the same resource.  You can try to disable passport to understand which Passport is the cause of the error.
    2 you have connected multiple no configured plug-and-play devices that have the same name of the resource. For example, the vendor ID and the serial number may be the same.

    In fact, according to MAX, both power meters have the same serial number and the same vendor ID; so, this seems to be the reason why they do not work together.

    Can someone help me?

    Thank you all


Maybe you are looking for

  • V27, 27.1, won't play YouTube videos. Even in safe mode

    I can't watch videos on my default browser, the latest Firefox v 27. I think that I am not alone in this. I do not have the latest versions of Flash Player, Real Player, and Javascript is enabled (not java) I found it first in the videos of my favori

  • I think that there is a bug in the function RT Set CPU pool assignments (SMP)

    I'm trying to configure Symmetric multi Processing on a PXI controller which has 2 CPUs.  I check the number of processors using RT get number of processors (it gives me 2).  I have a constant matrix of wire to the RT Set CPU pool allocations functio

  • error on drive c (vista)

    HelloI had problems with a slow OS and accidents, stalls etc then decided to restore my system to an earlier time.  When I chose my previous date and click 'restore' a message came up with "there is an error on the c: drive.  Cannot restore the syste

  • T61 and Nokia Pc Suite, bluetooth not found

    My T61 has bluetooth installed correctly, but Nokia PC Suite can not found this bluetooth device. I reinstalled the drivers Pc Suite and bt, and I also tried with bt-windows drivers. PC suite gives an error message: "cannot find the type of connectio

  • Device PCI T410 without driver

    Hello I just did a clean install of Windows XP 32 bit on my T410 and after installing all the drivers from the Lenovo Web site, I find myself with a PCI device without driver. I get a pop up window, whenever I connect. The device id is 3B2F, which, a