Check that at least one variable is set

I have 10 variables/parameters and i want to ensure that at least one of those is not empty/null. What is the best way to check that?
Example of parameters:
p_item_category1 varchar2,
p_item_category2 varchar2,
p_item_category3 varchar2,
p_item_category4 varchar2,
p_item_category5 varchar2,
p_item_category6 varchar2,
p_item_category7 varchar2,
p_item_category8 varchar2,
p_item_category9 varchar2,
p_item_category10 varchar2
Should the best way be as:
if (p1 is not null) or
(p2 is not null) or
(p10 is not null) then
--at least one parameter has value, ok,
else
--all parameters are empty, give error message
This code looks long, is there cleaner* better way to achieve the same?
Maybe there is a system function "AtLeastOnInSetIsNotNull", something like
if AtLeastOnInSetIsNotNull(p1,p2,..,p10) then...
That would be more handful.

Seems like coalesce is even better, thx.
declare
p1 varchar2(1) := null;
begin
dbms_output.PUT_LINE(coalesce(null,'1',null,'2'));-- outputs: 1
if coalesce(null,p1,null,null) is null then
dbms_output.PUT_LINE('all parameters are null');--outputs: all parameters are null
end if;
end;

Similar Messages

  • Check that at least on Selection Options are filled

    I have a program that has four selection options.  The user needs to enter a selection for at least one of the four selection options.  I coded this check in AT SELECTION-SCREEN ON BLOCK xyz.  This does not work because I have to enter at least one value first before I can load multiple values from a text file or the clipboard.
    I only want the code that checks if at least one selection option is populated to execute when I select the EXECUTE button.  How do I do this?
    Thanks.
    Sandy

    HI
    GOOD
    GO THROUGH THIS REPORT
    REPORT ZSUBSCREEN.
    TABLES: USR02,       "Logon data
             SSCRFIELDS.  "FIELDS ON SELECTION SCREENS
    SUBSCREEN 1
    SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-010.
        SELECT-OPTIONS: USERNAME FOR USR02-BNAME.
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN END OF SCREEN 100.
    SUBSCREEN 2
    SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-020.
        SELECT-OPTIONS: LASTLOGI FOR USR02-TRDAT.
    SELECTION-SCREEN END OF BLOCK B2.
    SELECTION-SCREEN END OF SCREEN 200.
    SUBSCREEN 3
    SELECTION-SCREEN BEGIN OF SCREEN 300 AS SUBSCREEN.
    SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-030.
        SELECT-OPTIONS: CLASSTYP FOR USR02-CLASS.
    SELECTION-SCREEN END OF BLOCK B3.
    SELECTION-SCREEN END OF SCREEN 300.
    STANDARD SELECTION SCREEN FOR SCROLLING LEFT AND RIGHT
    SELECTION-SCREEN: FUNCTION KEY 1,
                       FUNCTION KEY 2.
    SELECTION-SCREEN: BEGIN OF TABBED BLOCK SUB FOR 15 LINES,
                       END OF BLOCK SUB.
    START-OF-SELECTION.
         SELECT * FROM USR02 WHERE BNAME IN USERNAME
                               AND ERDAT IN LASTLOGI
                               AND CLASS IN CLASSTYP.
            WRITE: / 'User ', USR02-BNAME,
                     'Last Login Date ', USR02-TRDAT,
                     'Last Login Time ', USR02-LTIME,
                     'CLASS ', USR02-CLASS.
         ENDSELECT.
    END-OF-SELECTION.
    INITIALIZATION.
    SCREEN ICON LEFT AND RIGHT
       SSCRFIELDS-FUNCTXT_01 = '@0D@'.
       SSCRFIELDS-FUNCTXT_02 = '@0E@'.
       SUB-PROG = SY-REPID.
       SUB-DYNNR = 100.
    AT SELECTION-SCREEN.
       CASE SY-DYNNR.
         WHEN 100.
           IF SSCRFIELDS-UCOMM = 'FC01'.
             SUB-DYNNR = 300.
           ELSEIF SSCRFIELDS-UCOMM = 'FC02'.
             SUB-DYNNR = 200.
           ENDIF.
         WHEN 200.
           IF SSCRFIELDS-UCOMM = 'FC01'.
             SUB-DYNNR = 100.
           ELSEIF SSCRFIELDS-UCOMM = 'FC02'.
             SUB-DYNNR = 300.
           ENDIF.
         WHEN 300.
           IF SSCRFIELDS-UCOMM = 'FC01'.
             SUB-DYNNR = 200.
           ELSEIF SSCRFIELDS-UCOMM = 'FC02'.
             SUB-DYNNR = 100.
           ENDIF.
       ENDCASE.
    AND TRY TO IMPLEMENT IN YOUR REPORT
    THANKS
    MRUTYUN

  • I cannot find a photo I did a lot of work to create. I have several library files that look similar but I found that at least one photo is not in both. Can I somehow merge these libraries. Can someone tell me how.

    I cannot find a photo I did a lot of work to create. I have several libraries that look similar but I found at least one photo that was in one and not the others. Can someone tell me if I can merge these libraries, and how, and what to watch for that might cause problems.

    the paid version of iPhoto library manager can merge libraries safely
    Why do you have several libraries? Why are you not just using the one that has what you want?
    LN

  • "must choose at least one" validation in dataTable?

    Hello, group,
    How do you validate a set of checkboxes, one per table row, in which the user must select at least one?
    We have a page containing a dataTable, each row of which represents an object, one of whose attributes is "active". Our requirement is that at least one object must be selected as "active" by the user.
    How do we validate this?
    I'm considering the following:
    (1) Put a validator on each checkbox that simply increments a count in a request-scoped bean if the checkbox is checked (and always returns success).
    (2) Put a validator on a hidden field at the bottom of the form that requires the count be greater than zero.
    Is there a better way? (Will this even work at all? :) )
    Thanks.
    John.

    Looks interesting, thank you very much.
    I would actually need the multiple row selector, I think, since the requirement is at least one. I see there's no "validator" attribute, but I assume we could just hang a f:validator off of it (or write our attribute and submit a patch!).
    That jenia component set looks good for some other requirements we have.
    John.

  • Is it possible to force a value in at least one of several columns?

    Is it possible to define a constraint that says at least one of a set of columns must have a value?
    I have a table of securities.  There are three types of security identifiers that I am recording: CUSIP, SEDOL, ISIN.  So I have a column for each type of identifier.  Is it possible to set a constraint to make sure that at least one of those
    columns has a value?
    Thanks.
    J
    http://digitalcamel.blogspot.com/

    Hi J,
    Try like this,
    CREATE TABLE T1
    CUSIP int ,
    SEDOL int,
    ISIN int,
    CHECK (CUSIP IS NOT NULL OR SEDOL IS NOT NULL OR ISIN IS NOT NULL)
    INSERT T1 SELECT 1,NULL,NULL
    INSERT T1 SELECT NULL,2,NULL
    INSERT T1 SELECT NULL,NULL,3
    INSERT T1 SELECT NULL,NULL,NULL
    SELECT * FROM T1
    sathya - www.allaboutmssql.com ** Mark as answered if my post solved your problem and Vote as helpful if my post was useful **.

  • Using URL variable to set initialy selected ds row

    Hello everyone,
    Could anybody suggest a solution or point me to a working
    demo of a script that processes a URL variable and set the current
    row accordingly. I am trying to pass a @id of a particlar row in a
    URL variable to identify a particluar row, I want to be selected
    initially.
    Thanks,
    Nick

    Hy guys,
    Just figured it out myself. Here is the script:
    <script type="text/javascript">
    // define your datasource. I have called it dsGallery. This
    name is used later in the script a few times
    var dsGallery = new Spry.Data.XMLDataSet("gallery.xml",
    "/gallery/photos/photo");
    dsGallery.addObserver({ onPostLoad: function(ds, type) {
    var strReturn = "";
    var strHref = window.location.href;
    if ( strHref.indexOf("?") > -1 ){
    var strQueryString =
    strHref.substr(strHref.indexOf("?")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    for ( var iParam = 0; iParam < aQueryString.length;
    iParam++ ){
    if (
    aQueryString[iParam].indexOf('id' + "=") > -1 ){
    var aParam = aQueryString[iParam].split("=");
    strReturn = aParam[1];
    // look if a row with a matching @id is present in the
    datasource
    var row = dsGallery.findRowsWithColumnValues({"@id":
    strReturn}, true);
    // If we have a matching row, make it the current row for the
    data set.
    if (row) dsGallery.setCurrentRow(row.ds_RowID);
    break;
    </script>
    Thanks to the folks whose scrips were really helfull in
    building this one.
    Nick

  • Check if a license exists for at least one day in each month

    How to check if a license exists for at least one day in each month for a given period ? Example : If we have a review period from Jan 25 2009 to Aug 15 2009. How to check if there is license for at lease one day in every month.

    Hi,
    Welcome to the forum!
    (1) construct a table or result set that has one row per month in the review period. [This thread|http://forums.oracle.com/forums/thread.jspa?messageID=3651350?] has a similar problem.
    (2) outer-join your actual data to that result set
    (3) use the aggreagate COUNT (x) function (where x is some column from your table) to see if there were any matches in each month. GROUP BY months.
    For a more specific answser, ask a more specific question.
    Post a little sample data (CREATE TABLE and INSERT statements), and the results you want from that data.
    It never hurts to say what version of Oracle you're using.
    Edited by: Frank Kulash on Jul 28, 2009 1:54 PM
    Maybe something like:
    WITH  all_months  AS
         SELECT     ADD_MONTHS ( TRUNC ( &period_begin_date
                                , 'MM'
                      , LEVEL - 1
                      )         AS month_date
         FROM    dual
         CONNECT BY  LEVEL <= 1 + CEIL ( MONTHS_BETWEEN ( &period_end_date
                                                          , &period_begin_date
    SELECT       m.month_date
    ,       CASE  COUNT (l.license_date)
                WHEN  0  THEN  'Nothing this month'
                          ELSE  'Some licenses issued'
           END     AS summary_txt
    FROM            all_months     m
    LEFT OUTER JOIN     license_table     l     ON  m.month_date     = TRUNC (l.license_date, 'MM')
                                     AND l.license_date     BETWEEN  &period_begin_date
                                                AND      &period_end_date
    GROUP BY  m.month_date
    ORDER BY  m.month_date
    ;Untested

  • Unable to execute runInstaller: Check if the DISPLAY variable is set

    I am unable to run the Oracle Installer (runInstaller) on my Solaris10 client (Windows Vista PC). The IP address of my PC is 192.168.0.191 and the IP address of the remote Sun server (from which I am invoking the runInstaller) is 192.168.0.192.
    COULD ANYONE PLEASE HELP ME WITH THE FOLLOWING ERROR. Thank you in advance.
    Database server machine: Solaris 10
    Client machine: Windows vista
    Connected via: SecureCRT with X11 packet forwarding enabled
    ---( ERROR )-----------------------------------------------------------
    oracle@pvsparc$ id -a
    uid=100(oracle) gid=102(oinstall) groups=102(oinstall),100(dba),101(oper)
    oracle@pvsparc$
    oracle@pvsparc$ echo $DISPLAY
    192.168.0.191:0.0
    oracle@pvsparc$
    oracle@pvsparc$ ./runInstaller
    Starting Oracle Universal Installer...
    Checking installer requirements...
    Checking operating system version: must be 5.8, 5.9 or 5.10. Actual 5.10
    Passed
    Checking Temp space: must be greater than 250 MB. Actual 2073 MB Passed
    Checking swap space: must be greater than 500 MB. Actual 2160 MB Passed
    Checking monitor: must be configured to display at least 256 colors
    >>> Could not execute auto check for display colors using command /usr/openwin/bin/xdpyinfo. Check if the DISPLAY variable is set. Failed <<<<
    Some requirement checks failed. You must fulfill these requirements before
    continuing with the installation,at which time they will be rechecked.
    Continue? (y/n) [n]
    -------------------------------------------------------------------------------

    I don't know XMing, but for CygWin, you have to use a Cygwin windows to enable the XClient, not an external tool. Did you use the XMing tool windows, or did you continue with SecureCRT ?
    Steps for Cygwin :
    1. install from http://cygwin.com/setup.exe
    2. choose installation from internet
    3. the following server worked for me http://cygwin.cybermirror.org
    4. ensure the following packages are check :
    xorg-x11-base (2 KiB; required, automatically selects a base set of packages for the typical installation)
    xorg-x11-bin (1.2 MiB; optional, executables for xterm, twm, etc.)
    xorg-x11-bin-dlls (2 MiB; optional, libraries (DLLs) for executables.)
    xorg-x11-bin-lndir (5 KiB; optional, lndir program, useful for developing)
    xorg-x11-devel (964 KiB; optional, additional files needed to compile programs for Cygwin/X)
    xorg-x11-etc (335 KiB; required, configuration files for the X Server and programs in xorg-x11-bin)
    xorg-x11-f100 (12 MiB; optional, 100 dpi fonts (75 dpi fonts are used by default))
    xorg-x11-fcyr (368 KiB; optional, Cyrillic fonts)
    xorg-x11-fenc (489 KiB; required, font encodings)
    xorg-x11-fnts (16.4 MiB; required, 75 dpi fonts)
    xorg-x11-fscl (2.2 MiB; optional, Speedo and Type1 scalable fonts)
    xorg-x11-fsrv (201 KiB; optional, X Font Server)
    xorg-x11-libs-data (154 KiB; required, X11R6/lib/ files)
    xorg-x11-man-pages (551 KiB; optional, man pages)
    xorg-x11-man-pages-html (596 KiB; optional, man pages in html format)
    xorg-x11-nest (1.1 MiB; optional, Xnest nested X Server)
    X-start-menu-icons (4 KiB; optional, adds icons for X Clients to the Start menu)
    X-startup-scripts (22 KiB; required, example X Server and client startup scripts)
    xorg-x11-vfb (1.2 MiB; optional, X Virtual Frame Buffer (Xvfb) server)
    xorg-x11-xwin (1.3 MiB; required, the Cygwin/X X Server)
    xorg-x11-xwin-gl (761 KiB; optional, the Cygwin/X X Server with ***EXPERIMENTAL*** GLX acceleration)You may also want to ensure that the inetutils and openssh packages are selected if you wish to use telnet and ssh to connect to remote machines.
    5. open the Cygwin icon on your desk
    6. run the following command in the new opened window (a DOS window command) :
    sh /usr/X11R6/bin/startxwin.sh7. from the new window (a X window session), run
    ssh -Y RemoteServerIPaddress8. test by runing a xlock command
    Nicolas.

  • How set value for more than one variable using a single prompt

    There is a way to set more than one variable with a single prompt?
    e.g. set @CurrentYear and @PasteYear using just a single prompt for @CurrentYear.
    Some hint?
    Thanks
    Luc

    Using repository variables you can set like that.
    Check this link http://gerardnico.com/wiki/dat/obiee/set_variable
    If helps pls mark

  • How can I enable spell checking for a text box that is just one line, e.g. subject in e-mail?

    In a prior version of Firefox I found a website somewhere that told me what to do to enable spell checking for text boxes that are just one line. I got used to being able to send an e-mail with a Subject Line that didn't have a misspelling. Now it doesn't work. Please tell me how I can enable that again. I am on a Mac using Firefox 6.0.2. Thanks!

    See:
    *http://kb.mozillazine.org/Spell_checking
    *http://kb.mozillazine.org/layout.spellcheckDefault
    You can set the pref <b>layout.spellcheckDefault</b> to <i>2</i> on the <b>about:config</b> page.
    To open the <i>about:config</i> page, type <b>about:config</b> in the location (address) bar and press the "<i>Enter</i>" key, just like you type the url of a website to open a website.<br />
    If you see a warning then you can confirm that you want to access that page.<br />
    *Use the Filter bar at to top of the about:config page to locate a preference more easily.
    *Preferences that have been modified show as bold (user set).
    *Preferences can be reset to the default or changed via the right-click context menu.

  • Error when a TS step has a condition to check for custom variable. Variable is set on the collection.

    SCCM Version = SCCM 2012 R2 CU3
    Background
    I would like to setup some sort of safety check to help prevent accidentally sending and OSD out to all the servers managed by SCCM. The solution I am trying to use is making the TS do a check for a custom variable. If the variable is NOT set to TRUE
    then it should reboot the machine back to the currently installed OS.
    The variable is called "AllowOSD"
    AllowOSD is set correctly on my "Test Servers" collection
    I'm using the built in "Reboot Computer" step in the TS
    The condition on the Reboot Computer step is very basic - "Task Sequence Variable AllowOSD is not equal TRUE".
    I am testing the TS on a VM guest (Hyper-V)
    I'm deploying via PXE for these tests...
    The Issue
    As soon as the TS starts I get the annoyingly generic 0x80004005 error - smsts.log posted on github -
    smsts.log-A
    Possibly related issue:
    I have a vbscript that prompts for, and sets, the computer name. This works fine if placed after the format disk step, but if I place it before the format disk step then I get error 0x800700A1. If I format the internal HD first then I don't get an error
    and it all works fine.
    smsts.log posted on github - smsts.log-B
    Be aware VM_1 and VM_2 have unformatted disks (vhdx). I don't want them to be formatted before checking that the task sequence should really be running in the first place. As already mentioned, I am trying to prevent someone wiping out a bunch of servers
    by accident.
    My Task Sequences are based on the defaults created by the wizard. Here are the step I'm using...
    * Reboot if AllowOSD is not TRUE
    Restart in Windows PE
    * set Computer Name
    Partition DIsk 0 - DIOS
    Partition Disk 0 - UEFI
    Install Operating System
    Apply Windows Settings
    Apply Network Settings
    Setup Windows and Config Manager
    * = steps I have created.
    All other steps are defaults as created by wizard.
    Please note the "Restart in Windows PE" step does a conditional check on "_SMSTSInWinPE" without any errors. it is looking like the use of custom variables is not supported until the local HD is formatted and mounted. Can
    anyone confirm this behaviour, or what I can do to get around this problem.
    I have tried using a vbscript but triggering a reboot from VB does nothing, hence using the Reboot Computer step in the TS.
    Thanks
    "Well I'm all out of ideas." - 85

    As others have stated, your options are limited the moment you rely on PXE and WinPE but I think all you need to do is refine your collection target a bit.
    Why not instead of deploying your TS to All Systems (which is what I'm guess you're doing) and trying to put a condition in, deploy to a collection that is based on a workstation collection then include unknown computers?  Then any "known workstation"
    will have a MAC stored and thus be permitted to use the TS, unknown machines will be as well ... but "known servers" will be blocked?
    COnsidering the PXE looks for permitted MAC addresses this should work (Ill try it in my own lab).
    Tested and verified:
    Simply create a collection with a parent collection of all systems.
    Add a workstation query:
    select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System where SMS_R_System.OperatingSystemNameandVersion LIKE "%Workstation%"
    Then "include" unknown computers.
    End result is any machine that has "server" in it's version that has already been deployed will not be able to use the deployment.  If you'd rather base existing computer on an OU or group membership just modify the first query how you see fit.
     This will let known workstations (or whatever) and unknown machines get deployed to ... but known machines NOT in that collection will be skipped.

  • My first generation AppleTV will not sync with iTunes anymore.  I get an error message that says: "The Apple TV is not responding Check that any firewall software running on this comptuter has been set to allow communication on port 3689"  firewall is off

    My first generation AppleTV will not sync with iTunes anymore.  I get an error message that says: "The Apple TV is not responding Check that any firewall software running on this comptuter has been set to allow communication on port 3689"  firewall is turned off.. Any ideas?

    Thanks Rudegar,
    I only synch and do not stream off of my 1st Gen AppleTV
    I will try with ethernet but will be a pain in the butt if i can not fix it with wifi for long term fix
    I may end up trying to do a named IP address vs DHCP for this appleTV (not sure if i can do both and do not want to remove DHCP as i have a bunch of sensors and other devices that I prefer to dynamically add to the network via DHCP vs. assign each one
    Will keep working on other fix options (factory reset, etc.)
    Thanks again

  • Is there a way that you can have two different text fields (email, phone) that one at least one of them must be completed before submitting the form? Can it be done using javascript in the validation tab? if so, how?

    Is there a way that you can have two different text fields (email, phone) that one at least one of them must be completed before submitting the form? Can it be done using javascript in the validation tab? if so, how?

    Here is one solution:
    // mouse up action for submit button;
    function GetField(cName) {
    // get field object for cName field with error checking;
    var oField = this.getField(cName);
    if(oField == null) app.alert("Error accessing field named " + cName + "\nPleae verigy field name, spelling and capitalizeation.", 1, 0);
    return oField;
    } // end GetField function;
    var oPhone = GetField("phone");
    oPhone.required = oPhone.value == oPhone.defaultValue;
    var oEmail = GetField("email");
    oEmail.required = oEmail.value == oEmail.defaultValue;
    if(oPhone.required && oEmail.required) {
    app.alert("Missing required fields.", 1, 0);
    } else {
    app.alert("Submitting form", 3, 0);
    // additional code for submission;

  • How to check whether a field contains at least one numeric value

    how to check whether a field contains at least one numeric value..

    Hi,
    I hope that this code will works.
    constants:
       c_digit_grp        TYPE char11         VALUE '0123456789',        " Digit group
    * Data Declaration
    data :
      str   type string.
    * if you want check entire string and pass entire string
    if  str CA c_digit_grp.
    * write your logic ---this block will execute atleast one numeric value exists in the string
    Endif.
    Regards
    Bhupal Reddy

  • HT5509 In an app that was frozen, I triple-clicked the home button and activated "guided access". I never set a passcode but can't exit GA without one. Is there a default passcode when one is not set by user? ipad2 ios 6.something

    We have an iPad 2 running ios 6.something - I can't check that right now because we can't seem to exit "guided access".  I was playing Clumsy Ninja when it froze.  I didn't know about forcing closed or removing an app from the recent bar yet at the time, so I was looking through settings for some kind of intuitively obvious admin tool for shutting down a jammed app - to no avail.  Then I reopened the game and tried different things: holding the home button down, pressing the home button multiple times.  When I did that, "guided access" launched.  It informed me that it had deactivated the buttons, and asked me if I wanted to shut down parts of screen. No solution in that, so I attempted to exit GA at which point ipad requested a passcode - I never set a general passcode or a GA passcode, so I have no idea what to put in.  I have tried rebooting by means of Home and Power buttons - it reopens Clumsy Ninja with GA active. 
    Is there a default "Guided Access" passcode that would be in place since I haven't set one?

    Nope .  I was the only one using it and I did not set a passcode .  That would have been a red flag for me .  We don't have it configured to require a passcode for logon and I would not have created one intentionally . 
    Thanks for responding Diavonex . 

Maybe you are looking for

  • How can I find out the screen size of the users moniter using the Acrobat SDK?

    How can I find out the screen size of the users moniter using the Acrobat SDK? I need to know how much sreen real estate that is available on the users moniter. Is there some call that I can make from the SDK to discover the maximun X and Y coordinat

  • How to go back from 10.8.5 to 10.8.4 on new iMac

    I've just bought a new Apple Certified refurbished iMac and it has come with OS 10.8.5 pre-installed. However the software I use for work, Pro Tools is not yet compatible and it isn't functioning well at all. Avid, the makers of Pro Tools say that th

  • How to zip report output and send via mail from application

    Hello, I want to know how to zip the report output and send it by mail to concerned person from application I want this as the report is having more than 70000s of records. Also the XLS has the limitation of 2^16 records and the report is having more

  • Text height/overlapping bug

    We are having a problem where part of a previous textline is overlapping the next line. The tails of letters like "j" and "g" and "y" are overlapping the next line when we have different font sizes. From our text metrics debugging, the line height se

  • How to code my logic in Search Help Exit

    Hi, I need to add my own Search Help say MATOG in Material MATNR Collective Search Help MAT1-> Collective Search help MAT1_A. Is it possible? And , when I need to add my own logic in Search Help exit for my particular Search Help, how should I code?