translate function?

Hello :)

Is it possible to use the translate feature to translate an entire word or phrase instead of characters?

That is to say

In my PB, I have a field that contains "HA" and 'DON'T HA'

I want to print the fields 'HA' and leave the empty fields "DO HA"

But if I use the: TRANSLATE (TENURE_TYPE, 'NE HA', ' ')
It also prints the "HA" fields empty!

Thanks K

The translation isn't right for your task function.

Translate works in single character only. It is like a table of characters.
It takes the input string (first parameter) and resembles a tank after the other. If the single tank lies in the comparison string (2 ^ nd ^ parameter) and then it goes the tank corresponding to the destination string (3 ^ rd ^ parameter).

Example:

SQL*Plus: Release 9.2.0.2.0 - Production on Wed Sep 3 11:23:54 2008

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

Connected to:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production

SQL> select translate('This is a test','ABCDEFGHI','123456789') from dual;

TRANSLATE('THI
--------------
This is a test

/* nothing happend? This is correct. No matching char was found in the translation list (second parameter). */

SQL> select translate('This is a test','abcdefghi','123456789') from dual;

TRANSLATE('THI
--------------
T89s 9s 1 t5st

SQL> 

What you're looking for could be REPLACE

example of

SQL> select replace('Not ha','Not ') from dual;

RE
--
ha

SQL> 

Published by: W. Sven Sep 3, 2008 11:26

Or even decode

example of

SQL> with t as (select 'HA' myCol from dual union all
  2            select 'NOT HA' from dual)
  3  /* end of test data */
  4  select myCol, decode(myCol,'NOT HA',null,myCol) from t;

MYCOL  DECODE
------ ------
HA     HA
NOT HA

SQL> 

Published by: W. Sven Sep 3, 2008 11:28

Tags: Database

Similar Questions

  • APEX 4.2 translate data 'function and Global Variable declaration '.

    Hello everyone,

    I use APEX 4.2.1.00.08 and I wonder if there is a way to translate "Function and Global Variable declaration" textarea. Any other script text box is available for translation, but not this one.
    I know what the code is loaded on the header, but may contain important alert messages of global functions.

    Thanks in advance.

    Hi Grandmaster,

    "Function and global variables declaration" contains the JavaScript code, that is why it is not wise to include in the standard translation process.

    In my opinion, you have several options to access your translated messages:

    -) Use Application-> Substitutions or
    -) Store your message in the form of component shared-> SMS and and assign it to an application with the APEX_LANG element. Api MESSAGE (http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35127/apex_lang.htm#CHDBCEAB)

    In 'Function and Global Variable declaration' use substitution syntax to replace the value. For example:

    var myDeleteMessage = "&G_MY_DELETE_MESSAGE.";
    ...
    alert(myDeleteMessage);
    

    where G_MY_DELETE_MESSAGE would be a part of the application or the request for Substitution.

    Concerning
    Patrick
    -----------
    Member of the APEX development team
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • How to turn on when it is not automatically translate?

    How turn on when it is not automatically enabled to translate? Visited a blog (RSS feeds) that did not Translate function.

    Make use of the Google Translator Toolbar

    Otherwise, use Firefox Addons

  • When Firefox will have his own translator built in?

    I have heard that Firefox will have his own translation into very soon feature as it uses Bing or Google for translations?

    Hello baldape, there is a scheduled browser translation function, but it is not under active development again (so not possible to say which service will be used or when it will happen)

    https://wiki.Mozilla.org/Browser_translation

  • 5.7.1 Lightroom and NIK collection. I installed Nik Collection correctly. I followed the instructions from Adobe for importing the plugin in Lightroom. If I go to "photo" / "past to" (I use the Italian version, so I don't know if the translation of the po

    Lightroom 5-7-1 and NIK Collection. I installed Nik Collection correctly. I followed the instructions from Adobe for importing the plugin in Lightroom. If I go to "photo" / "past to" (I use the Italian version, so I don't know if the translation functions and controls is correct!) happens that all plugins are visible but not active. And even the default plugins are no longer active. I have repeated several times the procedure installation, but without result. Can anyone help? Tiziana

    You may need to do a manual install. See if this link helps:

    https://support.Google.com/nikcollection/answer/3002259?HL=it

  • TRANSLATE or something else?

    Hello

    I'm not very good in PL/SQL, I need you for your help.

    I have a few alphabetic characters and for each character, I associate a number
    If I have the character, I want to know the number.

    I tried with "translate".
    I know that the translate function replaces a sequence of characters in a string with a different set of characters and it replaces a single character at a time.
    But I tried like this:

    SELECT replace ("E",
    "[A, B, C, D, E, H, L, M, P, R, S, T],"
    '[01,02,03,04,05,06,07,08,09,10,11,12]') FROM dual;

    I want to return 05, but does not work.

    Can you give me a solution?

    Or if the numbers aren't going to be sequential so something like that...

    SQL> ed
    Wrote file afiedt.buf
    
      1* select substr('010203040506070809101112',(instr('ABCDEHLMPRST','E')*2)-1,2) from dual
    SQL> /
    
    SU
    --
    05
    
  • Replace (apply a translation) a tank several

    I have a string. In this channel, I have need to replace all special characters (codes 0-31) by chosen representation. Representations can be in different formats. Maybe \x?, or \0?, or 10,13-> 9-> \t, \n and all other characters are null conversion. Summary - I need find all symbols codes 0-31 and replace all for appropriate, representation which may be zero, one or more symbols.

    The solution should work in Oracle 9.2 (is say no regexp) and should be very fast.

    I know that the TRANSLATE function is really very fast. Buth there I can't replace a symbol for many. Can I replace only one by one.

    My Barbarian (and easy) solution is to create lists with 32 elements for each performance. For the chosen representation, make a loop on the list. Inside the loop to call function REPLACE. In this case I would always call replace 32 - times. I think it is expencive.

    Do you have an idea?

    I need find all symbols codes 0-31 and replace all for appropriate, representation which may be zero, one or more symbols.

    So maybe something like this:

    SQL>  with t as (
     select 1 id, '2433'||chr(1)||'534' str from dual union all
     select 2, 'A24'||chr(3)||'33534sf'||chr(9)||'fs' from dual
    )
        select id,
               str,
               trim(xmlagg(xmlelement (
                              e,
                              case
                                 when ascii (
                                         substr (str, level, 1)
                                      ) <= 31
                                 then
                                    '\x'
                                    || to_char (ascii (substr (str, level, 1)),
                                                'fm00')
                              end
                           )).extract ('//text()'))
                  new_str
          from t
    connect by     level <= length (str)
               and prior id = id
               and prior sys_guid () is not null
      group by id, str
    /
            ID STR                            NEW_STR
    ---------- ------------------------------ ------------------------------
             1 2433534                       \x01
             2 A2433534sf     fs                 \x03\x09                      
    
    2 rows selected.
    

    If performance is still a problem, you can go (instead of xmlagg) with one of the other thousands of chain ;) aggregation methods

  • Keep persistent variable values

    Hi all

    I'm about to create a random coefficients (FRC) for an Adaptive order blur in LabVIEW. The original design made in MATLAB/SIMULINK and I'm trying to translate functions in LabVIEW to my creations.
    The MATLAB function is then called in Simulink and returns the results. What I'm stuck with, is how PERMANENT is kept in LabVIEW. Consider the following script:

    e = [0.2 0.3];

    current_error = e (1);
    simulation_time = e (2);

    number of persistent;
    persistent previous_error;

    If isempty (count)
    Count = 0;
    end

    If isempty (previous_error)
    previous_error = 0;
    end

    Count = count + 1;

    control_activity = (current_error + previous_error) count;

    previous_error = current_error + previous_error;

    The above script retains the values of the persistent variables (County, previous_error) intact whenever this function is called in Simulink. But in LabVIEW how it's done?
    I'll probably call the same function in LabVIEW in a main loop. Am I supposed to use the shift registers to pass values between iterations?

    It will be the variable persistence?

    There is one post of the same problem in this forum, but the guy there wants to keep intact values using the VI. I, on the other hand, want to keep my values in a jar as soon as my function is called in a loop.

    Help!

    Kind regards.

    NapDynamite wrote:

    The above script retains the values of the persistent variables (County, previous_error) intact whenever this function is called in Simulink. But in LabVIEW how it's done?
    I'll probably call the same function in LabVIEW in a main loop. Am I supposed to use the shift registers to pass values between iterations?

    It will be the variable persistence?

    Yes, using shift registers

  • How to add support for localization?

    Hi, I tried to use tr(), including all the text it contains. But it does not work. No idea how to do it?

    Looks like you've done all the necessary steps with regard to QML and rpm files.  But just to remind for those who come here looking for information, you must make your text in a qstring and tell re-translation function if changing language of the device, if the language or locale changed or if just on the regional settings of the interface changes user.

    text: qsTr("I like turtles") + Retranslate + onLanguageChanged
    

    Then you need to go into your folder of translations and open your .ts files.  You will see this:

        
            
            Close
            
        
    

    You must add your translation so that the UI knows what it takes to replace the word with based on your .ts

        
            
            Close
            Cerrar
        
    

    Now, just add a few things to your source code:

    Add this to your UI.cpp application:

    #include 
    

    Add this in your Interface main Application in your PPC immediately after the opening bracket:

    m_pTranslator = new QTranslator(this);
    m_pLocaleHandler = new LocaleHandler(this);
    

    Then make a connection to the translation function that you will create:

     if(!QObject::connect(m_pLocaleHandler,         SIGNAL(systemLanguageChanged()),
                this,
                SLOT(onSystemLanguageChanged()))) {
                // This is an abnormal situation! Something went wrong!
                // Add own code to recover here
                qWarning() << "Recovering from a failed connect()";
            }
    
                onSystemLanguageChanged();
    

    create the function of translation:

    void App::onSystemLanguageChanged()
    {
        QCoreApplication::instance()->removeTranslator(m_pTranslator);
        // Initiate, load and install the application translation files.
        QString locale_string = QLocale().name();
        QString file_name = QString("persistentobjects_%1").arg(locale_string);
        if (m_pTranslator->load(file_name, "app/native/qm")) {
            QCoreApplication::instance()->installTranslator(m_pTranslator);
        }
    }
    

    now in your applicationui hpp add:

    #include 
    

    as well as:

    namespace cascades {
    class LocaleHandler;
    class Application;
    

    Q_INVOKABLE add under your stuff:

    private slots:
           void onSystemLanguageChanged();
    

    and add the translator:

    QTranslator* m_pTranslator;
                bb::cascades::LocaleHandler* m_pLocaleHandler;
    

    If there is already a translator (most likely) just put the m_pLocaleHandler of bb::cascades:LocaleHandler *; under it.

    That should be all.  I don't know if this is the way of manuals to do, but this is what worked for me from watching other samples and read messages of support.

    I hope it works!

  • Ignore the parenthesis on a case where they wrap a string

    Hello

    This is my first question, I hope I'm doing this right, then I write one. CSV file in a table, and then create a view of this table, taking only some fields in order to write them in another CSV file.

    Here's my problem with a field of view:

    target.JPG

    I want to get rid of the parenthesis, I could not find any definitive method on the net, so I tried to cut the first and the last "()" in the chain using case:

    target.JPG

    I got the following error:

    target2.JPG

    I tried the same logic using case this time test the string length (because 9 would be the longer):

    SELECT THE CHECK BOX

    Length WHEN (a.base_amt) = 9 THEN (select distinct substr (a.base_amt, 2, length (a.base_amt)-1) of CRD_AMT one)

    ON THE OTHER

    (select distinct a.base_amt in crd_amt one)

    END

    OF CRD_AMT one

    I received the same error.

    Now, I know that this is not the best way for all to achieve what I need, I have, I'm sure that there is possibility to ignore the parenthesis, but I couldn't find something that works...

    I hope that you, the experts may have a solution.

    Thank you!!

    Hello

    1623052 wrote:

    Hello

    This is my first question, I hope I'm doing this right, then I write one. CSV file in a table, and then create a view of this table, taking only some fields in order to write them in another CSV file.

    Here's my problem with a field of view:

    Welcome to the forum!

    It's much better to post CREATE TABLE and INSERT statements, so that other people can recreate the problem and test their ideas.

    Check out the Forum FAQ: Re: 2. How can I ask a question on the forums?

    to get tips on how to get the most out of this forum.

    I want to get rid of this bracket,

    The TRANSLATE function provides a simple way to remove all the brackets (or characters you want):

    SELECT TRANSLATE (base_amount

    , 'x()'

    , 'x'

    ) AS new_base_amount

    OF crd_amt;

    The 3rd argument to TRANSLATE is one of the characters that you don't want to delete.  It doesn't matter whether or not it actually occurs in one of the strings.

    The 2nd argument on TRANSLATE begins with the same character and continues with all the characters that you want to delete.

    I could not find any definitive method on the net, so I tried to cut the first and the last "()" in the chain using case:

    I got the following error:

    I tried the same logic using case this time test the string length (because 9 would be the longer):

    SELECT THE CHECK BOX

    Length WHEN (a.base_amt) = 9 THEN (select distinct substr (a.base_amt, 2, length (a.base_amt)-1) of CRD_AMT one)

    ON THE OTHER

    (select distinct a.base_amt in crd_amt one)

    END

    OF CRD_AMT one

    I received the same error.

    Now, I know that this is not the best way for all to achieve what I need, I have, I'm sure that there is possibility to ignore the parenthesis, but I couldn't find something that works...

    I hope that you, the experts may have a solution.

    Thank you!!

    The problem here is that you don't need so many subqueries; in fact, you do not need.  If you want to use the above approach, a good way to do it is:

    SELECT THE CHECK BOX

    WHEN base_amt LIKE "(%)". »

    THEN SUBSTR (base_amt

    2

    , LENGTH (base_amt) - 2

    )

    Of OTHER basd_amt

    END AS new_base_amt

    OF crd_amt;

    However, which removes only the parentheses at the beginning and end of the string, and only when they occur in pairs.  You said you wanted to remove all the brackets.

  • Insert the sequence inside the string number

    Hello

    What is the easiest way to insert sequences of numbers within the string, example

    Can I have numbers of from 1 to 25, but I can't for the 'gaps', when this happens I filled with X

    01020304050607080910 = > > > 01020304050607080910XXXXXXXXXXXXXXX
    01030405060708091112 is > 01X03040506070809X1112XXXXXXXXXXXXX

    How do I, I tried to use the TRANSLATE function, but no way






    WITH the DATA (str) AS (SELECT ' 010203070911131516' FROM dual UNION ALL

    SELECT "0205060809" FROM dual UNION ALL

    SELECT '03050608091012' FROM dual)

    , decompose AS (SELECT str, substr (str, (LEVEL - 1) * 2 + 1, 2) as ELEMENT, LENGTH (str) / 2 as items)

    , MIN (substr (str, (LEVEL - 1) * 2 + 1, 2)) OVER (PARTITION BY str) AS min_element

    , max (substr (str, (LEVEL - 1) * 2 + 1, 2)) OVER (PARTITION BY str) AS max_element

    FROM THE DATA

    CONNECT BY LEVEL<=>

    and prior str = str

    AND PRIOR sys_guid() IS NOT NULL)

    COMPLETE AS (SELECT str, level elem

    FROM (SELECT DISTINCT min_element, max_element, str

    TO decompose) x

    CONNECT BY LEVEL<= to_number(max_element)="" -="" least(to_number(min_element),1)="" +="">

    AND str = str PRIOR

    AND PRIOR sys_guid() IS NOT NULL)

    SELECT c.str, listagg (NVL (d.element, 'X')) within the Group (order by c.elem)

    C COMPLETE

    LEFT OUTER JOIN decompose d ON (c.str = d.str

    AND c.elem = to_number (d.ELEMENT))

    C.str group

    order of c.str;

    HTH

  • Stupid questions on the conservation of important calls on the FX application thread

    I'm working on a project that I have developed for over 6 months. I use JavaFX as the graphic side, but I take admission to a program called Max/MSP of music therapy, and I get a camera user input. These two things should run on threads separated since my FX application thread. So far, things have been involved in sweetness. I can handle things on the screen of my user input, and I have two communication work between my application JavaFX and Max. Now, however, I need to start drawing things actually executing. So far, virtually all manipulations aside just summer FX do translations. I now need to create, add and delete nodes children. So, I am of course an error saying not "on the FX application thread. I understand why it is not on this thread, and why it is a problem. So I made a few changes, so that calls that change the nodes on the stage, will be noted only the data and then make the changes later on the FX application thread. And then I encounter problems, questioning my own stupidity...

    I don't know how to get these calls on the FX application thread. I mean, it must be really easy. I'm obviously missing something. Or maybe I'm really tired and reflected on this during too long, or maybe the fact that it's been 6 months I wrote this part of the code. But I see my Mainstage class, which extends the Application. It has a function of departure, that brings up all my on screen-dads (nodes and other scopes), called stage.show ()... and then seems to end. When I did things as calling translate functions on my knots in my thread of user input, or my thread communication Max, things seemed to have worked. But now I think I might have been handling this evil from the ground up. It seems probable that I should have a 'main game loop' (it's not really a game, but still, same principle) where I can say the scene to update all the different nodes with the changes that have occurred since the last frame, and try out everything be updated in time for graphics render at a reliable pace. And yet, I simply don't see how to do this. I'm sure this should be obvious, but I am flat by cutting. And the lack of time begins to descend... Please, if you can point some average standard to avoid this common newb mistake if everything goes well, I would be very happy!
    -Jean

    I think that last one. Each change of a node that is currently part of the scene displayed should be accessible from the thread of FX.

    If the node is not attached to a scene, or the scene itself is not currently displayed, you can make changes on any thread.

  • How to find special characters in a string of give/sentance

    Hi all

    I have a task to complete with the time to give. Because I'm not very good in PL/SQL, I need you're help.
    Condition is:

    I must come with the SQL or PL/SQL code which should return and find the hidden or special character in the name of the data files in a database. There are nearly 400 + database are present in almost any flavor of UNIX, and I need to check the database each.

    As you know, the name of the data file will be like this:
     /u02/instance_name\oradata\datafile_01.dbf 
    So, it should avoid these things and only discover the special characters in the name of the data file.
     
    a-z , A-Z , 0-9 and \ 
    Please keep in mind that... I'll be pulled the script Oracle the Oracle 9i client that will access all the databases of Oracle 9i to 11g in a short and give me the result.

    Please help me to solve this problem and let me know if you need more information.

    Hello

    Mukesh says:
    Hi Frank,.

    It is an excellent service. Thanks for you response.
    I want to change the query that... I should get only the name of these data files that are special characters of detention. I don't know how to put it in that condition. :(

    Here's one way:

    SELECT  file_name
    ,       ...     -- other expressions, if you want any
    FROM    dba_data_files
    WHERE   TRANSLATE ( file_name
                      , '?0123456789.ABCDEFGHIJKLMNOPQRSTUVWXYZ\_/abcdefghijklmnopqrstuvwxyz'
                      , '?'
                      ) IS NOT NULL
    

    Among other expressions, you can put in the SELECT clause (if you wish) is a copy of the TRANSLATE function, you had in your message. That would underline exactly what characters rendering invalid file name.

  • PO for Communication output

    Hi guys,.

    I'm working on a RTF model for the release of PO for Communication, but I need to add a column for tax (amount of recoverable and non-recoverable tax) and a total down.

    <? xdofx:RECOVERABLE_TAX + NONRECOVERABLE_TAX? >

    But how can I get a total of this column?

    I tried to use a rollup and displays the total final at the lower part, but that uses XDOXSLT and I can't use XDOFX with it.

    Did anyone done this before? I'm really stuck.

    Please help.

    Ash.

    I used the translate function to convert text in raw numbers that I could summarize and then in a variable values. I would also check that RECOVERABLE and NON-RECUPERABLE elements exist and take account of the values of the negative income tax (in parentheses).

    Hope that helps.

    See you soon,.
    Dave

  • How to test if a character is a number

    Hi all.

    Someone at - it an idea on what is the most effective way to test whether a character is a digit character (0... 9) in pl/sql.

    Thank you

    Steve

    We use the plsql translate function

    Select NVL (RTRIM (TRANSLATE ('156 ', '1234567890',' ')), 'TRUE')
    of the double

    It returns the string "TRUE" If there is only the numbers that make up the chain.

Maybe you are looking for

  • Time Machine works do not successfully (I think) restore on a new hard drive (El Capitan)

    I had the hard drive replaced in my mid-2011 iMac 27 "a couple of days. Everything seems to go well with the Time Machine restore process. But it does not appear that all successful backups have occurred within 36 hours since. If a block of half day

  • Crop video captures all

    Hello gentlemen, For my project I undertake acquistion PPG without contact. I am trying to capture my webcam, but with all of the image, I get a lot of noise in the signal. I found using code samples provided by my supervisor in MATLAB that my webcam

  • Can't see "Properties".

    Hi all! I'm not a King of LabView (again)... but I have some programming skills in other areas.  I have played with a few programs on several PC and came to a particular computer where I am unable to view the 'properties' on what anyone within the pr

  • I have a Dell OEM copy & Home Student 2007 office came with my Dell laptop.

    I have 2 machines from Dell and have now bought a laptop HP Mini 110 with XP. Can I install the copy Dell Office 2007 on the HP OEM or I have to buy new software? I use the trial version of 60 days on it now that expires in a few days.

  • Celon-tech support scams?

    I just got got off the phone with a Ceylon-tech support person. I talked through a series of commands that led me to a website called techinline.net. This has given to the person on the phone to my computer access. She then went to another website ww