How to avoid to check if a column value is NULL?

Hi, I'm a newbee in Oracle.
I have a procedure like this:
create or replace
PROCEDURE get_employee
     v_first_name IN VARCHAR2 DEFAULT NULL ,
     v_middle_name IN VARCHAR2 DEFAULT NULL ,
     v_last_name IN VARCHAR2 DEFAULT NULL ,
To select rows with matching multiple column values, I can simply do this:
SELECT *
FROM employee
WHERE first_name = v_first_name
AND middle_name = v_middle_name
AND last_name = v_last_name
The problem is v_middle_name can be NULL. This means,
I need check if v_middle_name is NULL, and if it is, I need use "IS NULL" instead, like this:
SELECT *
FROM employee
WHERE first_name = v_first_name
AND middle_name IS NULL
AND last_name = v_last_name
It seems very cumbersome to do a check for each column that can be null.
Is there a way that I do not need to do a check for every column?
or is it better to avoid having NULL values in those columns (and replace them with, say a space) ?
Thanks in advance.
Simon

Normally, you would do something like
SELECT *
  FROM employee
WHERE first_name = NVL( v_first_name, first_name )
   AND middle_name = NVL(v_middle_name, middle_name )
   AND last_name = NVL(v_last_name, last_name )Of course, if you can ensure that NULL data is not allowed (without creating phony non-NULL data), that is a good thing. In most systems, for example, it is probably reasonable to require a non-NULL first and last name. But you almost certainly cannot require a middle name.
Justin

