null value for the parameter in quesry

Please help on this problem:

I have a query like

Select colA, colB
from tableA
where cola =: parameter;

If: parameter has a value, then the request is ok for my pupposes,
but when: parameter is null, then I have to choose only 3 values of colA. (ColA has more than 3 distinct values)

I can't use nvl because there are 3 arguments and no 1.

I tried:

Select colA, colB
from tableA
where (: parameter is not null and colA =: parameter) or (: parameter is null and colA (1,2,3))

but this isn't the solution.

Can someone help me on this simple query?

Your version must have worked as long as you have no other filter criteria in the where condition.
Need you some parentheses around the OR condition. So I don't know what was the problem with your solution.
BTW: There is a ') ' missing at the end, but I guess that it's just a typo while copying the code on the forum.

The following alternative works:

select colA, colB
from tableA
where colA in (nvl(:parameter,1) ,
             nvl(:parameter,2) ,
             nvl(:parameter,3)
             ) ;

Advantage: Can be faster in the case of null, because it can always use an index on the column of cola.

Published by: Sven w. on April 13, 2010 15:26

Tags: Database

Similar Questions

  • UDI-00014: invalid value for the parameter, "remap_tablespace".

    Hi all

    Windows 2003 Server
    Oracle 10g

    I'm doing a reorg, so I droped and recreated the schema. No w I want to import my datapump schema export, but it gives me an error:
    UDI-00014: invalid value for the parameter, "remap_tablespace".

    Here is my script:
    Impdp patterns of name of user and password = siebel directory = dpdir dumpfile = logfile schema_exp.dmp = schema_imp.log remap_tablespace = SBL_DATA:SBL_DATA, SBL_INDEX:SBL_INDEX State 60

    What I'm doing wrong, it makes me crazy, please help

    Published by: user11211037 on December 6, 2009 00:54

    Syntax and Description

    SCHEMAS = schema_name [,...]

    If you have the IMP_FULL_DATABASE role, you can use this parameter to perform a schema mode import by specifying one single schema other than your own or a list of schemas to import. First, schemas were created (if they do not already exist), including the system and the role of subsidies, the history of password and so on. Then all the objects contained in the imported patterns. Unprivileged users can only specify their own schemas. In this case, no information about the schema definition is imported, only the objects it contains.

    Hope you are clear.

    Concerning
    Asif Kabir

    -Mark your answer as correct/useful.

  • Problem of null values for the Variable

    I work with APEX 4.0.  I have a menu page that has a list item widget types to select.  I then a navigation list that calls a report page and sets a widget-type element with the value of the widget on the page called - type element.

    Problem is that type widget on the page called article does not meet.  The report depends directly on this issue being filled.  The url indicates the element in the form of Pxxx_WIDGET_TYPE, but the value for parameter & Pxxx_WIDGET_TYPE. is set to null.  I am also an element of Pxxx_CALLED_FROM filling, which fill, and the url shows the value of & APP_PAGE_ID.

    What's wrong?  How to fill the element of widget_type?

    How do you define value for Pxxx_WIDGET_TYPE? And is there a value in the session state for this item?

    Kind regards

    Vincent

  • How to search by null value for the numeric values in the filter of the fable in adf 11g?

    Method of substitution of applyViewCriteria?
    But what to put as the value for ViewCriteriaRow?

    Hello

    You can add following code to your actionListener or any method call when you want to perform this operation:

    ViewObject view = getViewObject();
    ViewCriteria criteria = view.createViewCriteria();
    
    ViewCriteriaRow row = criteria.createViewCriteriaRow();
    row.setAttribute(attrName, "IS NULL");
    
    criteria.addElement(row);
    view.applyViewCriteria(criteria);
    

    ~ Ahmed

  • LocationProvider.getInstance returns a null value for the positioning of the cell PHONE location

    Hi guys.

    I'm having a problem trying to get a network of cells (MS basis) path to be able to work on my BlackBerry Bold 9000.

    Both assisted and Standalone GPS work (outside of course), but I'll try to find a way to position themselves inside the building.

    Here's what I'm going to put criteria:

    Criteria criteria = new Criteria();
    
    criteria.setHorizontalAccuracy(Criteria.NO_REQUIREMENT);
    criteria.setVerticalAccuracy(Criteria.NO_REQUIREMENT);
    criteria.setCostAllowed(true);
    criteria.setPreferredPowerConsumption(Criteria.POWER_USAGE_LOW);
    
    LocationProvider.getInstance(criteria); //<-- Returns null on real device
    

    When I run on a real device it gives me always null, when I do the same thing on a simulator, so this works:

    What I am doing wrong? I really need to find a way to make it work inside.

    Thanks for any input.

    Hey, Dominator,.

    I'll be real simple with you and try to make you save a LOT of time.

    Basically, cell tower positioning doesn't work out of the box on the Blackberry platform (except in a few configurations of rare device / carrier). So you can essentially throw the code you have above. If you need a place inside detection, you will need access to a database of celltowerId. These databases contain information from the Tower (Rad_error_nocontent, mnc, mcc, Lake) and its approximate location (lat/lng coordinates). This will give your application a rough estimate (less than a mile or two) from the current location of the device.

    Open source and professional databases are available. This is an open source database that runs on GSM networks (of course, he didn't 100% coverage of all the pylons). The biggest downfall is that it does not support CDMA (Sprint/Verizon) networks.

    http://openCellId.org

    You will find that most of the people on this forum are not very useful when it comes to cellTower information, positioning so you will need to research, research, research.

    Good luck

  • view the default values for the parameter.

    I've been messing around with my diagrams display today putting up my system bi-ecrans on my T61 running XP and I said accidentally spend only between the two regimes, and now I can't cancel it. Can someone help me?

    It is only switching when you press fn + f7? You should still be able to run deirector presentation of the start menu

  • 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 )
    
  • Display of a user name, but the sending in the value of the parameter username

    Hello

    I have a parameter named User and I need the column of user names from the drop-down list, but I need to send the value of username corrsponding to my settings. Please let me know if there is a way for this publisher of BI in.

    Thank you
    DY

    When you create a list of values for the parameter, your sql should have two columns in the select statement:

    Select user_name as name, user_id ID
    from table_name

    Name appears but user_id is returned. -Change the sql as required.

    Create the User_ID parameter (let's say it's ID), then use the created list.

    In your datamodel, you can filter by User_ID as: select * from table where user_id =: User_ID

    Hope that helps.
    Bipuser

  • NULL values for some elements of the XML reading tree

    I am confirming that I interpret correctly all the elements of a custom data XML structure defined by my application (the schema is completely under my control).  Some of the elements in my XML tree are read as NULL values, even if similar items are readind as expected.  I have checked some obvious things like misspelling the names of keys, but have not yet find the problem.  Anyone who has debugged similar questions - what else could cause this?

    Example XML:

    
        1.0.0.0
        1000
        MyAppsName
        
            
                1000
                userDefined
                StructName
            
        
    
    

    And extracted C++ w/comments at the end of each line about what I see (DataManager is my class of CRUD operations):

    In DataManager.hpp:

    QVariant mCustomDataStructsTopLevel;
    QVariantMap mCustomDataStructsTopLevelMap;
    

    In DataManager.cpp:

    mCustomDataStructsTopLevel = mXda.load(Utils::dataFilePath(customDataStructsFileName));  // XmlDataAccess; verified loading w/no errors
    mCustomDataStructsTopLevelMap = mCustomDataStructsTopLevel.toMap();
    
    qDebug() << "appName element value: " << mCustomDataStructsTopLevelMap["appName"]; // Outputs "MyAppsName" as expected
    qDebug() << "lastId element value: " << mCustomDataStructsTopLevelMap["lastId"]; // Outputs null (specifically: QVariant(, ) ) - this is NOT expected
    qDebug() << "appVersion element value: " << mCustomDataStructsTopLevelMap["appVersion"]; // Outputs null (specifically: QVariant(QString, "") )  - this is NOT expected
    

    OK, I got the feeling (and actually hoped) it was a silly mistake of face-palm on my part (compared to a problem of BB10 who had little chance of getting fixed).

    The problem is that I copy the structure of custom data from Starter to my Active dir to my data directory to first install but do not crush him on subsequent launches, as the copy in the data directory is what the user changes and relies on.  I was not a delete and reinstall on each of my iterations, so I wasn't really loading the modified versions of my XML I wanted--just, I was getting a day old stale version which was actually for the items I didn't expect NULL values for nulls.  DOH!

  • Default for the parameter value date

    We use Oracle bi apps 7.9.5. In that when an organization dimension that we don't pass any value of loading
    setting $$ SRC_EFF_TO_DT. It is supported as on 01/01/1753. When the default value of 01/01/1753 is set?

    Is there a way we can define the parameter value globally for all dimensions in Informatica or DAC?

    01/01/1753 is Informatica's default date value. It uses this value when the parameter is passed to the parameter file and no default is mentioned in Informatica. To set the default value in Informatica, you may need to change all the mappings of one by one.

    Easy by default is to set this parameter to DAC - Design-> tab settings of the Source System. This will last for all workflows walked through the DCA during execution.

    Ash

  • [ADF, JDev12.1.3] (How to set values for the attributes 1) to create a file and 2) committing to the database?

    Hallo,

    in my tables and forms (created from VO istances) there are some areas for which, insert and update, I calculate and set the value programmatically when a record is created or updated.

    In some cases, I put the necessary values using the 'CreateWithParams' in the workflow diagram...

    In some other ones, I associate an action, a bean, a created button drag-and - drop operation 'CreateWithParams' of the istance VO...

      public String cwpButton_action() {
        BindingContainer bindings = getBindings();
        OperationBinding operationBinding = bindings.getOperationBinding("CreateWithParams");
        // here I calculate and set the needed params
        // ...
        Object result = operationBinding.execute();
        if (!operationBinding.getErrors().isEmpty()) {
          return null;
        }
        return null;
      }
    

    And is ok if I can calculate the values for the attributes before a new record is created.

    But the approach that I have used to define the attributes (for new and updated records) whose value should be caluclated after the user has filled in the fields, before committing to the database?

    Thank you

    Federico

    Federico,

    Let me first tell you that our code is activity masking errors (the cache instead of working on them).

    1. If (! operationBinding.getErrors () .isEmpty ()) {}
    2. Returns a null value.
    3. }
    4. Returns a null value.

    This means that you do not check the errors at all. You must at least print a log with the error message, you receive, if you get one!

    To solve your problem, you override the method prepareForDML() of the entity or entities in question. You can calculate and set the necessary attributes until they get engaged in the doDML(). Do not use doDML() because it is too late in the life cycle.

    Timo

  • Data mining - error on the insertion of the TREE_TERM_MINPCT_MODE value in the parameter array

    Hello

    In Data mining when I tried to insert some values into the parameter array. I get the error by trying to introduce TREE_TERM_MINPCT_MODE in the table.

    The model who was on trial for create was decision tree.

    BEGIN

    INSERT INTO DT_CA_SETTINGS_TEST (SETTING_NAME, SETTING_VALUE) VALUES

    (dbms_data_mining. TREE_TERM_MINPCT_MODE, to_char (1));

    END;

    Error report:

    ORA-06550: line 3, column 22:

    PLS-00302: component 'TREE_TERM_MINPCT_MODE' must be declared.

    ORA-06550: line 3, column 22:

    PL/SQL: ORA-00984: column not allowed here

    ORA-06550: line 2, column 4:

    PL/SQL: SQL statement ignored

    06550 00000 - "line %s, column % s:\n%s".

    * Cause: Usually a PL/SQL compilation error.

    * Action:

    Thank you
    Srikanth.

    Hello

    BEGIN

    INSERT INTO DT_CA_SETTINGS_TEST (SETTING_NAME, SETTING_VALUE) VALUES

    (dbms_data_mining. TREE_TERM_MINPCT_NŒUD,to_char (1));

    END;

    This isn't 'Mode' his 'NŒUD '.

    Run now.

    See you soon...

  • Default value for the select list of type of form elements

    Hello

    I do not work with Apex that mutch, so this may be a simple question... but I still need help.
    I have a form, in this form, I have a question P19_ONTVANGER_ID, this is based on a LOV.
    This LOV is on a table that has a field of username with the value of APP_USER.
    The table looks like:
    ONTVANGER_ID this is the PK and is going to be the return value from the LOV.
    NAME is the display value for the LOV.
    USERID is the column APP_USER.

    What users would like to get is that if they create a new record, the default value for the P19_ONTVANGER_ID field is their own ONTVANGER_ID.
    But they must also be able to select another user.

    hope there is someone out there that can and will help me.

    Kind regards

    Rob

    APEX 4.0.2 Oracle 10

    Rob-v-M-Gn-Nl wrote:
    Until now, I had, but I need to select the value of the id of the table and the list of selection item appears the corresponding value.

    How can I do this?

    You can select the Type of default value as the body of the PL/SQL function

    and to add something like that

    declare
    v_return number;
    begin
      select your_id
        into v_return
      from your_table
      where some_column = :APP_USER;
     return v_return;
    exception when no_data_found then
     return null;
    end;
    

    http://www.asktheoracle.NET/PLSQL-function.html

  • How to write the condition with the value of the parameter

    Hello
    I'm working on siebel BI publisher report. I am able to display the value of the parameter in the report.

    Now, I wanted to do something logical based on the value of the parameter.

    for example: If the user changes the value of the parameter then I have to call A submodel if user don't past not any value then it should not display A submodel

    can someone tell me how to write that above logic?

    If the parameter exists then MODEL of APPEAL one another do not call MODEL A

    Kind regards
    JAG


    Dial a submodel

  • How to find null values in the table

    Hi experts,

    my version is oracledb10g:

    I am doubted simple.

    for example:

    create table ex1 (e varchar2 (20));

    Insert ex1 (null).

    insert into ex1 (e)

    number of will be: 2

    I can easily find the value "e".

    so my question is:

    How can I find null values in the table and I want to remove the null values from the table.

    ADF 7 wrote:
    Hi experts,

    my version is oracledb10g:

    I am doubted simple.

    for example:

    create table ex1 (e varchar2 (20));

    Insert ex1 (null).

    insert into ex1 (e)

    number of will be: 2

    It depends on what you expect. If you issue count (*) you ask Oracle "how many lines there. If you issue a County () you ask Oracle 'how non null values for are there. "

    ADF 7 wrote:

    I can easily find the value "e".

    so my question is:

    How can I find null values in the table and I want to remove the null values from the table.

    delete from 
    where  is null;
    

    Ideally you would simply place a NOT NULL constraint on the column in question, thus prohibiting NULL values into the system (assuming that your business needs, it is that the column MUST always have a value).

Maybe you are looking for

  • extended data record

    Hello I recently built a vi who reads the tensions of a photodiode, them is plotted on a graph, and then records them in a text file. Everything works well, apart from the economy. The graph shows data correctly, but when I save it writes only to 10-

  • 9205 module: measures incorect

    Hello I have 2-9205-32 modules HAVE in a chassis cRIO 9074 channel. 1 is in the 7 location and we're in the slot 8. I access data using function blocks Scan Engine Advanced IO at a sampling frequency of 100 Hz, with the default time of 8us between sa

  • HP8620: Error in the printer

    I went to my HP8620 yesterday to find a printer error duisplayed on the screen.  He said "Please stop printer, then press.  All the lights were flashing.  I turned the printer, then on and the printer has been its start-up phase.  Almost immediately,

  • How can I script to group two frames?

    I want to be able, from a script, to harness together a frame image and his label so that they move together. The context is that I am trying to automate the process of loading the images and add labels, leaving them paired together so I can then mov

  • Can't access AD Workspace Portal 2.1 user admin

    HelloI did a fresh install of the workspace Portal 2.1 in our lab and I'm having slight issues with access to the administration of the workspace portal.Here is a screenshot of my BindDN directory settingsI created the dedicated account 'WorkspaceAdm