Select a null value

Hi to all , if anybody knows how to tackle with the following situation, please reply urgently. Thanx in advance.
Suppose I have a table EMPLOYEE , with EMPLOYEE_ID as primary key , as:
E_ID EMPLOYEE_NAME
1                        abc
3                      pqr
6                      xyz
I want to fire a query as
" select E_ID from EMPLOYEE where E_ID IN ( 1, 8 , 6) "
The result is as
1
6
But I want a result as null ( or any other indication) for the record which is null , i.e I want a result as
1
null
6
I have tried nvl, but dont get result as per my excepttation. Any clue , how to do this ? How should I write my query so that I will have the desired result. In desired result instead of null , any value or indication is acceptable.

Here's how i understand your problem. You have a table with n records. You run a query with an IN argument list. Rows that match the argument list should be returned by the query as they are, but for arguments that have no corresponding row in the table a row should be returned indicating the status. I have come up with a solution, though a bit complicated one. To test it first run following script and then execute the query at the end.
CREATE TABLE employee
(E_ID number,
EMPLOYEE_NAME varchar2(30))
INSERT INTO employee
values(1,'A')
INSERT INTO employee
values(2,'B')
INSERT INTO employee
values(3,'C')
CREATE OR REPLACE TYPE emp_type AS OBJECT
(E_ID number,
EMPLOYEE_NAME varchar2(30));
CREATE OR REPLACE TYPE emp_tab_typ AS TABLE OF emp_type;
CREATE OR REPLACE TYPE arg_list_typ AS VARRAY(20)
OF NUMBER;
CREATE OR REPLACE FUNCTION emp_fun(p_arg arg_list_typ) RETURN emp_tab_typ
IS
  v_emp_tab emp_tab_typ:=new emp_tab_typ();
  v_cnt number:=0;
BEGIN
   FOR r IN 1..p_arg.count LOOP
           v_cnt:=0;
           FOR x IN (SELECT E_ID,EMPLOYEE_NAME
                   FROM employee
                   WHERE E_ID=p_arg(r)) LOOP
                   v_emp_tab.extend;
                   v_emp_tab(v_emp_tab.count):=emp_type(x.E_ID,x.EMPLOYEE_NAME);
                   v_cnt:=1;
           END LOOP;
           IF v_cnt=0 THEN
                   v_emp_tab.extend;
         v_emp_tab(v_emp_tab.count):=emp_type(null,null);
           END IF;
   END LOOP;
   RETURN v_emp_tab;
END;
SQL> SELECT E_ID,nvl(EMPLOYEE_NAME,'Not Found')
  2  FROM TABLE(CAST(emp_fun(arg_list_typ(1,3,4)) AS emp_tab_typ))
  3  /
      E_ID NVL(EMPLOYEE_NAME,'NOTFOUND')
         1 A
         3 C
           Not Found
3 rows selected.--------------
Anwar

