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

Tags: Database

Similar Questions

  • Where does FireFox get the default value for a preference of. What is the format of the file that contains the default value?

    Where does FireFox get the default value for a preference of. What is the format of the file that contains the default value? I need the actual default value for an individual preference.
    Topic: config shows some default values, but I need the source from which everything: config returns to the default value.
    Any help in this direction is greatly appreciated.

    User Agent

    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x 64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)

    The preferences that are not hidden if they have by default are stored in two JavaScript text files in the Firefox program folder
    You can open them in a tab in Firefox through these links:
    resource:///defaults/pref/firefox.js
    resource:///greprefs/all.js

    (702598/forum/1/702598)

  • 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.

  • 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 )
    
  • How to convert the Null value to 0 after the outer join?

    Hello guys

    My requirement is in fact 2 of outer join tables (that's how), and I got the outer join works very well, so in my report, I have values null of measures in another table of facts as a result of the outer join...

    Is there a way I can convert these nulls to 0?

    I realized that the null value is not stored in the table, it is just following the outer join because the NULL do not match records in other... So by default, I'm expected to get NULL values...

    Is there way to present these nulls to 0?

    Thanks a lot for your advice

    In response, the syntax will be:

    IFNULL (, 0)

    try and let us know how you go.
    See you soon
    Alastair

  • 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

  • Add the Null value at the end of the collection layer

    I need to create layers at the end of the index of the layer and not at the beginning. Is this possible?

    app.project.compItem.layers.addNull () puts a layer at the beginning of the collection of objects, but it should be at the end. Maybe I could add the null value, then rearange the index?

    Like this:

    var myNull = myComp.layers.addNull ();

    myNull.moveToEnd ();

    Dan

  • calculated formula database field trying to insert the null value

    Hello

    I have 3 elements of database text amount, rate and result.
    I enter both values (quantity and frequency), and the property using formula 'result' Gets the computed value.
    On the screen all the values are displayed correctly but when trying to save my information text field 'result' tent to insert the null value.

    Any suggestions?

    Forms 11g

    Thanks in advance

    794018 wrote:
    Hello

    I have 3 elements of database text amount, rate and result.
    I enter both values (quantity and frequency), and the property using formula 'result' Gets the computed value.
    On the screen all the values are displayed correctly but when trying to save my information text field 'result' tent to insert the null value.

    Point formula should not be issue of database. And insert the value in the result column in the database is not good idea.
    Then, if you want to save it. create the database result item and write trigger (When-validate-point) on amount and filed rates and the trigger code, write

    :result:=:amount*:rate;
    

    To display the result on the form, create the database no item and change the formula property and write the formula.

    Hope this will help you

    If someone useful or appropriate, please mark accordingly.

  • May I ask where clause to satisfy two conditions at the same time (and)

    Hello

    I wrote a few joins and usually in the final stage where condition with certain conditions be satisfied in where clause. In all conditions where I only want one and condition fulfilled only if both are collected.

    If we look at the this funciton is I should meet (get_order_type (ogr.order_number) <>'R')) AND wh1.third_party_warehouse! = 'Y') but I'm not get rid off both that if order_type is 'R' they are removed and if tooling_group is yes then ther are removed the result. I'm trying with both below pointed out together how can check these conditions? I can do in where clause?

    ((sg.tooling_stock_group <> 'Y'))

    and

    (get_order_type (ogr.order_number) <>'R'))

    Of order_goods_received ogr

    LEFT JOIN part_master pm

    On ogr.part_number = pm.part_number

    -stock_groups sg left join

    SG stock_groups left join

    on pm.stock_group = sg.stock_group

    and ((sg.tooling_stock_group! = 'Y'))

    and (get_order_type (ogr.order_number)! = 'R'))

    -Pm.stock_group = sg.stock_group

    LEFT JOIN batch_record_1 br1

    -A FEW MORE CODE HERE-

    WHERE ((ogr.delivery_date > = trunc (date_départ)))

    AND

    ((ogr.delivery_date < = trunc (end_date)))

    AND

    OGR.goods_received_number <>'1' AND

    get_order_type (OGR.order_number) NOT IN ('L') AND

    OGR.returned_to_supplier_indicator not in('S','L') and

    -sg.tooling_stock_group <>'Y '.

    -((sg.tooling_stock_group <> 'Y') and (get_order_type (ogr.order_number) not in ('R')))

    -(get_order_type (OGR.order_number) <>'R' AND sg.tooling_stock_group <>'Y')

    ((sg.tooling_stock_group <> 'Y'))

    and

    (get_order_type (ogr.order_number) <>'R'))

    AND wh1.third_party_warehouse! = « Y »

    UNION

    (

    Thank you.

    Whenever you have a problem with such logic, you should try and draw a logic state diagram:

    In your case, you are looking to two variables, with two possible States (equal to a value or is not it)

    Then, take this sense of the sg.tooling_stock_group T and O as being the get_order_type (ogr.order_number) and create a state diagram logical based on your description of what you want.  We will use a value of "Y" to indicate we want to record and a value of "N" to indicate the folder should not be returned.

    Start with an empty logical diagram...

    T = 'Y' T! = « Y »
    +---------+---------+
    |         |         |
    |         |         |
    |         |         | O = 'R '.
    |         |         |
    |         |         |


    +---------+---------+
    |         |         |
    |         |         |
    |         |         | O! = « R »
    |         |         |
    |         |         |
    +---------+---------+

    First of all, you said: "If there is the result returned by the defined user function is"R"and the table that has the tooling_stock_group y then it should avoid this record."

    T = 'Y' T! = « Y »
    +---------+---------+
    |         |         |
    |         |         |
    |    N    |         | O = 'R '.
    |         |         |
    |         |         |
    +---------+---------+
    |         |         |
    |         |         |
    |         |         | O! = « R »
    |         |         |
    |         |         |
    +---------+---------+

    Then you said: "If order_type does not return" R' but the tooling_stock_group is 'Y', then I should not avoid recording ".

    T = 'Y' T! = « Y »
    +---------+---------+
    |         |         |
    |         |         |
    |    N    |         | O = 'R '.
    |         |         |
    |         |         |
    +---------+---------+
    |         |         |
    |         |         |
    |    Y    |         | O! = « R »
    |         |         |
    |         |         |
    +---------+---------+

    Now, you have not given any logic for the rest of the diagram, so I made the assumption that you do not want to avoid these records...

    T = 'Y' T! = « Y »
    +---------+---------+
    |         |         |
    |         |         |
    |    N    |    Y    | O = 'R '.
    |         |         |
    |         |         |
    +---------+---------+
    |         |         |
    |         |         |
    |    Y    |    Y    | O! = « R »
    |         |         |
    |         |         |
    +---------+---------+

    Now there are different ways to determine the location of the clause of this diagram.
    We could say that we want the records for all of the T column! = "Y" or all the records for all of the O line! " = R...

    where (sg.tooling_stock_group! = 'Y' or get_order_type (ogr.order_number)! = 'R')

    We say we want to EXCLUDE (using DO NOT) all records where T = "Y" AND O = "O" "

    If not (sg.tooling_stock_group = 'Y' and (ogr.order_number) get_order_type = 'R')

    Those are the two most logical ways to do.
    (In my previous answer, that we can see in this diagram, there is no need of the "or get_order_type (ogr.order_number).) (= 'R' "part, which is superfluous, but would not break it)

    Now let's look at your logic to see what it looks like to in the diagram...

    where ((sg.tooling_stock_group <> «Y»))
    and (get_order_type (ogr.order_number) <> 'R')
    )

    In a logic diagram that looks to...

    T = 'Y' T! = « Y »
    +---------+---------+
    |         |         |
    |         |         |
    |    N    |    N    | O = 'R '.
    |         |         |
    |         |         |
    +---------+---------+
    |         |         |
    |         |         |
    |    N    |    Y    | O! = « R »
    |         |         |
    |         |         |
    +---------+---------+

    As you can see, your logic was only targeting one of the 4 possible results for select records and excluding 3.

  • Where can I see a copy of the standard for images of the reserve license?

    I can't find a copy of the standard for images of the reserve license.  Where can I see a real license?

    Hello

    Legal terms of use | Adobe

    Additional terms for Stock images can be found here.

    Thank you

    Bev

  • How only include a WHERE clause only when a connection variable has a value?

    I use JDeveloper 11 g using business components of the tables. I'm now modify the auto-generated SQL code to include WHERE clauses which depend on the values of bind variables. For example I have something like this:
    SELECT mytable.firstColumn
    FROM myTable 
    WHERE myTable.secondColumn= :VariableValue
    However, this means that when VariableValue is null SQL would fail and I get an error. Is there a way I can include the WHERE clause (or clause AND according to the position in SQL) only when a bound variable has a value (or a particular value)?

    Or use: WHERE NVL(:VariableValue,myTable.secondColumn) = myTable.secondColumn

  • See the Null value in the measures

    I need to create a report using the SAP BW query.
    I have columns project, task, level and Hrs (measure)

    Project-> task-> level-> Hrs (measure)
    -----------------------------------------------------------------------------------
    one-> a.1-> 1-> null (no value)
    -> a.2-> 2-> null (no value)
    -------------> a.3 ----------------> 3 --------> 300
    ------------------------------------------------------------------------------------

    "Task" is the structure of distribution, a.1, a.2 are level relative to a.3.

    As we can see the 'h' is the total (cumulative) of the 'Project' = 'a '. When a.3 for value but a.2, obtained a.1 null.

    I can see null values in BEx (Business Explorer, SAP BW) report but not in OBIEE report.

    In short, we can display null values in action.

    Hope I explained it correctly.

    Please, help me in this regard.

    PS the reason why you see the values all here when you have only dimensions, but then they disappear when you've done is because of the way the request is generated. OBIEE don't happen in the fact table to what you actually shoot a column of the table of facts in your report. Once you do this, the generated SQL code using an inner join and causes dimensional Records label.

    -Joe

  • Contains the content-value null, the value of metadata

    Hello

    We check the content using batchloader. The batch file is generated from the external application.

    We have two fields in the profile if these values (alphanumeric) comes as the content is always null checking in.

    But if we check in it by the content of the profile is not get verified with null values.we spend the trigger of profile and the profile name in the batch file.

    If I remember correctly, the BatchLoader import process uses the service CHECKIN_UNIVERSAL to ingest files.  Once again, if I remember correctly, CHECKIN_UNIVERSAL does not cause the engine of profiles to call, so your profile (and all the rules in the profile) will be ignored when using BatchLoader.

    If you change the format of your file generated to add a line for each entry ("IdcService is CHECKIN_NEW"), you can use IdcCommand instead of BatchLoader to load the files.  CHECKIN_NEW would invoke the profile to the fire engine.

  • test for the null value to IN request (null, 'a ', ' b', 'c')

    Hello

    Oracle 10.2.0.4

    I think the following query is incorrect, in my opinion. (there is an index on the collar, but NULL values are ignored?

    SELECT COUNT (*) < table > where col in (null, 'a ', ' b', 'c')

    It works (no errors) and forth fast enough.

    However, I think the correct query would

    SELECT COUNT (*) < table > where IS NULL or neck neck ('a', 'b', 'c')

    It takes a lot of time. As I see it, he performs a table scan for part of the value NULL and use the index for the rest, as the index cannot be used for NULL values.

    I would appreicate an explanation on this matter, particularly why Oracle accepts the first query "where col in (null, 'a ', ' b', 'c')" without any problem.

    Thank you

    A null value is not equal to what whatsoever, not even another null value. This is consistent with the definition of the ANSI. For your first request is not what you think it does, even if it is not syntactically incorrect.

    The second query is correct. If you want to use an index, you must create a bitmap index (which requires Enterprise Edition licenses), because they do not include the values NULL, unlike B * tree index.

  • Evolution of the null value in the data view tab

    Is it possible to update a null value in the data view table tab? When I delete the value, it creates a sql such as

    Update table set column is where id = 1;.

    How to fill a null from the data tab?

    I met (and displayed) on this same problem some time. (See forum article "invalid column index: getValidColumnIndex" in SQL Developer 1.5.4 . "") Jim Smith pointed out it seems to be the reappearance of an old bug.

    There are some alternatives. One is "do-it-yourself" in the SQL or SQL worksheet * more. (I.e., "UPDATE someTable SET someColumn = NOTHING WHERE tablePKColumn = pkValue;". The other is to use an earlier version of SQL Developer for that in the view of table data. (I still have Developer SQL 1.5.1 installed just for this reason).

    I hope this helps.

    Hrsg.:.

Maybe you are looking for