Replace the NULL value with some characters

Hi all

I am writing a query to get the name of the contact and the age of a table. the age column has some value, I want these nulls to be replaced by "N/a".
I user NVL ("age," n/a ")

but it gives an error
ORA-01722: invalid number

Please suggest.

Thank you

Hello

You must convert the age in tank to be replaced by the string of characters in the case opposite number

Then use this

select name, nvl(to_char(age),'N/A') from myage;

Concerning

Tags: Database

Similar Questions

  • Replace the Null values with zero in MDB

    Hello

    How can I replace Null values with zero in MDB. I tried NVL (column_name, 0), he said: syntax error.

    Thanks for your time and your help.

    Hello

    In the layer of Buisenss you always use IFNULL (column, 0)

    Concerning
    Adil

    Published by: adil.harrab on April 8, 2011 17:33

  • replace the digital value with spaces

    Hi I'm new to reg_exps

    I want to replace the number that appears under the string with white spaces.
    I want to remove the number and also the text that is concatenated with the number.

    That's what I want to achieve.
    for example
    I / p: 20 years of service... I won 2 awards in 2 years... .next award in 4th or 5th year '
    o/p: ' years of service... I won prizes in these... .next year or award '

    Can someone please help.

    Thank you

    How is that?

    SQL> with t as (select '20 years of service.....I have won 2 awards in these 2-years ...next award in 4th or 5th year' txt fr
    om dual)
      2  select regexp_replace(txt,'[[:digit:]]+[^ ]*',' ')
      3    from t;
    
    REGEXP_REPLACE(TXT,'[[:DIGIT:]]+[^]*','')
    -----------------------------------------------------------------------------------------------------------------------------
    -------
      years of service.....I have won   awards in these   ...next award in   or   year
    
    1 row selected.
    
  • Need to null values with the values of filling the date before weekend/holidays

    I have a table with a Date column, column Type and rate column.

    The problem is when the weekends and holidays, column Type and rate column are null.

    I need all null values with the values of Type and fill rate before that date is the weekend and public holidays.

    Example:

    I have:

    RATE OF TYPE DATE
    07/01/2010 4510 PM 3.71
    07/01/2010 CETE28 4.59
    07/01/2010 TIIE28 4.95
    07/02/2010 4510 PM 3.82
    07/02/2010 CETE28 4.63
    07/02/2010 TIIE28 5.11
    * NULL NULL 07/03/2010 *.
    * NULL NULL 07/04/2010 *.
    07/05/2010 4510 PM 3.91
    07/05/2010 CETE28 4.74
    07/05/2010 TIIE28 5.25

    Will be:

    RATE OF TYPE DATE
    07/01/2010 4510 PM 3.71
    07/01/2010 CETE28 4.59
    07/01/2010 TIIE28 4.95
    07/02/2010 4510 PM 3.82
    07/02/2010 CETE28 4.63
    07/02/2010 TIIE28 5.11
    * 07/03/2010 4510 PM 3.82*
    * 07/03/2010 CETE28 4.63*
    * 07/03/2010 TIIE28 5.11*
    * 07/04/2010 4510 PM 3.82*
    * 07/04/2010 CETE28 4.63*
    * 07/04/2010 TIIE28 5.11*
    07/05/2010 4510 PM 3.91
    07/05/2010 CETE28 4.74
    07/05/2010 TIIE28 5.25

    What could I do?

    Hello

    You can use the analytic LAST_VALUE function to get the last day of work before each date into your table. It will be the same as the current day for every day of work.
    Do it a self-join to combine each current line (c) with the last day of work (l):

    WITH     got_last_work_day     AS
    (
         SELECT     dt, type, rate
         ,     LAST_VALUE ( CASE
                        WHEN  type  IS NOT NULL
                        THEN  dt
                       END
                       IGNORE NULLS
                      ) OVER (ORDER BY dt)     AS last_work_day
         FROM     table_x
    )
    SELECT       c.dt, l.type, l.rate
    FROM       got_last_work_day     c
    JOIN       got_last_work_day     l  ON       (    c.dt          = l.dt
                             AND  c.type          = l.type
                             )
                           OR     (    c.last_work_day     = l.dt
                             AND  c.type          IS NULL
                             )
    ORDER BY  c.dt
    ,       l.type
    ;
    

    Among other things, I guess that the type is NULL if (and only if) the line represents a holiday or weekend, and that the combination (dt, type) is uniuqe.

  • where clause to see if they contain the null value

    So I've finalized my function but now am having some problems:

    the bl field (or the v_bl parameter) has null values in it. When I run the function using the "Select FH ('ACCESS', NULL, 8675309') From dual; I get a NULL return value because it uses the variable to compare with q.bl and you can not have q.bl = null in a Where clause.

    The main problem is when the parameters are passed, a line can have the same prob and site, but the bl might be different as null, which would give a different lname.


    In where clause I need to have something that will compare the parameter with the bl field. Sometimes it's null sometimes is not, but we need to find the line concerned. I made the "BOLD" in the question police

    Here are two possible lines in the data
    prob bl site lname
    ACCESS Smith 8675309 (null)
    54321 8675309 Johnson ACCESS

    so in theory, if the function is called with the parameters FH ('ACCESS', NULL, 8675306')
    He would return the lname: Smith

    and conversely FH ("ACCESS", "54321 ', 8675309") would return Johnson

    Here's the function

    create or replace
    Function FH
    (v_prob IN varchar2, v_bl IN varchar2, v_site IN varchar2)
    RETURN varchar2
    AS
    v_lname varchar2 (16);

    BEGIN

    S.Lname SELECT INTO v_lname
    Of
    request q
    JOIN THE
    s response
    On
    (q.order = s.order)

    WHERE
    q.BL = v_bl AND - where it is
    q.site = v_site AND
    q.prob = v_prob AND
    s.Lname IS NOT NULL;

    RETURN v_lname;
    END;



    -When I run the FH ('ACCESS', NULL,' 86753) function, it returns an empty value and not the family name

    Published by: user11210446 on May 28, 2009 17:03

    Published by: user11210446 on May 28, 2009 17:03

    user11210446 wrote:
    If v_bl is Null in the where clause it would even say q.bl = Null which will not work.

    Matches the NULL value
    (1) either you have to say-> q.bl IS NULL
    OR
    (2) WHERE the NVL (q.bl-99) = NVL (v_bl-99) - this will be true if q.bl and v_bl both are NULL
    NULL = NULL evaluates to TRUE, so you use NVL

    SS@XE > select * from dual where null = null ;
    
    no rows selected
    
    SS@XE > select * from dual where null is null ;
    
    D
    -
    X
    
    SS@XE > select * from dual where NVL(null,-1) = NVL(null,-1) ;
    
    D
    -
    X
    

    SS

  • Data in table, overwritten by the null value

    I work on writing a VI that simulttaneously reading speed and pressure, then record them on separate tables.  Hit a wall at about 90% of the way through.

    The data (represented by random numbers for testing sake) comes in this central loop case then a VI "add to the table."  Here is where it gets Sticky: when I use a null at the beginning of this table (top of the page highlighted) my data continually gets crushed in the row of the '0' table of each loop.  But when I leave aside the value zero (low highlighted) my data are added to the table very well, but when I stop the VI together and restart, the new data values are just added at the bottom of the table.  Any help would be appreciated.

    Forgive my drawings Caveman to a VI, learning of the system on mine and just happened to a point of optimization.  Thank you!

    -Blaster

    Hello Blaster,

    What you did (perhaps accidentally) is created a uninitialized shift register, which will retain its value until the VI leaves memory. This can be an extremely powerful tool and can be used to create things like Motors of the Action, but if you need to erase the data between tracks, you will need to do additional work.

    Looks like what you want to do is to maintain the value of your table, while the application is running, but clear is when restarting the application - which is correct?

    If this is the case, then you have a few options.  My recommendation would be to leave the uninitialized loop and use the primitive 'first call?"to check whether or not it is the first time your processing loop reiterated and replace the table 'used' with an empty array and null.

    You might also consider using initialized worldwide feedback nodes, or half a dozen other methods that have benefits and different disadvantages.  Congratulations on the job through the application, by the way!

  • PersistentStore.getPersistentObject returns the null value?

    I use a random key to retrieve a shape of the object PersistentStore

    persist is PersistentStore.getPersistentObject (KEY);.

    Works fine on the Simulator (OS 5), when I take the code signed to the device (BB OS 5.0 Bold 8900)

    For some reason, it returns null, without exception. Thereafter any API I inoke on PersistentStore / persist returns null without exception persist even when the null value.

    I don't know if it's one thing to eclipse debugger, but even if the debugger shows that objects are null. Controls null applied in the code seems to fail, what does code see these objects as non-null. Pheww! How is it possible.

    In this code still shows up as null, then safetyTable and orderedkeys. However, the value null check in the failure code.

    At a later stage in the code, when I try to access orderedkeys are null again! Are struggling with this problem for two days, all the pointers would be very comfortable.

                        persist = PersistentStore.getPersistentObject( KEY );
                        persistOrderedKeys = PersistentStore.getPersistentObject(KEY_ORDERED_KEYS);
                        safetyTable = (Hashtable)persist.getContents();
                        orderedKeys = (Vector)persistOrderedKeys.getContents();
                        if (safetyTable == null)
                        {
                            safetyTable = new Hashtable();
    
                            persist.setContents(safetyTable);
                            persist.commit();
                        }
    
                        if (orderedKeys==null)
                        {
                            orderedKeys=new Vector();
    
                            if (safetyTable.size()>0)
                            {
                                Enumeration addressKeys = safetyTable.keys();
                                while(addressKeys.hasMoreElements())
                                {
                                    orderedKeys.addElement((String)addressKeys.nextElement());
                                }
                            }
                            persistOrderedKeys.setContents(orderedKeys);
                            persistOrderedKeys.commit();
    
                        }
    

    "I don't know if it's one thing to eclipse debugger.

    I had problems of this kind when I don't have a level of operating system for the device I am debugging on.

  • How to replace a. null value in obiee report

    Hi gurus,

    In a single column, we get. as the data, how to replace. with the null value

    Please provide your inputs

    Thank you for your time in advance

    Try it out below mentioned formula.

    REPLACE ('service request'. "RS #"(, '.', '') "

  • The Null value as the default value for an input to a stored procedure parameter

    Hello

    How can we set the default values with the NULL value for the parameter in a stored procedure.
    create or replace procedure emp_proc ( p_test_input in varchar2
                                                        p_emp_id in number,
                                                        p_emp_name in varchar2,
                                                       p_manager_id in number )
    as
      begin
       if ( upper ( p_test_input ) = 'I' )
       then
          insert into emp
          values      ( p_emp_id  ,p_emp_name ,p_Manager_id,sysdate );
       elsif ( upper ( p_test_input ) = 'D' )
       then
          delete from emp
          where       emp_id  = p_emp_id;
       else
          dbms_output.put_line
             ( 'Please input ''A'' for ADD or ''D'' Delete  EMPLOYEE'
             );
       end if;
    end;
    As described above if I want to delete only the functioning

    I want to call this procedure without pass additional parameters.
     EXECUTE  emp_proc('D',1010);
    Published by: Rede on May 28, 2010 12:21

    Published by: Rede on May 28, 2010 12:22
    create or replace procedure emp_proc ( p_test_input in varchar2,
                                                        p_emp_id in number,
                                                        p_emp_name in varchar2 default null,
                                                       p_manager_id in number default null )
    
  • Remove the NULL values and update the value according to the logic

    Hello

    The problem data

    CREATE TABLE VOLA (SRNO, NUMBER, zeroNUMBER, ANUMBER);

    INSERTION of REM in VOLA

    TOGETHER TO DEFINE

    Insert in VOLA (SRNO, ONE) values (1,237.94);

    Insert in VOLA (SRNO, ONE) values (2, null);

    Insert in VOLA (SRNO, ONE) values (3,203.565);

    Insert in VOLA (SRNO, ONE) values (4,170.69);

    Insert in VOLA (SRNO, ONE) values (5,113.67);

    Insert in VOLA (SRNO, ONE) values (6,93.6);

    Insert in VOLA (SRNO, ONE) values (7,82.03);

    Insert in VOLA (SRNO, ONE) values (8,66.675);

    Insert in VOLA (SRNO, ONE) values (9,63.59);

    Insert in VOLA (SRNO, ONE) values (10,61.415);

    Insert in VOLA (SRNO, ONE) values (11,60.015);

    Insert in VOLA (SRNO, ONE) values (12,58.235);

    Insert in VOLA (SRNO, ONE) values (13,57.805);

    Insert in VOLA (SRNO, ONE) values (14,56.965);

    Insert in VOLA (SRNO, ONE) values (15, null);

    Insert in VOLA (SRNO, ONE) values (16, null);

    I have to remove the NULL values in column 1, the problem is that the position of the NULL values are not fixed, and it can be any position. If all the lines of the columns are null, then throw it away.

    If multiple NULL values are here so I have to do the math as follows to update null with the eigenvalues

    1. If the first line is null then take the 2nd value in row and update it.

    2. If the lines between both is null then take avg of prev and next value not null and refresh it.

    3. If the last value in the column is null, then then take prev and update, in this case last two are null, so I have to take value of prev 14 value line update in

    15th and 16th ranks.

    I want to put this pl/sql logic, somehow, that I thought have loop and counter aapproach and loops through the elements and check and update.

    But always looking for something better before looking to write code. No idea or help will be useful for me.

    I * think * you are looking for something like:

    WITH VOLA (SRNO, ONE)

    AS (select 1,237.94 from all the double union)

    Select 2, union null value double all the

    Select 3,203.565 from all the double union

    Select 4,170.69 from all the double union

    Select 5,113.67 from all the double union

    Select 6,93.6 from all the double union

    Select 7,82.03 from all the double union

    Select 8,66.675 from all the double union

    Select 9,63.59 from all the double union

    Select 10,61.415 from all the double union

    Select 11,60.015 from all the double union

    Select 12,58.235 from all the double union

    Select 13,57.805 from all the double union

    Select 14,56.965 from all the double union

    Choose 15, null of union double all the

    SELECT 16, NULL FROM dual)

    GET_VALUES (SELECT SRNO, ONE ACE,

    , LAST_VALUE (WE IGNORE NULLS) (ORDER BY SRNO CSA ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING) AS PREVIOUS_VALUE

    , first_VALUE (ONE IGNORE NULLS) over (ORDER OF SRNO CSA ROWS BETWEEN 1 SUITE AND FOLLOWS without TERMINALS) AS NEXT_VALUE

    FROM VOLA)

    SELECT SRNO, ONE, CASE

    WHEN IT IS NOT NULL, THEN WE

    OTHER CASES

    WHEN PREVIOUS_VALUE IS NOT NULL AND IS NOT NULL THEN (PREVIOUS_VALUE + NEXT_VALUE) NEXT_VALUE / 2

    WHEN THE PREVIOUS_VALUE IS NOT NULL, THEN PREVIOUS_VALUE

    WHEN THE NEXT_VALUE IS NOT NULL, THEN NEXT_VALUE

    END

    END AS NEW_VALUE

    OF GET_VALUES

    /

    HTH

  • Replace the string value of table

    with cte as)

    Select val '123', 'abwec' double val1

    Union of all the

    Select "456" val, "mowerw" double val1

    Union of all the

    Select val '709', 'wkwere' double val1

    Union of all the

    Select val '078', 'awerwewerwreq' double val1

    )

    Select * from cte;

    -incoming string

    "asdasd123ewrwer@87w8eopiu456werwer@asdwer709@ewrwerewrwqqwezxder078 @..."

    need to replace like 'abwec' 123 and 456 as "mowerw" and 709 as wkwere and 078 as 'awerwewerwreq '.

    How to replace the string value of the string

    I'm going to the table which will have mapping information I need to see the incoming string and replace the appropriate value of the val to val1

    something like

    Of

    "asdasd123456werwer@asdwer709@ewrwerewrwqqwezxder078ewrwer@87w8eopiu @..."

    TO

    "asdasdabwecewrwer@87w8eopiumowerwwerwer@asdwerwkwere@ewrwerewrwqqwezxderawerwewerwreq@..."

    By using the TYPE clause.

    with cte as

    (

    Select val '123', 'abwec' double val1

    Union of all the

    Select "456" val, "mowerw" double val1

    Union of all the

    Select val '709', 'wkwere' double val1

    Union of all the

    Select val '078', 'awerwewerwreq' double val1

    ),

    input_tbl

    as

    (

    Select "asdasd123ewrwer@87w8eopiu456werwer@asdwer709@ewrwerewrwqqwezxder078 @..." input_str

    of the double

    )

    Select max (input_str) Dungeon (first order by desc NWR dense_rank) input_str

    de)

    Select rno, input_str

    de)

    Select rownum NWR

    val

    val1

    input_str

    count (*) over() cnt

    from cte

    Cross

    Join input_tbl

    )

    model

    dimension (NWR)

    measures (val, val1, cnt, CAST (input_str AS VARCHAR2 (4000)) input_str)

    (

    input_str [any] = replace (nvl (input_str [cv () - 1], input_str [cv ()]), val [cv ()], val1 [cv ()])

    )

    )

  • How to compare the new values with the old values in triggers.

    Dear all,

    Please tell me how to compare the new values with the old values in triggers.

    Hi, the employee example is in the document. You'd better read yourself.

    CREATE OR REPLACE TRIGGER Print_salary_changes
      BEFORE DELETE OR INSERT OR UPDATE ON Emp_tab
      FOR EACH ROW
    WHEN (new.Empno > 0)
    DECLARE
        sal_diff number;
    BEGIN
        sal_diff  := :new.sal  - :old.sal;
        dbms_output.put('Old salary: ' || :old.sal);
        dbms_output.put('  New salary: ' || :new.sal);
        dbms_output.put_line('  Difference ' || sal_diff);
    END;
    /
    
  • check NULL values with expressions

    I'm having a problem with an expression that I work with.

    I'm trying to produce a dynamic graph (among other information) that seems to be controlled by a stream - stream artificial is created by a handful of sliders and a wiggle expression.

    The chart is a simple graphic line which works very well. It is created with a null value (MarkPos) that the position is controlled by Captain wiggle expression that I've mentioned before, that follows.

    This next bit is where I have problems:

    I want to score minimum or maximum, the line has reached on the chart by moving a dotted line, one for weak points and the other for the top.

    Focus only on the bottom line;

    I have the following expression associated with the line, which brings together the current position of the value null (MarkPos) and compared with the current position of the line to see if it has all moved further away down, if she has it moving the line to the new pos are lower. However, all that happens is the line following the null value.

    x = thisComp.layer("MarkPos").transform.position.valueAtTime (time) [1];

    y = transform.position.valueAtTime (time) [1];

    z = transform.position.valueAtTime(time-thisComp.frameDuration) [1];

    If (x > y) {}

    [0, x]

    } else {}

    [0, z]

    }

    After a lot of debugging, I now know the issue is with the else statement - what his weight is compensating the to the high movement frame by frame 1 - so how do you define an order of "keep your current position in y ' in this case?

    [0.1] just it back to its original position and it is not possible to just have the ' if(x>y) {[0, x]} "bit without the"else {}.

    Suggestions fo how to fix this, or a better way to do it?

    This should give you the value of y min:

    p = thisComp.layer("MarkPos").transform.position;

    minVal = 999999;

    for (f = timeToFrames (time); f > = 0; f-) {}

    minVal = Math.min (digraph, p.valueAtTime (framesToTime (f)) [1]);

    }

    [value [0], minVal]

    and this should give you the most:

    p = thisComp.layer("MarkPos").transform.position;

    maxVal = - 999999;

    for (f = timeToFrames (time); f > = 0; f-) {}

    maxVal = Math.max (maxVal, p.valueAtTime (framesToTime (f)) [1]);

    }

    [value [0], maxVal]

    Dan

  • Is it possible to replace the hard drive with an SSD? or would it be too expensive?

    Is it possible to replace the hard drive with an SSD?

    or would it be too expensive?

    Yes.  There are several alternatives.  I found a way relatively inexpensive, using a map of mSATA (very small SSD) and an adapter to connect it to the connector IDE 44 pin internal of my PowerBook.  It works very well.  Rather than repeat what I posted previously, you can watch these two topics (which also has good info, other users)

    Re: This win to install a SSD drive in a PowerBook G4?

    Re: SSDS  (my post is halfway - "this is how I did with my trusty Pismo...) »)

    FYI - I have used the adapter is even cheaper now

    https://www.Amazon.com/GP/product/B009BA8V4M

  • Re: Tecra A9 - 11M - replace the HARD drive with a larger

    I have a Tecra A9 - 11 M with Windows XP Professional installed. I would like to replace the hard drive with a larger drive and install Windows 7 Professional.

    Any suggestions on recommended records say 500 MB?

    Difficulties to install Windows 7 on this model?

    Hey,.

    > Any suggestions on recommended records say 500 MB?
    I assume you mean 500 GB and not 500MB, right? ;)

    Well, the Tecra A9 already supports SATA interface and there is no limit of capacity on SATA interface, so you can install a 500 GB HARD drive or more (750 GB, etc.). Just make sure that it s 2.5 SATA HDD.

    You can choose each brand of HARD drive because each model will not work. You can buy a Toshiba HDD, Western Digital HARD drive or another. No problem ;)

Maybe you are looking for

  • Satellite A200 PSAE3E: what the Bios update changes

    Someone can't tell me what efect will be a ubdate Bios on my laptop.This update can not damage the laptop? This update is a risk?P.S.: I use Windows Xp SP2, Vista not. Thank you

  • Satellite Pro L450D-12 X - code error related to Java?

    I have a Satellite Pro L450D - 12 X on windows 7 and had it about a month. Play the games that use java to run and now it has stopped working. I also have the same problem with Adobe reader. Tonight, I tried to download and install Google earth, and

  • Upgrade HDTV to FHD G50 - 80

    Hello I understand that this question was the umpteenth time, but I just want to know if anyone of you have success on the model in my title, thank you.

  • While loop with stop unwired FPGA button?

    I've seen examples FPGA with a while loop where nothing is plugged to the stop button. On a target PC, it would throw an error. What it means?

  • Power pack 1 error (new installation windows server 2011)

    Hi all, Im having problems trying to install power pack 1 of windows home server 2011, there is a new configuration with all windows update at day and not being invited by update install any update. The microsoft Download Center, I was able to downlo