Similar Messages

  • Select list null value issue - for filtering the tabular form report

    hello,
    I have a tabular form created on emp table and in the table their are entries for the employees who don't have a location, like it is null for some of the employees.
    Now I have created a select list item - for filtering the results based on location.
    my select query for select list item is
    select distinct location_name d,location_id r from emp order by 1
    -- so my select list contains all the distinct location_name including the null on my tabular form.
    so based on the selelcted value(in the select list), I am able to filter the results in my tabular form.
    but the thing is that when i try to select an null value from my select list - i am not able to filter my report - like its displaying all the records, its not filtering.
    can anyone help me out with this.
    thanks.

    Hi
    Try below select for LOV
    select distinct nvl(location_name,'No Location') d,nvl(location_name,'No Location') r from emp order by 1 And then change tabular from select where clause also use nvl(location_name,'No Location') like
    SELECT *
    FROM emp
    WHERE nvl(location_name,'No Location') = :Px_YOUR_ITEMBr, Jari

  • Selection of Null Value in Transformation file

    Hi Guru's,
    I've been trying to select NULL values of a field in transformation file but unfortunately system always gets both null and filled values of the field ALTHOUGH i had maintained the Selection Option.
    Data management package is: Load Transaction Data from BW InfoProvider UI
    The technical name of field: 0FLAG
    I've tried each possibilities as in below
    SELECTION: 0FLAG, *STR()
    SELECTION: 0FLAG, *STR();
    SELECTION: 0FLAG, ""
    SELECTION: 0FLAG, " "
    SELECTION: 0FLAG, NULL
    SELECTION: 0FLAG, *STR(#)
    SELECTION: 0FLAG, #
    SELECTION: 0FLAG, "#"
    Doesn't work.
    thanks in adv. for your precious supports

    Hi Sadi,
    I understand your question that, you want to load tr. data from infocube and you have a trouble with one field which name is "0flag" in this cube, right? If your case is above, you need conversion file for flag, and convert like that # = "DUMMY" or sth.
    Or, you can solve in BW with transformation file routine.
    I hope, it will help you.
    Thanks.

  • Select list -null value?

    When you create a select list on a column, and run the page for the first time, the drop down doesn't show any value. I realized that once you click on the drop down to see what the values are, at the bottom of the list there is a blank value. But you can only see this the first time you load the page. Once you click on any other value, that blank value is gone. How does this work? How can I select the blank value even after you had selected other values previously?
    Thanks,

    Modify the Item Definition's List of Values options (Edit Page Item->LOV)
    Display Null: Yes
    Null Display Value:  

  • Help with select on null values

    drop table t1;
    create table t1 ( c1 number,c2 varchar2(2) );
    insert into t1 values(1,'A');
    insert into t1 values(2,'B');
    insert into t1 values(3,'');
    insert into t1 values(4,'D');
    drop table t2;
    create table t2 ( c1 number,c2 varchar2(2) );
    insert into t2 values(1,'A');
    insert into t2 values(2,'B');
    insert into t2 values(3,'');
    insert into t2 values(4,'C');
    select a.c1 from t1 a ,t2 b
    where a.c2 = b.c2;
    and result should be
    1
    2
    3

    does not make any difference
    drop table t1;
    create table t1 ( c1 number,c2 varchar2(2) );
    insert into t1 values(1,'A');
    insert into t1 values(2,'B');
    insert into t1 values(3,null);
    insert into t1 values(4,'D');
    drop table t2;
    create table t2 ( c1 number,c2 varchar2(2) );
    insert into t2 values(1,'A');
    insert into t2 values(2,'B');
    insert into t2 values(3,null);
    insert into t2 values(4,'C');
    select a.c1 from t1 a ,t2 b
    where a.c2 = b.c2;
    and result should be
    1
    2
    3

  • Null value in a select-option

    Hi all,
    I have the follow question:
    can I populate a range vith a null value?
    I have a field in a standard table which can be "space" or "null". But if I insert:
    sign = I
    option = EQ
    low = space
    records with "null" field aren't extracted by the select statement. So is there any way to populate:
    low = null or something similar?
    Best Regards,
    Raffaele Frattini

    If the field is of type char then you need to wrte the same in quotes woth caps
    else
    declare
    constants : c_null type i value '0'.
    then assign the same
    You check the null value using INITIAL laso.

  • Could not find selected item matching value "null" in CoreSelectOneRadio

    Hello,
    I get the following error with my selectOneChoice components:
    WARNING Could not find selected item matching value "null" in CoreSelectOneRadio[UIXEditableFacesBeanImpl, id=dyna_2709976_11]
    It seem that the component looks for a selectItem object qith its value set to null, so I tried to add one with a null value to no avail. The error don't cause any problem on the rendered page but it might spam the log when many users will be connected. Anyone every got this error and found a fix to stop it from appearing?
    Regards,
    Simon Lessard

    you said you're using selectOneChoice but the error says radio. Is the information correct?

  • Error while selecting NULL value from Popup Key LOV(numeric or value error)

    Hi,
    I have a item P1_DEPTNO with following properties.
    P1_DEPTNO - Popup Key LOV (Displays description, returns key value)
    LOV - P1_DEPT_LOV
    select deptname d, deptno r from deptP1_DEPTNO item properties
    List of Values
      Named LOV - P1_DEPT_LOV
      Display Null - Yes // changed to Yes, so that it can accept NULL values.
      Null display value - NULL
      Null return value -   (blank)PL\SQL Process -
    declare
    v1 number;
    begin
    if :P1_DEPTNO is null OR :P1_DEPTNO = '' then
        v1 := 0;
    else
        v1 := :P1_DEPTNO;
    end if;
    // rest of the PL\SQL process
    end;Now, when I run the page and select NULL value from Popup LOV and submit, I get the following error.
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error.When, I select any other value other than NULL, then it's working perfectly fine.
    Only in case of NULL value, I am getting this error.
    ANY idea, why this error is coming??
    Thanks,
    Deepak

    Hi Varad,
    I did the following change
    Null display value - (blank) // by default it is displaying '%' in the select this
    Null return value - -1
    but when I select % (null value) from the popup list, it displays the return value -1 in the text field.
    My question is why it is displaying the return value -1 in the text field...*It should display the display value in the text field (i.e blank in this case)*
    then, I did the following change
    Null display value - (blank) // by default it is displaying '%' in the select this
    Null return value - // a single space, so that when I select %(null value) from the list, it should display blank in the text field...
    then I did the following change in the PL\SQL process.
    PL\SQL process
    declare
    v1 number;
    begin
    if :P1_DEPTNO = ' ' then // -- checking the value of single space ' ' when we select %(null) in the popup list, BUT even I select %(null), control is not coming here.
        v1 := 0;
    else
        v1 := :P1_DEPTNO;
    end if;
    // rest of the PL\SQL process
    end;Thanks,
    Deepak

  • How to put the null value at the last of  a select list

    Hello,
    I have a select list with a null value, I want the null value to be the last value in the list. It always appears in the top of the list, Desc and Asc order is not working.
    Thank you in advance!
    Edited by: Najla on Apr 1, 2013 10:37 PM

    Hi,
    Edited by: Howard (... in Training) on Apr 2, 2013 1:xx PM
    The statement - I don't think it is possible to arrange the order of the null option in a select list.- is close. You can't control the order of the Null value if you add the Null value through the GUI. However, it can be added and controlled as part of a SELECT ...
    One way is to add NULL to the "SELECT". Here the Yes/No are hard-coded but they could have been selected from a table:
    select d, r from
    select 'YES' d, 'Y' r from dual
      union all
    select 'No' d, 'N' r from dual
      union all
    select Null d, '<Null>' r from dual
    ) order by 1 desc NULLS lastHoward

  • How to select instances without null value?

    hye all,
    i need to do th ereprocessing data whereas i have to select the instances without null value from the database..
    for example:
    id name
    123 izza
    345 alex
    567
    the id = 567 contain null value..so..its automatically will not be selected from the database...
    how about if it have about 10 or more attributes to be selected..
    how can i work with the SQL thanks..

    Hi,
    Query for your example should like like this:
    SELECT * FROM <your_table>
        WHERE name is null;
    how about if it have about 10 or more attributes to be selected..
    If using 10 or more attributes you mean 10 or more columns with null use this:
    SELECT * FROM <your_table>
        WHERE <col1> is null AND <col2> is null etc...Peter D.

  • How no to select lines with NULL values

    Hi,
    I am not a newbie newbie in SQL but I do not understand why I cannot retrieve the lines where there are null values.
    The table observatoire.fiche has 2 columns with default values set to NULL : total_heures, and total_heures_exceptionnelles. These are numeric types columns.
    I want not to select lines where :
    total_heures equal NULL AND total_heures_exceptionnelles = NULLI have tried this but I do get an "Invalid relational operator" error message.
    select a.nom || ' ' || a.prenom d, a.agent_id r
    from   OBSERVATOIRE.AGENT a, observatoire.fiche b
    where  a.agent_id = b.agent_id
    and    b.total_heures NOT NULL AND total_heures_exceptionnelles NOT NULL
    group by a.nom, a.prenom, a.agent_id
    order by a.nomCould you help me ?
    Thank you for your kind answers.

    Satyaki_De wrote:
    I think this is not the good way to do it. Did you check my solution? It should work the same output as your solution.Really ?
    test@ORA10G>
    test@ORA10G> -- (1)
    test@ORA10G> with t as (
      2    select 1 as x, 10 as total_heures, null as total_heures_exceptionnelles from dual union all
      3    select 1, null, 20   from dual union all
      4    select 1, null, null from dual union all
      5    select 1, 30, 40     from dual)
      6  --
      7  select x, total_heures, total_heures_exceptionnelles
      8  from   t
      9  where  x = 1
    10  AND NOT ( total_heures IS  NULL
    11            AND
    12            total_heures_exceptionnelles IS NULL
    13          );
             X TOTAL_HEURES TOTAL_HEURES_EXCEPTIONNELLES
             1           10
             1                                        20
             1           30                           40
    test@ORA10G>
    test@ORA10G> -- (2)
    test@ORA10G> with t as (
      2    select 1 as x, 10 as total_heures, null as total_heures_exceptionnelles from dual union all
      3    select 1, null, 20   from dual union all
      4    select 1, null, null from dual union all
      5    select 1, 30, 40     from dual)
      6  --
      7  select x, total_heures, total_heures_exceptionnelles
      8  from   t
      9  where  x = 1
    10  AND    total_heures IS NOT NULL
    11  AND    total_heures_exceptionnelles IS NOT NULL;
             X TOTAL_HEURES TOTAL_HEURES_EXCEPTIONNELLES
             1           30                           40
    test@ORA10G>
    test@ORA10G>isotope

  • How to select only rows which column has a null value?

    Hi,
    I adds rows to my table with data field set to null;
    "INSERT INTO administrator.subzamowienia (subzamowienia.id_zamowienia,subzamowienia.id_transakcji,subzamowienia.nazwa_o,subzamowienia.nazwa_produktu,subzamowienia.ilosc,subzamowienia.nip_d,subzamowienia.data_realizacji) VALUES (administrator.id_zamowienia.curval,'0','PRAGA','Witaminy','2','43224','0');"
    Then i would like to update this field after a time with new date.
    To do this i need to know which rows has still data field set to null, i try sth like this but it doesn't work
    "SQL> select * from administrator.subzamowienia where subzamowienia.data_realizacji='null';
    select * from administrator.subzamowienia where subzamowienia.data_realizacji='null'
    B&#321;&#260;D w linii 1:
    ORA-01841: (pe&#322;ny) rok musi by&#263; pomi&#281;dzy -4713 i +9999 i nie mo&#380;e by&#263; 0
    or
    "SQL> select * from administrator.subzamowienia where subzamowienia.data_realizacji='0';
    select * from administrator.subzamowienia where subzamowienia.data_realizacji='0'
    B&#321;&#260;D w linii 1:
    ORA-01840: warto&#347;&#263; wej&#347;ciowa jest za krótka dla formatu daty
    how to choose this rows?

    Hi,
    VALUES (administrator.id_zamowienia.curval,'0','PRAGA','Witaminy','2','43224','0');I don't see null value...
    select * from administrator.subzamowienia where subzamowienia.data_realizacji='null'Should be :
    select * from administrator.subzamowienia where subzamowienia.data_realizacji is nullNicolas.

  • Radiogroup - Null value selected

    See http://htmldb.oracle.com/pls/otn/f?p=24317:26
    Both the radiogroup item and the select list item have the exact same LOV and Source properties
    LOV is STATIC2:1,2,3
    Show Null is set to Yes with a Null display value of All and return value of %
    Source value is set to %
    But no matter what I do, the All radiobutton doesn't appear selected when the page is run. The All select list option is selected.
    Why the inconsistent behaviour, how can I get the "null value" for the radiogroup item to come up selected?
    Thanks

    Problem was caused by the "Display Null = "Yes" and the %null% problem" feature (http://inside-apex.blogspot.com/2006/12/display-null-yes-and-null-problem.html ) of the ApexLib framework. Which isn't desirable in his application scenario.
    Informed Dave how it can be disabled.
    From the mail:
    ApexLib has some function to set the LOV Null indicator (most time %) to NULL for easier processing. You can disable that behavior by adding the $APEXLIB_IGNORE_LOV_NULL$ hint to this lov item. See http://inside-apex.blogspot.com/2006/12/display-null-yes-and-null-problem.html for details. If you want to disable that feature for your hole application remove the ApexLib_Lov.clearLovNullValues call in your application process "ApexLib-Before Computation/Validation"
    Patrick
    My APEX Blog: http://inside-apex.blogspot.com
    The ApexLib Framework: http://apexlib.sourceforge.net
    The APEX Builder Plugin: http://sourceforge.net/projects/apexplugin/

  • To extract null Values from the source in Infopackage selections - Very Urg

    Hi All,
    I need to pull the data which has null values from source. I tried to write routine by giving l_t_range-low = '' , space. nothing is working.
    Please guide me with sample code.
    Very Urgent.
    Regards
    Mano

    Hi Mario.
    Assuming that you want to avoid uploading of records having
    zero for a keyfigure:
    Create a startroutine for transfer rules and add this coding:
    DELETE DATAPAK WHERE VALUE = '0'.
    OR
    LOOP AT DATAPAK.
    IF DATAPAK-VALUE = 0..
    DELETE DATAPAK.
    ENDIF.
    ENDLOOP.
    'VALUE' represents the fieldname in transferstructure
    Please let me know if i misundersttod the issue.
    Regards
    Joe

  • Not to display the null values from data base

    Hiiii.
    In a jsp file i have ten check boxes.The jsp file is mapped to a servlet file for parameter requesting and to
    store it in DB.
    The unchecked box values has null values.All the values are store in a Mysql DB table.
    Again i have to display it in a jsp page from table.
    The problem am facing was,how can i display only the values in a row.it must not display the null values and the crresponding column name.
    Or any other way is their like below
    How i can retrieve only the selected check boxes from tht jsp file.and store in backend.
    Thanks in Advance
    regards,
    satheesh kannan

    Here is a rough example that may give you some ideas:
    On the JSP page:
    <%if(myData.getFirstName()!=null){%>
    Your First Name'
    <input type="text" name="firstName" value="<%=myData.getFirstName()%>">
    <%}%>
    In the servlet:
    String firstName= request.getParameter("firstName");
    if(firstName!=null){
    //write it to the database
    }

Maybe you are looking for

  • Disk utility no longer working after 5.3.1 upgrade - urgent!

    After all of my talk about not becoming an early adopter, this happens - tonight I upgraded my AirPort software to 5.3.1, but after resolving a brief episode of not being able to connect to my AEBS, I was able to restore my Internet access. What I ha

  • How to trigger an existing background job in ABAP program?which fm?

    Hi experts,     how to trigger an existing background job( defined in SM36 ) in ABAP program?which fm?     seems that FM 'JOB_OPEN' / 'JOB_SUBMIT' / 'JOB_CLOSE' can only create a new job.

  • How do I get my iPod songs to stay on a RANDOM SHUFFLE AT ALL TIMES??

    I know I have done it before. But I just had my iPod Nano replaced and cannot figure out how to shuffle my songs. It used to start ar 1 of # every song but now if I pick the third song on the list it's 3 of # and continues down on the list. The only

  • Copying Text Between Illustrator Files

    Hello, I am creating a new document layout in Illustrator CC based on content from an existing document.  I need to paste text from the original document into the new document and reformat it into the style of the new doc.  Is there a way that I can

  • How are input stream buffers managed?

    If I'm reading from a file, and some other process changes a part of the file which is sat inside my buffer waiting to be read by a Reader's read method, what is going to happen? Should I get the updated data, the old data, an exception? Will the res