parameter with a null value

I write this code to report and

I put parameters to filter data when the user needs data

but when he needs all the data in the report returns all data

but the following code returns all the data when I put the settings

SELECT get_full_name (a.user_stud_id), a.amount, a.user_stud_id, a.amount_detial,

a.std_cost_id, a.grade_stud, a.twread_number, a.twread_date, a.user_move_id,

a.move_date, a.safe_id, a.safe_name

OF std_main_money one

where

std_cost_id =: P1 or: P1 is null

and Grade_stud =: P2 or: P2 is null

ORDER BY std_cost_id, Grade_stud, move_id, user_stud_id

Hello

If std_cost_id and Grade_stud are not null columns, you can also do

SELECT get_full_name (a.user_stud_id), a.amount, a.user_stud_id, a.amount_detial,

a.std_cost_id, a.grade_stud, a.twread_number, a.twread_date, a.user_move_id,

a.move_date, a.safe_id, a.safe_name

OF std_main_money one

where

std_cost_id =nvl(:P1,std_cost_id)

and Grade_stud =nvl(:P2,Grade_stud)

ORDER BY std_cost_id, Grade_stud, move_id, user_stud_id

Best regards

Tags: Database

Similar Questions

  • Eloqua recommended way to identify records with a null value in a specific field?

    What is the recommended Eloqua the way to identify records with a null value in a specific field in a contact filter.  For example, in the segment 'lead State cleaning-11/21/12', I look for records with a value zero in LeadID and ContactID... How Eloqua recommends to do this?

    Replied to your message here: http://topliners.eloqua.com/message/19075#19075

  • How to leave db field with a Null value if no value is entered in the form?

    I have a short form that has optional fields. If the optional fields are not filled in the form, I want to leave the field with a Null value in the SQL db. SQL columns allow Null, but whenever this code runs, it seems to insert a space rather than leave the field with a null value. I forget to do?

    Here is the solution...

  • History of backfilling with non-null values

    Hi gurus,

    in Oracle 11 g, which would be the best way to update a null with the next available non-null value?

    For example: in the code below, I need to update the null in 20130201 record (key = 1) (key date) with a value of 100 available at the next available date IE 20130203.
    Same key = 3 value will be updated with key = 4 value i.e. 200.
    1,ABCD, 20130201, NULL
    2,ABCD,20130203, 100
    3,ABCD, 20130205, NULL
    4, ABCD,20130207, 200
    Thank you
    S
    with t as (
               select  tbl.*,
                       last_value(nvl2(c4,c1,null) ignore nulls) over(order by c1) prev_c1,
                       last_value(c4 ignore nulls) over(order by c1) prev_c4,
                       first_value(nvl2(c4,c1,null) ignore nulls) over(order by c1 rows between current row and unbounded following) next_c1,
                       first_value(c4 ignore nulls) over(order by c1 rows between current row and unbounded following) next_c4
                 from  tbl
              )
    select  c1,
            c2,
            c3,
            c4,
            case
              when c4 is not null then c4
              when c1 - prev_c1 < next_c1 - c1 then prev_c4
              else next_c4
            end new_c4
      from  t
    /
    
            C1 C2           C3         C4     NEW_C4
    ---------- ---- ---------- ---------- ----------
             1 ABCD   20130201                   100
             2 ABCD   20130203        100        100
             3 ABCD   20130205                   200
             4 ABCD   20130207        200        200
    
    SQL> 
    

    SY.

  • Several lines in duplicate with the null value displayed in the combined analysis rpt

    Dear all,

    Our requirement is to display users open tasks (my open tasks) on the home page. So I created a report called open my tasks.

    The columns to display are subject, account name, due date, owner. If I use only the 'activities' notification area, and then I can not retrieve tasks that have NULL of the account name. SOD ignore and filter the tasks with the NULL account name if I display the name of the account.

    So I used a combined analysis of activity report activity with itself i.e. area statement. All columns except account name in one of them where I used "instead of the name of Account.Account.

    It now also displays tasks with NULL account name. But there is another question. These activities when there is an account name, display double - double rows - an account name and othet without account name (for example, NULL).

    Please can you help how to solve above or meet the requirement in an alternative way?

    Thank you
    Niraj

    VR;

    (1. any activity with account) + (2. All activities - 3. Activities with account)

    1 account name because it is
    2 maintain a column empty "
    3 write the instruction box and change the name of the account by white ")

    Dinesh

  • How to use the NVL function to a parameter with comma delimited values

    Gurus,

    It is confusing to me.  I am trying to use the NVL function, but the setting that I'm passing in my cursor contains multiple values with commas.  The NVL function is confused when analyzing the values.

    'Where' cursor clause...

    and nvl (sn.c_attribute1,'x@#$%') in nvl (p_desig,'x@#$%'( )

    translated parameter values...

    and nvl (sn.c_attribute1,'x@#$%') in nvl ('SPRT''GOOD' 'BAD' 'x@#$%') -NVL does not parse the value correctly

    Any idea on how to get NVL recognize 'x@#$%' , if p_desig is null?

    Thank you

    Scott

    HI, Scott.

    Whenever you have a problem, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements) of all the tables involved, so that people who want to help you can recreate the problem and test their ideas.

    Also post the results you want from this data, as well as an explanation of how you get these results from these data, with specific examples.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002#9362002

    My best guess, based on what you posted bone is present, that your problem is discussed in the following:

    http://tkyte.blogspot.com/2006/06/varying-in-lists.html

    http://www.Oracle-base.com/articles/Misc/DynamicInLists.php

  • Complete with matching null values

    Hi all
    Take into consideration the following:

    create table X_T2
    (
      COL1 VARCHAR2(2),
      COL2 VARCHAR2(2)
    )
    insert into x_t2 (COL1, COL2)
    values ('1', 'A');
    
    insert into x_t2 (COL1, COL2)
    values ('2', '');
    
    insert into x_t2 (COL1, COL2)
    values ('3', '');
    
    insert into x_t2 (COL1, COL2)
    values ('4', '');
    
    insert into x_t2 (COL1, COL2)
    values ('5', '');
    
    insert into x_t2 (COL1, COL2)
    values ('6', '');
    
    insert into x_t2 (COL1, COL2)
    values ('7', 'B');
    
    insert into x_t2 (COL1, COL2)
    values ('8', '');
    
    insert into x_t2 (COL1, COL2)
    values ('9', '');
    
    insert into x_t2 (COL1, COL2)
    values ('10', '');
    
    insert into x_t2 (COL1, COL2)
    values ('11', '');
    
    insert into x_t2 (COL1, COL2)
    values ('12', 'C');
    
    insert into x_t2 (COL1, COL2)
    values ('13', '');
    
    insert into x_t2 (COL1, COL2)
    values ('14', '');
    
    insert into x_t2 (COL1, COL2)
    values ('15', '');
    
    insert into x_t2 (COL1, COL2)
    values ('16', '');
    
    insert into x_t2 (COL1, COL2)
    values ('17', 'D');
    
    insert into x_t2 (COL1, COL2)
    values ('18', '');
    
    insert into x_t2 (COL1, COL2)
    values ('19', '');
    
    insert into x_t2 (COL1, COL2)
    values ('20', '');
    Required result:
    1     A
    2     A
    3     A
    4     A
    5     A
    6     A
    7     B
    8     B
    9     B
    10     B
    11     B
    12     C
    13     C
    14     C
    15     C
    16     C
    17     D
    18     D
    19     D
    20     D
    Any ideas?

    Oracle 11g


    Thanks in advance,
    Alexander.

    Hello, Alexander.

    Here's one way:

    SELECT    col1
    ,       LAST_VALUE (col2 IGNORE NULLS)
               OVER (ORDER BY  LPAD (col1, 2))     AS c2
    FROM       x_t2
    ORDER BY  LPAD (col1, 2)
    ;
    

    a.Stoyanov wrote: Hi all,.
    Take into consideration the following:

    create table X_T2
    (
    COL1 VARCHAR2(2),
    COL2 VARCHAR2(2)
    )
    
    insert into x_t2 (COL1, COL2)
    values ('1', 'A');
    ...
    

    If you want to '2' and '3' in front of '10' and 11', then you might consider col1, a NUMBER, rather than a VARCHAR2, or add a constraint (and possibly a trigger) to make sure he always has 2 characters.

    Please include the information and sample version; It's very useful!
    You didn't say if you have Oracle 11.1 or 11.2. From 11.2, there is another way to specify IGNORE NULLS; but as noted above will work in both versions (or any version starting with Oracle 10.1).

  • Find columns with only NULL values

    I have a list of tables around 30 in number. Among them i need to generate a report with Table Name and Column Names, for which all values are NULL.
    In other words, i need to find all the columns for which all the values are NULL.
    
    
    I thought of dealing it with cursors, and comparing the total count with null count in each column. But i need to loop "Number of columns" times. Is there any better way to do this?

    If your statistics are up to date, you can use the datadictionary:

    select tab.table_name
    ,      tab.num_rows
    ,      col.column_name
    ,      case
             when tab.num_rows = col.num_nulls then '*100% NULL*'
             else to_char(col.num_nulls)
           end num_nulls
    from   user_tab_columns col
    ,      user_tables tab
    where  col.table_name = tab.table_name
    and    tab.num_rows > 0
    and    tab.table_name IN (YOUR_TABLE NAMES)
    order by tab.table_name, column_id;
    

    Set the query for your needs.

  • Views of Oracle with parameter with default input values?

    Hello

    As in procedures, can we have a view of oracle which takes the parameter and if the calling routine does not pass the required number of parameter which can be set by default in the view. Thank you!

    1 SYS_CONTEXT - if I store the value of this variable, it will be specific session.

    What "variable" are you talking about?

    'CONTEXT' is NOT a variable - is a data region that contains the pair name = value.

    Contrary to what the other answering machine says that the context variables are "session specific" or not depends on how you create the context. You can create the specific context of the session (by default) or a GLOBAL context. Data in a global context is SHARED by all sessions of the Forum.

    See the diagram of CONTEXT to CREATE the syntax and description in the Oracle documentation

    http://docs.Oracle.com/CD/B28359_01/server.111/b28286/statements_5002.htm

    ACCESSIBLE WORLDWIDE

    This clause means that any context of the defined application namespace is accessible throughout the entire instance. This setting allows multiple sessions to share attributes of request.

    Aware that ALL the VALUES returned by a context using SYS_CONTEXT (see the function description in the documentation of the SQL language) are STRINGS.

    Make sure that you do NOT rely on implicit conversions when the context data items using a DATE value stored in a string.

  • Number of rows in each partition is displayed with a NULL value for a table partitioned in user_tab_partitions. Why?

    I created a table and partitioned on the date of the entry and added a local partitioned index.

    Now, I use a query to extract "num_rows" of user_tab_partitions to know the number of rows in each partition.

    Getting this value as null num_rows, wonder why?

    After looking to explain the Plan after interrogation ("select * from my_table1 where entry_date = 1 January 2015" ;))

    to find out if she actually partitioned table and its data in different partitions, I interpreted in effect because the query plan had a line like Partition_range (Single).

    My Question is:

    (a) is actually partitioned data (have I misinterpreted the Explain plan)

    (b) why is the num_rows null column in the query (Pasted below)

    (c) also in addition what difference it would have been if I had created a Global Index instead of the Local Index in my case?

    The following code Snippet:

    ----------------------------------------------------------------------------------------------

    create the table my_table1
    (
    roll_no number constraint my_table1_pk primary key,
    date of entry_date
    )
    partition of range (entry_date)
    (
    PARTITION data_p1 VALUES LESS THAN (TO_DATE (December 31, 2014 ',' DD-MM-YYYY ""));
    PARTITION data_p2 VALUES LESS THAN (MAXVALUE)
    );


    create an index only my_table1_indx on my_table1 (entry_date) local;

    ----------------------------------------------------------------------------------------------

    I now insert two lines:
    insert into my_table1 values (1, to_date ('01-01-2015', ' dd-mm-yyyy'));
    insert into my_table1 values (2, to_date('01-02-2015','dd-mm-yyyy'));

    ----------------------------------------------------------------------------------------------

    These have been inserted successfully, now using the query below shows num_rows column as null. I don't know why?

    SELECT table_name, num_rows, high_value, nom_partition
    Of user_tab_partitions
    where table_name = 'MY_TABLE1 '.
    ORDER BY table_name, nom_partition;

    ----------------------------------------------------------------------------------------------


    (a) is actually partitioned data (have I misinterpreted the Explain plan)

    Yes, it is partitioned. You can query this particular partition SELECT * FROM my_table1 (data_p1) PARTITION to check that.

    (b) why is the num_rows null column in the query (Pasted below)

    As already mentioned that you have not collected statistics.

    (c) also in addition what difference it would have been if I had created a Global Index instead of the Local Index in my case?

    In fact, you have created two types of indexes without knowing (can be)! One is not partitioned (although this column is not partition key) and another is partitioned (LOCAL). They are MY_TABLE1_PK and MY_TABLE1_INDX. You can check that USER_INDEXES.

    You can read this article to get an early jump on the partitioning of decision. Partition: Partition decisions

  • display of the output cursor empty with null values

    I have the below procedure of the State where he is shown the output to the client.

    The requirement now is if the select statement does not return a value any with the input given then output parameter should see NULL values instead of no line at all.


    One method is to get the number of the select query that is written in "open p_out for." And then write the condition as if count is 0 then null other show data.

    Could you please suggest me any other alternative to this.

    Create or replace procedure test (p_empno in number , p_out out sys_refcursor) is
    
    begin
     open p_out for 
     select e.ename, d.deptname, s.sal , p.addr , v.age
      from emp e ,dept d, sal s, padress p , age v
     where e.deptno = d.deptno and d.deptno = s.deptno
     s.sal_id = p.sal_id and p.id = v.id
    and e.empno = p_empno ;
    
     
    exception when others then
     open p_out for 
     select null , null,null,null,null from dual;
    
     
    end test.
    

    Thank you

    Maybe NOT TESTED!

    Select x.ename, x.deptname, x.sal, x.addr, x.age

    of the double

    left outer join

    (select e.ename, d.deptname, s.sal, p.addr, v.age

    from emp e,.

    d Dept,

    SAL s,

    padress p,

    v of the age

    where e.deptno = d.deptno

    and d.deptno = s.deptno

    and s.sal_id = p.sal_id

    and p.id = v.id

    and e.empno = p_empno

    ) x

    1 = 1

    Concerning

    Etbin

    Select x.*

    of the double

    left outer join

    (select *)

    WCP

    where ename = 'ETBIN.

    ) x

    1 = 1

    EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
    - - - - - - - -
  • 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 )
    
  • Remove data with null value

    Hello

    I'm using Oracle 11 g. I have a table with an id of 3, node, the value column. Combination of the column id and node, that must be taken account for deletion on the registers.

    Here, I need to delete lines with the NULL value in the value column. If for a combination of id and node with non-null values, then I need to delete rows with a null value for this combination.

    If the combination of id, node is not null value then this records should not delete.

    Below table, I need to remove the second row, for which is a value not zero VOICE CAL '10' is there, so I need to delete the row with null values. (VOICE, CAL, NULL)

    Network, FL, there is no value is non-null then I should NOT delete this line.

    This table is to have 100 s of this association, we can delete data in a single delete query?

    Or how I can delete rows with nulls for this combination.

    Tab1

    VALUE OF THE NŒUD ID

    VOICE CAL 10
    VOICE CAL NULL
    NETWORK NULL FL

    Thank you

    Hello

    oradba11 wrote:

    Hello

    I'm using Oracle 11 g. I have a table with an id of 3, node, the value column. Combination of the column id and node, that must be taken account for deletion on the registers.

    Here, I need to delete lines with the NULL value in the value column. If for a combination of id and node with non-null values, then I need to delete rows with a null value for this combination.

    If the combination of id, node is not null value then this records should not delete.

    Below table, I need to remove the second row, for which is a value not zero VOICE CAL '10' is there, so I need to delete the row with null values. (VOICE, CAL, NULL)

    Network, FL, there is no value is non-null then I should NOT delete this line.

    This table is to have 100 s of this association, we can delete data in a single delete query?

    Or how I can delete rows with nulls for this combination.

    Tab1

    VALUE OF THE NŒUD ID

    VOICE CAL 10
    VOICE CAL NULL
    NETWORK NULL FL

    Thank you

    You can do this in a single DELETE statement (it is not a request), using an EXISTS or IN the subquery.  For example:

    REMOVE table_x m

    WHERE the value IS NULL

    AND THERE ARE)

    SELECT 0

    FROM table_x s

    WHERE s.id = m.id

    AND s.node = m.node

    AND s.value IS NOT NULL

    )

    ;

    If you would care to post CREATE TABLE and INSERT instructions for the sample data, and then I could test it.

  • check NULL values with expressions

    I'm having a problem with an expression that I work with.

    I'm trying to produce a dynamic graph (among other information) that seems to be controlled by a stream - stream artificial is created by a handful of sliders and a wiggle expression.

    The chart is a simple graphic line which works very well. It is created with a null value (MarkPos) that the position is controlled by Captain wiggle expression that I've mentioned before, that follows.

    This next bit is where I have problems:

    I want to score minimum or maximum, the line has reached on the chart by moving a dotted line, one for weak points and the other for the top.

    Focus only on the bottom line;

    I have the following expression associated with the line, which brings together the current position of the value null (MarkPos) and compared with the current position of the line to see if it has all moved further away down, if she has it moving the line to the new pos are lower. However, all that happens is the line following the null value.

    x = thisComp.layer("MarkPos").transform.position.valueAtTime (time) [1];

    y = transform.position.valueAtTime (time) [1];

    z = transform.position.valueAtTime(time-thisComp.frameDuration) [1];

    If (x > y) {}

    [0, x]

    } else {}

    [0, z]

    }

    After a lot of debugging, I now know the issue is with the else statement - what his weight is compensating the to the high movement frame by frame 1 - so how do you define an order of "keep your current position in y ' in this case?

    [0.1] just it back to its original position and it is not possible to just have the ' if(x>y) {[0, x]} "bit without the"else {}.

    Suggestions fo how to fix this, or a better way to do it?

    This should give you the value of y min:

    p = thisComp.layer("MarkPos").transform.position;

    minVal = 999999;

    for (f = timeToFrames (time); f > = 0; f-) {}

    minVal = Math.min (digraph, p.valueAtTime (framesToTime (f)) [1]);

    }

    [value [0], minVal]

    and this should give you the most:

    p = thisComp.layer("MarkPos").transform.position;

    maxVal = - 999999;

    for (f = timeToFrames (time); f > = 0; f-) {}

    maxVal = Math.max (maxVal, p.valueAtTime (framesToTime (f)) [1]);

    }

    [value [0], maxVal]

    Dan

  • Restrict null values

    Hi all

    Can I restrict null values when passing parameters in procedures. can someone explain to me with a small example

    Hello

    Pascale says:
    The table does not allow null values. It throws an exception when the value null is passed IN parameter

    Are you talking about raising of arguments passed to a procedure or a table?

    If a column in the table has a NOT NULL constraint, an error will be reported in the world tries to add a NULL value in this column, or if someone tries to change an existing value with a NULL value.

    I don't know anyway auto to force an error when a procedure is called with a NULL argument. There may not be any built-in mechanism because it is so easy to test the NULL at the beginning of the procedure and explicitly to trigger an error.

Maybe you are looking for

  • Firefox is to connect on websites

    After the last update, I open a new browser and connect in my company ticket system. He ends by disconnects me and I have to click on the registered user and pass for you to log in again. Not a big deal, but it's annoying. This also happens with all

  • Mouse movement accelerates graphic tracing activities!

    Salvation OR,. I tried to run a project collecting data rs - 232 (incoming data to 10msec frequency... 20 bytes each 10msec). The LabWindows environment seems to work more efficiently (faster) if I move my mouse over the plots (without even clicking

  • Load FileDlgNameList order

    Hello I have this problem for some time and I was wondering if this is normal or if it is in fact a bug. Here is what I do I make a function call and grab several files by using the function "Call FileDlgShow" and I leave the function to retrieve sev

  • Today 9/9 cannot connect hotmail

    09/09/2011 today, hotmail cannot connect

  • Sansa crashes WMP after upgrade of the motherboard

    Hello I recently updated my Windows Vista x 64 - motherboard, processor, video card system - and since then, I had problems with my Sansa.  Now, when I start Windows Media Player 11 (WMP) and then plug in my 8 GB Sansa, WMP closes, with the dialog bo