Similar Messages

  • How to avoid authorization checks while debugging

    Hi,
    Can anyone let me to know how to avoid authorization checks while debugging
    for a standard transaction?
    -B S B

    Hello BSB,
    To start the debug put /hs will start the system debug.
    Then place the break points aat STATEMENT -- MESSAGE and F8
    So now the system will stop at the point where it throwing the error message change the value of SY-SUBRC to 0 from 4.
    Regards,
    Vasanth

  • How to get fourthly row (row4) first column value (col1) in matrix

    Hi to all,
    In FMS, how to get fourthly row (row4) first column value (col1) in matrix in document.
    select $[$38.1.4]
    But it display the first row
    Please give me hint.
    Thank you

    Hi Eric,
    FMS may only apply to current row.  There is no way to get any other fixed row.
    Thanks,
    Gordon

  • ORA-01405: fetched column value is NULL

    Hi All,
    I am using OWB 10gR2 and DB 10gR2. I am getting the following error while executing the mapping,
    ORA-01405: fetched column value is NULL.
    I have used NVL function for the measure columns, but the problem is not solved.
    Can anybody please tell me solution,
    Thanks in advance,
    Siva

    Hi Siva
    It may be that you've taken care of null value in just one place and now, the error is coming
    from somewhere further down the line.
    Regards
    Arif

  • How to avoid extended checks for the events used in ALV.

    Hii,
    I hav delvpd an alv report in which i hav used events for which i haven't declared PERFORM for the same. but when i had checkd in the Extended program checks it says that form interface is not called directly.. check for dynamic PERFORMS...
    how to avoid this error in the extended check program.

    Another option can be calling the routine from the program itself with a check that never satisfies.
    like:
    if 1 = 2.
    perform top_of_page.
    endif.
    form top_of_page.
    endform.
    Regards,
    Joy.

  • How to prevent editing a SharePoint site column value from document properties view of a downloaded document?

    Hi,
    We have created a SharePoint site column with below settings
    1. ShowInEditForm - False
    2. ShowInNewForm - False
    3. ShowInDisplayForm - True
    With the above definition, the site column showing only in view properties form not in New and Edit forms.  This column is added to a document library and updating this column value will be managed by event receiver code when a document is uploaded.
    Till this point, everything is working OK.
    But the issue is when we download and open a document from the above document library, under document properties the above column (with value) is visible along with other document default properties and  this column value is editable. With this issue,
    user is able to set a new value and overwrite the existing value by re-uploading the document.
    Could you please let me know how to handle this issue so that user should not be allowed to edit except viewing the value/property (read only)?
    Thanks in advance.
    Regards
    Ramesh

    You can set "ShowInFileDlg" property of field to "FALSE". Using this you will not see that field in document properties list

  • Id column values for null objects

    If I have something like the following, where B.id is mapped to an INTEGER
    column in A's table, Kodo wants to store a NULL value into the column. This
    doesn't work if the column is specified as NOT NULL. Is there a way to
    configure Kodo to use some predefined integer value instead, such as 0
    or -1?
    class A {
    int id;
    B b;
    class B {
    int id;
    A a = new A();
    a.id = 123;
    a.b = null;
    pm.makePersistent(a);
    pm.currentTransaction().commit();

    I'm not sure what you mean by "value mapping." In my case, I am mapping a
    null reference to another object. I am using application identity. Here's a
    more complete example (still very abbreviated, but hopefully complete
    enough):
    class A {
    static class Id { int id; }
    int id;
    B b;
    class B {
    static class Id { int id; }
    int id;
    int value;
    create table A (ID integer not null, BID integer not null)
    create table B (ID integer not null, VALUE integer)
    <jdo>
    <package name="test">
    <class name="A" objectid-class="A$Id">
    <extension vendor-name="kodo" key="table" value="A"/>
    <field name="id" primary-key="true">
    <extension vendor-name="kodo" key="data-column" value="ID"/>
    </field>
    <field name="b">
    <extension vendor-name="kodo" key="id-data-column" value="BID"/>
    </field>
    </class>
    <class name="B" objectid-class="B$Id">
    <extension vendor-name="kodo" key="table" value="B"/>
    <field name="id" primary-key="true">
    <extension vendor-name="kodo" key="data-column" value="ID"/>
    </field>
    <field name="value">
    <extension vendor-name="kodo" key="data-column" value="VALUE"/>
    </field>
    </class>
    </package>
    </jdo>
    A a1 = new A();
    a1.id = 123;
    a1.b = new B();
    a1.b.id = 456;
    a1.b.value = 999;
    pm.makePersistent(a1);
    A a2 = new A();
    a2.id = 789;
    a1.b = null;
    pm.makePersistent(a2);
    pm.currentTransaction().commit();
    The inserts for table A look something like this:
    insert into A (ID, BID) values (123, 456)
    insert into B (ID, VALUE) values (456, 999)
    insert into A (ID, BID) values (789, NULL)
    The NULL value fails because the column is specified as NOT NULL
    (pre-existing schema scenario).
    What I need to be able to do is specify what value gets inserted for null
    object references. Kodo is inserting NULL. I need to insert -1.

  • How to avoid Automatic Rounding of number column?

    In 10g 10.2.0.4 database I am seeing the below automatic rounding issue. How can I remove this automatic rounding.
    create table test (a number(28, 12))
    insert into test values (7051743.889999999665)
    select * from test
    Result:
    7051743.89
    But I want the result as what I entered i.e. 7051743.889999999665 so please guide how can I achieve this.

    But I want the result as what I entered i.e. 7051743.889999999665 so please guide how can I achieve thisWhat is your client? In SQLPlus you can use FORMAT:
    SQL> column a format 999999999999999.999999999999
    SQL> select * from test;
                                  A
             7051743.889999999665
    1 row selected.

  • How to  delete the charater from a column value

    Hi could anyone please enlighten me how to achieve this?
    I have table called CAMAPIGNS there is one column called NAME with no limit of length.
    Already data in my table i want to delete the character exceeding 100 length from the column NAME.

    Hi,
    I think below script is usefull for you.
    delete from CAMAPIGNS where name in (select name from CAMAPIGNS where length(name) > 100);
    Regards,
    Fame

  • How to create a table with editable column values.

    Hi everyone,
    I think this is very simple but i'm not able to find how to do this. This is my requirement. I need to create a table with n columns and 1 row initially. user should be able to enter data into this table and click of a button should insert data into the data base table. Also there should be a button at the bottom of the table to add 1 row to the table.
    I know how to do the insert to database, but can anyone please let me know how to create a table that allows user to enter data and how to create a add 1 row button?
    Thanks in Advance!

    Raghu,
    Go through the ToolBox tutorial Create Page & Advanced table section of OAF Guide.
    Step 1 - You require to create EO & a VO based on this EO. This EO will be of DataBase table where you want to insert the data.
    Step 2 - Create a Advanced table region. (Refer this Adavanced table section for more on this)
    Step 3 - Attach this VO in the BC4J component of Adavanced Table region.
    Regards,
    Gyan

  • How to generate a report group by column value

    I have a table with five columns:
    c1, c2, c3, c4, count.
    I want to generate a report like this
    Total
    c1, c2
    c3, c4
    such as the values inside the table are:
    a1 b1 cc dd 2
    a1 b1 ee ff 3
    a1 b1 gg hh 4
    a1 b2 jj kk 3
    a1 b2 ll mm 4
    a1 b2 nn oo 2
    a3 b3 pp qq 3
    a3 b3 rr ss 4
    the report will be like:
    a1-b1
      cc-dd 2
      ee-ff 3
      gg-hh 4
    Total for a1-b1 9
    a1-b2
      jj-kk 3
      ll-mm 4
      nn-oo 2
    Total for a1-b2 9
    a3-b3
      pp-qq 3
      rr-ss 4
    Total for a3-b3 7
    What is the best way to achieve this?
    Thanks.
    Jen

    Hi Jen,
    Personnaly I would use a PL/SQL region and use MOD_PLSQL (htp.p) to create such a special layout, but then again you should know how to do it.
    Another way would be to create a select statement in which you select the lines you want:
    select c1||'-'||c2 key1, 0 key2, 'category '||c1||'-'||c2 , null count from table
    union
    select c1||'-'||c2, rownum, rpad(' ',5)||c3||'-'||c4, count from table
    union
    select c1||'-'||c2, count(*)+1, 'Total for cat. '||c1||'-'||c2 , sum(count)
    from table group by c1||'-'||c2, 'Total for cat. '||c1||'-'||c2
    union
    select c1||'-'||c2, count(*)+2, ' ',null from table group by c1||'-'||c2 /* empty line */
    order by 1, 2
    You can base a normal report on this.
    good luck,
    Dik

  • How to generate page break based on column value

    I am new to Reports. So please excuse me if it has been answered.
    Please help me to generate a page break when the database table column is a cetain value.
    Specifically, if the DAY of a reserv_date column is 'Monday' then I should generate a page break.
    Thanks for your help.

    Hi,
    Try this solution
    SOLUTION EXPLANATION:
    Go to the layout editor and add a horizontal line to the layout.
    Place this line directly below the field that will be associated with the format trigger.
    The line should also be within the repeating frame of the referenced column.
    Apply line color to make the line white (so it won't show up in the printed report) and set the properties to Page Break Before.
    Then add a format trigger on the line object to check the value of the desired
    column.
    For instance, if a master-detail report is created on the EMP table,
    and a page break is desired whenever the value of the COMM field is not null,
    create a trigger as follows:
    function b_1Format trigger return boolean is
    begin
    if :comm is not null
    then
    return (true);
    else return (false);
    end if;
    end;
    When the report is run, a page break will occur whenever the value of COMM is
    not null.
    Thanks,
    Oracle Reports Team

  • How to avoid report running for all the values in roll up of guided naviga

    Hi
    Thanks in Advance
    I have 3 reports on three different pages of a dashboard. (Implemented guided navigation on one column of each report).When I click on value of guided navigation column it guides me to report 2 for that particular value (is prompted), same way for 3 report also till here it works fine.
    However when I return from report 3 to report 2 and 2 to 1, the reports are running for all the values instead for the value which was passed by guided navigation of previous report earlier (Value on which I clicked to pass to the next report).
    Edited by: 808623 on Nov 9, 2010 2:10 AM

    Yes
    Example : If i click on values 'X' in report 1
    Report 2 shows results for 'X' only. And if i click on Value say 'Y' in 2 then report 3 shows for only 'Y'. But when i rollup from 3 to 2, Report 2 is showing for all values rather than showing 'x'.
    I'm using Link or Image Dashboard Object > Destination>Request or Dashboard (path of previous report)
    Edited by: 808623 on Nov 9, 2010 2:37 AM

  • How to filter a table according to column values in CRM2007 WebUI ie ICWC.

    Hi,
    I am working in CRM 2007 ICWC.
    My question is I need to filter the sales items table according to quantity entered in the sales order.How do I do it.I cannot use Filter = 'server' as it is obsolete in CHTMLB:Tableview tag.
    Please suggest a solution.
    Thanks,
    Ashish.

    Hi Ashish,
    I think you have to manually iterate the collection and filter them according to the value of quantity in each line.
    Regards, Sudeep..

  • How to avoid # in the report output in BEx for null characteristic values?

    Hi All,
    In a query output, # values are shown for the charactersitics which are null. I would appreciate if someone would help showing null instead of # in the reports for the null values.
    Regards
    Subba

    Hi,
    There are various options.
    1. Exclude the # in filters for that chararcteristics, it will remove all # values.
    2. Display the text for that Characteristcs which will be displayed as "Not assigned".
    3. If you want to display as "Null", Change the entry in text table of the charaterictics for value # as "Null".
    4. While updating this filed in cube/DSO write routine to replace #/blank with "Null".
    I hope it will help.
    Thanks,
    S

Maybe you are looking for

  • What is the file attribute @ and how can I get rid of it

    I converted some wav files using Roxio Toast 11 and the output AIF files have a '@' in the file permissions and are not displayed in Finder. What does the '@' mean and how can I get rid of it. Would love to know why Toast adds it but I posted a quest

  • What is overset text and how do I remove it?

    I use ID to format and design my high school's newspaper, so I'm not familiar with a lot of features and aspects that it entails; I have a rather basic understanding of the program.  I was trying to export books of the pages into PDF format in order

  • Getting extra things in the uploaded file by flex file upload

    Hi, I am working on a application where I am using adobe flex. I have a requirement wher I have to upload file to the server. System allows user to browse file from local machine and flex uploads it to the server. Now there is a upload url, its a jsp

  • [SOLVED]wlan0 up - Operation not possible due to RF-kill

    Hello everyone. I've encountered trouble trying to activate my wlan0 interface and I was wishing that someone here might be able to help me. $ip link 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default link/

  • Goldmine- Outlook-Treo 650 calander sync errors

    I've been getting continuous errors on syncing my data from Goldmine to Outlook to Palm Treo 650.  I hotsync from goldmine to outlook to treo(see further below for my question on that procedure), and the hotsync manager reports the following: Outlook