How to display a string in number?

I have a table with a colunm containing country names (countryVis). I'm creating a query to return the details in the table, but for the columns of this I want to go back to the following: USA as '1', '2' India, China as '3' and the Spain as "4".

At present, the countryVis data type is varchar2. I try to use a decode statement to display each country as a number. This is my attempt so far. I try only for a change of the USA in number in this case.
select      "IT220_HOLIDAYDETAILS"."HOLCODE" as "HOLCODE",
      "IT220_HOLIDAYDETAILS"."HOLDESCRIP" as "HOLDESCRIP",
      "IT220_HOLIDAYDETAILS"."COUNTRYVIS" as "COUNTRYVIS" 
 from      "IT220_HOLIDAYDETAILS" "IT220_HOLIDAYDETAILS"
decode (CountryVis,'USA','USA'='1');
From what I've read on the decode my statement should do the following:

If column = USA CountryVis may

USA = 1

Otherwise do nothing.

Is this correct or am I wrong? The error I get from this code is > > > > ORA-00933: SQL not correctly completed command

Thanks in advance!

Hello

Try aliasing instruction box like that...

SELECT   hdt.HOLCODE,
         hdt.HOLDESCRIP,
         hdt.COUNTRYVIS,
         CASE hdt.COUNTRYVIS
            WHEN 'USA' THEN '1'
            WHEN 'India' THEN '2'
            WHEN 'China' THEN '3'
            ELSE '?'
         END me_country
  FROM   IT220_HOLIDAYDETAILS hdt

Your original SQL was wrong because you had your decode incorrect syntax and that's after the from clause.

See you soon

Ben

Tags: Database

Similar Questions

  • How to display actual totals in number and not asterisks

    Hi, this is regarding my previous post. Non-specific to a financial report, how to display the actual number behind the asterisks in the totals for report. If you ask me especially, I'm talking about the report of the accounting entries in accounts payable. When the number of characters in the total exceeds 15, it shows asterisks instead of numbers. I tried to adjust the width in various places, but it doesn't help. Any help is appreciated.

    Thank you
    Naveen Gagadam.

    I don't think you can pass the value of the parameter of precision as 2, it can be STANDARD or EXTENDED.
    I don't know what currency is involved here, but based on your statement that it now displays 5. I think so
    the currency is set to 5 standard. Set up the precision extended 2 for this currency and pass extended.
    Give it a shot. The currency precision is detailed in the GL user guide.
    Here is an excerpt of the GLUG - section currencies

    6. Enter the precision of the currency to denote the number of digits to the right of
    the comma is used in regular monetary transactions.
    7 enter theExtended precision for the number of digits to the right of the
    decimal point used in the calculations for this currency. The extended precision must be
    greater than or equal to the precision standard.
    Note: Some Oracle Applications uses the extended precision. Others,
    as accounting, are not.

  • How to display the string XML formatted as an XML way?

    How to render an XML string in the component textArea (or suggest another component) so that it is readable as XML (although indented) and I should be able to copy it to the Clipboard.

    http://www.mail-archive.com/[email protected]/msg78030.html - contains the answer. toXMLString() worked...

  • How to display the corresponding key number?

    I need to make a display that can show that I am pressing the button. Which means it is 10 buttons and the display should then show if it's the button 1,2,3,4,5,6,7,8,9 or 10 that I stuck

    Any suggestions?

    That's great

    All you need to do now is:

    1. Add an event on the event structure to point to "change value" in this table.

    2. compare the old and new values to find which item has changed.

    3 index increment since it begins with 0.

    For you, I've written a VI

  • Display a String Array in a box

    Hi all

    I'm developing a web application using jd 11.1.1.4

    In my grain of support, I have a variable of String (String []) array to store messages.
    I want to display these messages in a web page by using a dialog box
    I want to know how to display a String [] in a dialog box

    Thanx

    instead of an array of strings... use an ArrayList... and display... the message of dialogue by using the af:forEach

  • How to display a certain number of channels...

    Normal
    0

    fake
    fake
    fake

    MicrosoftInternetExplorer4

    / * Style definitions * /.
    table. MsoNormalTable
    {mso-style-name: "Table Normal";}
    MSO-knew-rowband-size: 0;
    MSO-knew-colband-size: 0;
    MSO-style - noshow:yes;
    "mso-style-parent:" ";" "
    MSO-padding-alt: 0 to 5.4pt 0 to 5.4pt;
    MSO-para-margin: 0;
    MSO-para-margin-bottom: .0001pt;
    MSO-pagination: widow-orphan;
    do-size: 10.0pt;
    do-family: "Times New Roman";
    MSO-ansi-language: #0400;
    mso-fareast-language: #0400;
    mso-bidi-language: #0400 ;}

    Hello!

    I'm using LabVIEW 8.5 and I'm trying to display a specific number of channels using several channels...
    I can show in a chart, but I display the 16 analog inputs
    that have NEITHER 6024E and I need to view only the channels that have something
    connected to them (I do not know which channel will have something connected to)
    It). If they have a signal (temperature), I want to show only channel/s in a graph and save this channel/s in a txt file. If it isn't
    I don't want to view or save the channel/s.

    How can I do this with DQA Assistance?

    I am able to do all of this using a single channel, I can view in
    a graph, I can save it as a txt file, but I'm not able to do it for the number n
    only active channels. All advice or suggestion will be appreciated.

    Sincerely,

    Julieta.

    The "AI Multi Pt" looks like an old traditional DAQ example. The DAQ Assistant use DAQmx and it hides a lot of code. It's good and bad. Good if you do not need to change anything. Bad if you do. I don't know how you have configured the task, but you can do what you want by simply using the DAQmx screw directly. There are many examples provided with LabVIEW. Open example Finder (help-> find examples) and navigate to hardware input and output-> DAQmx-> analog measurement. I don't know if you need to go into the directory of the temperature or voltage, because as I said, I don't know how your task is implemented.

    Let's take a simple example. If you open the "Acq thermistor samples-SW Timed" in the directory of the temperature you can see it's pretty simple. The first VI is the DAQmx create channel VI. It has a "physical channel" entry. This can be a DAQmx control or it can be a string when you specify the list of channels to collect. So, to do what you want, you just have to create the string corresponding to the channels you want to collect. LabVIEW help describes how to create this string. The other method is to use the technique of this watch aestat. However, what is shown is only a part of what you need to do. You must have a pre-created range of channels and then you select the ones you want.

    See attached example (LV 8.2) to get an idea.

  • How to display the parameter string registered by DBMS_XMLINDEX?

    This is probably a stupid question, but I can't seem to find any function to display the setting of a parameter string that was recorded by DBMX_XMLINDEX. REGISTERPARAMETER.

    For example,.

    If I have:
    BEGIN
    DBMX_XMLINDEX.REGISTERPARAMETER('indexParam', 'xxxxxxxx');
    END;
    /
    How to display the value of 'indexParam' after creation?
    SQL> set long 1000
    SQL>
    SQL> select paramstr
      2  from xdb.xdb$xidx_param_t
      3  where param_name = 'MYINDEXPARAM'
      4  ;
    
    PARAMSTR
    --------------------------------------------------------------------------------
    PATH TABLE po_ptab
        PATH ID INDEX po_pidx
        ORDER KEY INDEX po_oidx
        VALUE INDEX po_vidx
        PATHS(NAMESPACE MAPPING(xmlns:p="http://www.example.com/IPO"))
        GROUP MASTERGROUP XMLTABLE PO_TAB
        ('/p:PurchaseOrder'
            COLUMNS
               REFERENCE VARCHAR2(30) PATH 'p:Reference',
               REQUESTOR VARCHAR2(30) PATH 'p:Requestor' )
        GROUP ITEMGROUP XMLTABLE ITEMGROUP_TAB
        ('/p:PurchaseOrder/p:LineItems/p:LineItem'
            COLUMNS
               LINENUMBER NUMBER(38) PATH '@p:ItemNumber',
               QUANTITY NUMBER(38) PATH '@p:Quantity',
               DESCRIPTION VARCHAR2(256) PATH 'p:Description')
     
    

    After you add it to an index, you can also view the content in USER_XML_INDEXES. PARAMETERS (XML format).

  • How to convert string to number in TS?

    Hello

    Anyone know how to convert string to number in TS?

    I couldn't find the Num() function.

    Thank you

    Val()

  • SQL: how to display the second string of the function in the Jobs table only if the function has more than one string.

    SQL: how to display the second string of the function in the Jobs table only if the function has more than one string.

    Hello

    You can use REGEXP_SUBSTR Oracle/PLSQL: REGEXP_SUBSTR function

    Select the function double REGEXP_SUBSTR('PUBLIC RELATION REPRESENTATIVE ','[^]+',1,2);

    Do you have any value of the column as no 2nd string?

  • How to display the VM Workstation serial number

    I have 6 licenses for Workstation 6 and you just upgrades to version 7. I am trying to determine what user runs a number of series. I have 3 users right now and they have no idea who install package that they used. How to display the serial number for VM Workstation installed on a users computer.

    Thank you

    He stored in the Windows registry at the location following and Workstation 7 taking as example adjust you the path accordingly for the installed version.

    HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMware Workstation\License.ws.7.0.e1.200904\Serial
    
  • How convert string to number

    How convert string to number


    my character


    Select form double to_number ('1,6,9,4'); my putting here 1,6,9,4

    get the character of number conversion error.

    concerning

    Published by: vr on March 31, 2011 23:59

    Published by: vr on March 31, 2011 23:59

    VR says:
    Getting error while the conversion of character to the number in instring is possible to get the position of the channels at one time

    I have the following table, called pack

    Acct_No pack2 pack3 pack1
    1000 10101011 111111101 01010101111

    Select * Pack
    where instr (pack2, ' 1') and * (to_number (replace('1,6,9,4',','))); * - getting values of function as string '1,6,9,4'

    If you want to retrieve lines where the position of the first "1" in the pack2 chain is one of the positions in your list number e.g. position 1, 6, 9, or 4?

    Something with regexp_like can help...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with pack as (select '1000' as acct_no, '10101011' as pack1, '111111101' as pack2, '01010101111' as pack3 from dual union all
      2                select '1001', '10101011', '000011111', '10101010110' from dual union all
      3                select '1001', '10101011', '000000001', '10101010110' from dual)
      4  --
      5  -- end of test data
      6  --
      7  select pack.*, case when regexp_like('1,6,9,4','(^|,)'||to_char(instr(pack2,'1'),'fm9999')||'(,|$)') then 'Yes' else 'No' end as x
      8* from pack
    SQL> /
    
    ACCT PACK1    PACK2     PACK3       X
    ---- -------- --------- ----------- ---
    1000 10101011 111111101 01010101111 Yes
    1001 10101011 000011111 10101010110 No
    1001 10101011 000000001 10101010110 Yes
    
  • How to label the tabs with number of displayed REB?

    Hello
    I have 4 legs which are filled when you click on the links in my "home" tab How is - a to fill the number of records displayed in the tab next to the tab name?
    Is this possible?
    Thank you.

    Go into the Application Builder, select your application, and then click shared components. First on the left is Application parts. Create your Application (global) object here. Once you have these defined, you can select the counties of table in them and use them in your tabs.

    As I said earlier, my application has a single page, all users have to see after that what they select a record to edit (the main table), so on this page, I have a process before header that crosses all tables and assigns the number of records to the appropriate Application element. Then, I refer to the Application element in the tab name, such as "Names - (& F_NAMES_COUNT)", where F_NAMES_COUNT represents the number of all the records in my table of NAMES with an entry for the primary key. On each of my monitors data, whenever the user changes (update, insert, or delete) data, at the end of the treatment, I also tell only table and store the new value in the Application element, so it remains to day.

    Bill Ferguson

  • How to connect a string to Boolean true or false constant

    Hello.

    I can't try to figure out how to connect a string constant to a result of a function of true/false. I create a VI that creates a random number, and then has the user to enter a number in numerical order. These 2 numbers are compared, and if the number of users is smaller, I want a string constant to display "too small." If the user is equal, I want the string constant to display "correct" and if the number is larger, the constant will display "too big."

    This is a picture of what I'm doing, but notice I has not inserted for 'too broad' and 'too small' string constants, as I always try to understand how to connect the string constant to this.

    Thanks for any help.


  • How to display the result sqlplus in java?

    I want to call sqlplus to run some commands sql in java, but how can I print the result of sqlplus?

    In java code, I call sqlplus as:

    Process of p;
    Run the command
    p = Runtime.getRuntime () .exec (commandString);
    print the result of the command
    InputStream inputStream = p.getInputStream ();

    How to display the result of the execution?

    Published by: Yi on February 26, 2012 23:41

    You can use ProcessBuilder. Copy the following code starts sql * more and runs the script in the variable "filename". It displays the results in the console of NetBeans.

    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.io.File;
    import java.util.Map;
    
    public class test1 {
    
        public static void main (String args []) {
    
            test_script();
        }
    
        public static void test_script () {
    
            String fileName = "@test_table.sql";
            String sqlPath = "E:\\";
    
            String sqlCmd = "sqlplus";
    
            String arg1   = "user/password@sid"; -- plug in your user, password and db name
            String arg2   = fileName;
            try {
                String line;
                ProcessBuilder pb = new ProcessBuilder(sqlCmd, arg1, arg2);
                Map env = pb.environment();
                env.put("VAR1", arg1);
                env.put("VAR2", arg2);
                pb.directory(new File(sqlPath));
                pb.redirectErrorStream(true);
                Process p = pb.start();
              BufferedReader bri = new BufferedReader
                (new InputStreamReader(p.getInputStream()));
              BufferedReader bre = new BufferedReader
                (new InputStreamReader(p.getErrorStream()));
              while ((line = bri.readLine()) != null) {
                System.out.println(line);
              }
              bri.close();
              while ((line = bre.readLine()) != null) {
                System.out.println(line);
              }
              bre.close();
              System.out.println("Done.");
            }
            catch (Exception err) {
              err.printStackTrace();
            }
    
        }
    
    }
    

    Here is the content of the script at E:\\test_table.sql

    Prompt drop TABLE ANOTHER_TEST;
    DROP TABLE ANOTHER_TEST CASCADE CONSTRAINTS
    /
    
    Prompt Table ANOTHER_TEST;
    CREATE TABLE ANOTHER_TEST
    (
      BATCH_SEQ             NUMBER,
      BATCH_GROUP_ID        NUMBER,
      STATUS_FLAG           VARCHAR2(30 BYTE),
      OBJ_BEING_PROCESSED   VARCHAR2(80 BYTE),
      BATCH_RUN_START_DTTM  DATE,
      BATCH_RUN_END_DTTM    DATE,
      CREATE_DTTM           DATE,
      CREATE_USER           VARCHAR2(30 BYTE),
      UPDATE_DTTM           DATE,
      UPDATE_USER           VARCHAR2(30 BYTE)
    )
    LOGGING
    NOCOMPRESS
    NOCACHE
    PARALLEL ( DEGREE DEFAULT INSTANCES DEFAULT )
    MONITORING
    /
    
    COMMENT ON TABLE ANOTHER_TEST IS 'This is a test table.'
    /
    
    EXIT
    /
    
  • How can I easily count the number of contacts in my address book?

    Is there anyway to make the address book show the number of contacts?

    When I click on a folder, it shows all the contacts in the folder, but I can't see any display of the total number of contacts - if I want to know I have to laboriously count everyone!

    Thanks for the tips on this

    Here, if I select a local internal address book example of the PAB, it tells me in the status bar how many Contacts it contains.

    Maybe your status bar is disabled?

    In the address book, alt + v, view, toolbars, select Status bar.

Maybe you are looking for