Handle null values in the aggregate function

Dear Experts,

Here's my query

SELECT sum (nvl (amount, 0)) + 50 AS TXN_PER_DAY_AMNT,

COUNT (*) AS TRAN_LOG_TABLE TXN_CNT_PER_DAY

(TRUNC (TXNDATETIME) = TO_DATE (SYSDATE, 'DD-MM-YY'));

Exit from the MINE

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

TXN_PER_DAY_AMNTTXN_CNT_PER_DAY
NULL VALUE2

Desired output

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

TXN_PER_DAY_AMNTTXN_CNT_PER_DAY
500

I want to treat the null value,

If my amount is null, it should replace 0 and add my 50 amount.

Result must be 0 + 50 = 50;

Help, please

Maybe

SELECT nvl (sum (sum() 50) AS TXN_PER_DAY_AMNT,

-case when sum(amount) is null then 0 else end of COUNT (*) AS TXN_CNT_PER_DAY

OF TRAN_LOG_TABLE

Concerning

Etbin

Tags: Database

Similar Questions

  • How to handle null values in the RTF models

    Hi - I have two groups in a report for different SQL and two formulas for each group, CF_ELE_CNT and CF_ELE_CNT1. In the model that I used the code to print a section below or not.

    <? If: number (CF_ELE_CNT + CF_ELE_CNT1) > 0? >

    The problem is when no data in the second group it was created not the tag XML for CF_ELE_CNT1, if CF_ELE_CNT has 13, it does not always print this partucular article. If I remove the CF_ELE_CNT1 in the State, it works fine. I was wondering how to handle this.

    Any help would be appreciated!

    Thank you
    RAV

    Hey Rav,.

    Check my profile, you will find.

    purpose of fusion {point} [AT] gmail [dOt] com

  • Bug with the aggregate function and no group

    When I run the following query:
    with the_table as
    (
      select 1 as id, 100 as cost from dual
      union all select 2 as id, 200 as cost from dual
      union all select 3 as id, 300 as cost from dual
      union all select 4 as id, 400 as cost from dual
      union all select 5 as id, 500 as cost from dual
    )
    select id, cost
    from
    (
      select id, cost
      from the_table
      --
      union all
      --
      select 0 as id, sum(cost) as cost
      from the_table
      where 0 = 1
      -- group by 1
    )
    order by id;
    I get this result:
    ID    COST
    --  ------
     0  <null>     
     1     100
     2     200
     3     300
     4     400
     5     500
    However, when I "uncomment" the line "Group 1", the query works as expected (without the id = rank 0).

    This occurs even when "the_table" is an array.

    Someone else comes through this (and if so, how long is a problem)?

    The database is 11.2.0.2.0 64-bit.

    EDIT: It also happens without a Union - the following returns a single line (with null 0 and cost of id) without the Group By and no line with her:
    select id, cost
    from
    (
      select 0 as id, sum(cost) as cost
      from 
      (
        select 1 as id, 100 as cost from dual
        union all select 2 as id, 200 as cost from dual
        union all select 3 as id, 300 as cost from dual
        union all select 4 as id, 400 as cost from dual
        union all select 5 as id, 500 as cost from dual
      )
      where 0 = 1
      -- group by 1
    )
    order by id
    Edited by: Donbot February 15, 2012 10:29

    Donbot wrote:
    Someone else comes through this (and if so, how long is a problem)?

    The database is 11.2.0.2.0 64-bit.

    This is a documented behavior.

    http://docs.Oracle.com/CD/E11882_01/server.112/e26088/functions003.htm#SQLRF20035

    "
    All except COUNT (*) GROUPING and GROUPING_ID aggregate functions ignore NULL values. You can use the NVL function in the argument of an aggregation function to substitute a value for a null value. COUNTY and REGR_COUNT never return null, but return a number or zero. For all remaining functions of aggregation, * if the DataSet contains no line, * or if it contains only the rows with NULL values as arguments to the aggregate function, * then the function returns null.*
    "

  • analytical function and the aggregate function

    What are the analytical function and the aggregate function. What is the difference between them?

    Hello

    Analytic Functions : -.

    Analytical functions calculate a value of aggregation based on a group of lines. They differ from aggregate functions because they return several rows for each group. The Group of rows is called a window and is defined by the analytic_clause. For each line, a sliding window of lines is defined. The window determines the range of lines used for the calculations for the current line. Window sizes can be based on a physical number of rows or a logic as the time interval.
    Analytical functions are the last set of operations performed in a query with the exception of the last ORDER BY clause. Every joint and every WHERE, GROUP BY and HAVING clauses are met before the analytical functions are handled. As a result, analytic functions can only appear in the select list or the ORDER BY clause.
    Analytical functions are commonly used to calculate cumulative aggregates, moving, centered and considered.

    Aggregate functions : -.

    Aggregate functions return a line of single result based on the groups of lines, rather than on the unique lines. Aggregate functions can appear in selection lists, as well as in the HAVING and ORDER BY clauses. They are commonly used with the GROUP BY clause in a SELECT statement, where Oracle Database splits the rows in a table when asked or seen in groups. In a query that contains a GROUP BY clause, the select list items can be aggregation functions, GROUP BY constant expressions or expressions involving one of them. Oracle applies the functions of aggregation for each group of rows and returns a single result for each group line.
    If you omit the GROUP BY clause, Oracle then applies any aggregate functions in the select list for all rows in the table queried or the view. You use aggregate functions in the HAVING clause to eliminate groups of the output based on the results of aggregate functions, rather than the values of the individual lines of the queried table or view.

    Let me know if you feel any problem understanding.
    Thank you.

    Published by: varun4dba on January 27, 2011 15:32

  • need help to get the value using the REGEXP_REPLACE function.

    I am trying to extract the value placed between "< listitems >... < / listitems >" but I am unable to get these value using the REGEXP_REPLACE function.
    select REGEXP_REPLACE('<InputParameters></ParamSet><listitems>14545454</listitems></ParamSet></InputParameters>'
    ,'(<InputParameters>.*<listitems>)(.*)(</listitems>.*<InputParameters>)'
    ,'\2') from dual;
    required output:
     1454554
    Can someone please help me achieve this goal.

    Hello

    You forgot the / before the last InputParameters. If fix you that, your code will work.

    Here is a slightly different way:

    SELECT  REGEXP_REPLACE ( '14545454'
                     , '^.*?(.*?).*$'
                     , '\1'
                     )     AS listitems
    FROM    dual
    ;
    

    Least to type, the less likely you will have to make typos.
    If there are 2 (or more) elements of listitmes, 1 will be returned.

    From Oracle 11.1, you can also use REGEXP_SUBSTR. I have Oracle 10.2 avaialable now, so I can test the following, but I think you'd say:

    SELECT  REGEXP_SUBSTR ( '14545454'
                     , '(.*?)'
                     , 1
                     , 1
                     , NULL
                     , 1
                     )     AS listitems
    FROM    dual;
    

    When it comes with the text that is or looks to, XML, consider using XML functions.

  • Need to null values with the values of filling the date before weekend/holidays

    I have a table with a Date column, column Type and rate column.

    The problem is when the weekends and holidays, column Type and rate column are null.

    I need all null values with the values of Type and fill rate before that date is the weekend and public holidays.

    Example:

    I have:

    RATE OF TYPE DATE
    07/01/2010 4510 PM 3.71
    07/01/2010 CETE28 4.59
    07/01/2010 TIIE28 4.95
    07/02/2010 4510 PM 3.82
    07/02/2010 CETE28 4.63
    07/02/2010 TIIE28 5.11
    * NULL NULL 07/03/2010 *.
    * NULL NULL 07/04/2010 *.
    07/05/2010 4510 PM 3.91
    07/05/2010 CETE28 4.74
    07/05/2010 TIIE28 5.25

    Will be:

    RATE OF TYPE DATE
    07/01/2010 4510 PM 3.71
    07/01/2010 CETE28 4.59
    07/01/2010 TIIE28 4.95
    07/02/2010 4510 PM 3.82
    07/02/2010 CETE28 4.63
    07/02/2010 TIIE28 5.11
    * 07/03/2010 4510 PM 3.82*
    * 07/03/2010 CETE28 4.63*
    * 07/03/2010 TIIE28 5.11*
    * 07/04/2010 4510 PM 3.82*
    * 07/04/2010 CETE28 4.63*
    * 07/04/2010 TIIE28 5.11*
    07/05/2010 4510 PM 3.91
    07/05/2010 CETE28 4.74
    07/05/2010 TIIE28 5.25

    What could I do?

    Hello

    You can use the analytic LAST_VALUE function to get the last day of work before each date into your table. It will be the same as the current day for every day of work.
    Do it a self-join to combine each current line (c) with the last day of work (l):

    WITH     got_last_work_day     AS
    (
         SELECT     dt, type, rate
         ,     LAST_VALUE ( CASE
                        WHEN  type  IS NOT NULL
                        THEN  dt
                       END
                       IGNORE NULLS
                      ) OVER (ORDER BY dt)     AS last_work_day
         FROM     table_x
    )
    SELECT       c.dt, l.type, l.rate
    FROM       got_last_work_day     c
    JOIN       got_last_work_day     l  ON       (    c.dt          = l.dt
                             AND  c.type          = l.type
                             )
                           OR     (    c.last_work_day     = l.dt
                             AND  c.type          IS NULL
                             )
    ORDER BY  c.dt
    ,       l.type
    ;
    

    Among other things, I guess that the type is NULL if (and only if) the line represents a holiday or weekend, and that the combination (dt, type) is uniuqe.

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

  • Null value in the Datetime field

    I have a form that inserts data, but the date fields have a value default (01/01/1900 12:00:00 AM) even if I do not insert a value for this field. How to enter a NULL value in the fields of datatime value MSSQL.instead default (01/01/1900 12:00:00 AM) that gets inserted?

    Here's my insert statement.

    < type CFLOCK = "exclusive" timeout = "10" >
    < name CFQUERY = "InsertWorkflow."
    DataSource = "" #request.app.DSN # ""
    username = "" #request.app.bsruser # ""
    Password = "#request.app.bsrPassword #" >
    INSERT INTO #request.app.DB # .v_NAR_WorkFlowLog
    ([SatApp_ID]
    [User_ReqApproval_Logon]
    [User_ReqApproval_Date]
    [Admin_ReqProcessed_Logon]
    [Admin_ReqProcessed]
    [Prelim_Approval_Level]
    [Prelim_Approval_Date]
    [Prelim_Approval_Explain]
    [Req_Withdrawn_Date]
    [Req_Withdrawn_Explain]
    [Req_Denied_Date]
    [Req_Denied_Explain]
    [User_Req_FinalAppl_Date]
    [Admin_FinalAppl_Date]
    [DateLastUpdated]
    [UpdatedBy])
    VALUES
    (#SatApp_ID #)
    , "#User_ReqApproval_Logon #
    , "#User_ReqApproval_Date #
    , "#Admin_ReqProcessed_Logon #
    , "#Admin_ReqProcessed #
    , "#Prelim_Approval_Level #
    , "#Prelim_Approval_Date #
    , "#Prelim_Approval_Explain #
    , "#Req_Withdrawn_Date #
    , "#Req_Withdrawn_Explain #
    , "#Req_Denied_Date #
    , "#Req_Denied_Explain #
    , "#User_Req_FinalAppl_Date #
    , "#Admin_FinalAppl_Date #
    , "#DateLastUpdated #
    ("#UpdatedBy #")
    < / CFQUERY >
    < / CFLOCK >

    Thank you

    Shearak

    CFQueryParam would work? For example:

    So, using your example, this would be your insert:


       
    DataSource = "" #request.app.DSN # ""
    username = "" #request.app.bsruser # ""
    Password = "" #request.app.bsrPassword # ">"
    INSERT INTO #request.app.DB # .v_NAR_WorkFlowLog
    ([SatApp_ID]
    [User_ReqApproval_Logon]
    [User_ReqApproval_Date]

    [Admin_ReqProcessed_Logon]
    [Admin_ReqProcessed]
    [Prelim_Approval_Level]
    [Prelim_Approval_Date]
    [Prelim_Approval_Explain]
    [Req_Withdrawn_Date]
    [Req_Withdrawn_Explain]
    [Req_Denied_Date]
    [Req_Denied_Explain]
    [User_Req_FinalAppl_Date]
    [Admin_FinalAppl_Date]
    [DateLastUpdated]
    [UpdatedBy])
    VALUES
    (#SatApp_ID #)
    , "#User_ReqApproval_Logon #
    , "#User_ReqApproval_Date #
    , "#Admin_ReqProcessed_Logon #
    , "#Admin_ReqProcessed #
    , "#Prelim_Approval_Level #
    , "#Prelim_Approval_Date #
    , "#Prelim_Approval_Explain #
    , "#Req_Withdrawn_Date #
    , "#Req_Withdrawn_Explain #
    , "#Req_Denied_Date #
    , "#Req_Denied_Explain #
    , "#User_Req_FinalAppl_Date #
    , "#Admin_FinalAppl_Date #
    (, ' #UpdatedBy # ')
       

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

  • How to extract the second sysdate value using the EXTRACT function

    Hello

    I want to extract the second sysdate value using the EXTRACT function.
    When I run the following query I get an error;

    SELECT extract (second OF SYSDATE) FROM dual;

    ORA-30076: field of invalid extract for the source of the extract.

    When I do to extract the month I get the correct result.

    Is there some necessary formatting by specifying the sysdate (or any other date value) in the query. ?


    Thank you.

    You can extract only the year/month / day, day

    SQL> Select extract(year from sysdate) from dual;
    
    EXTRACT(YEARFROMSYSDATE)
    ------------------------
                        2008
    
    SQL> Select extract(day from sysdate) from dual;
    
    EXTRACT(DAYFROMSYSDATE)
    -----------------------
                         20
    
    SQL> Select extract(month from sysdate) from dual;
    
    EXTRACT(MONTHFROMSYSDATE)
    -------------------------
                           11
    
    IF you enter Minute or Seconds
    
    SQL>  Select extract(minute from sysdate) from dual;
     Select extract(minute from sysdate) from dual
                                *
    ERROR at line 1:
    ORA-30076: invalid extract field for extract source
    but with timestamp you can get the seconds
    
    SQL> select EXTRACT(second FROM current_timestamp) from dual;
    
    EXTRACT(SECONDFROMCURRENT_TIMESTAMP)
    ------------------------------------
                                  39.473
    
    SQL> select EXTRACT(second FROM current_timestamp) from dual;
    
    EXTRACT(SECONDFROMCURRENT_TIMESTAMP)
    ------------------------------------
                                  57.474
    
    SQL> /
    
    EXTRACT(SECONDFROMCURRENT_TIMESTAMP)
    ------------------------------------
                                  59.787
    
    SQL> /
    
    EXTRACT(SECONDFROMCURRENT_TIMESTAMP)
    ------------------------------------
                                    .412
    
    SQL> /
    
    EXTRACT(SECONDFROMCURRENT_TIMESTAMP)
    ------------------------------------
                                     .99
    
    SQL> /
    
    EXTRACT(SECONDFROMCURRENT_TIMESTAMP)
    ------------------------------------
                                   1.458
    
    SQL> /
    
    EXTRACT(SECONDFROMCURRENT_TIMESTAMP)
    ------------------------------------
                                   1.896
    
    SQL> /
    
    EXTRACT(SECONDFROMCURRENT_TIMESTAMP)
    ------------------------------------
                                   2.334
    

    Edited by: Viswarayar Maran on November 20, 2008 14:30

  • NULL value in the print result

    I run a SELECT statement on the form below:

    SELECT col1 |' | ' || col2 |' | ' || COL3

    TABLE;

    It gives me the following outprint, which is what I need

    col1 | col2. col3

    VARCHAR2. number | VARCHAR2

    The problem is when col2 returns a NULL value, then I get this:

    VARCHAR2. VARCHAR2

    When what I want is this:

    VARCHAR2. (null) | VARCHAR2

    Is it possible to get my results of the query to print the value NULL (null)?

    I tried the function NVL NVL (col2, 'null'), but it won't work because there is a mismatch on data types. I can get the NULL value, printed by concatenating don't not columns and save results to csv, but that does not give me the formatting that I want.

    You can convert the character number column, and then look for the NVL.

    See below:

    with data as
    (
      select 'col1' col1, 1 col2, 'col3' col3 from dual union all
      select 'col1' col1, null col2, 'col3' col3 from dual
    )
    select col1 || '|' || nvl(to_char(col2), 'null') || '|' || col3
      from data;
    
    COL1||'|'||NVL(TO_CHAR(COL2),'NULL')||'|'||COL3
    --------------------------------------------------
    col1|1|col3
    col1|null|col3
    
  • Performance of the aggregate function.

    Hello

    Version 11.2.0 Oracle

    I'm not a PL/SQL Developer, however, I decided to write this aggregate out function. Oracle has it but I tried TimesTen database in memory that does not yet function stddev.

    The code is as follows:
    CREATE OR REPLACE TYPE MyStddevImpl AS OBJECT
    (
      v_power NUMBER, -- sum(power^2) of the column
      v_sum   NUMBER, -- average value
      v_iteration NUMBER, -- count(1)
    
      STATIC FUNCTION ODCIAggregateInitialize(sctx IN OUT MyStddevImpl)
        RETURN number,
    
      MEMBER FUNCTION ODCIAggregateIterate(self IN OUT MyStddevImpl,
        value IN number)
        RETURN number,
    
      MEMBER FUNCTION ODCIAggregateTerminate(self IN MyStddevImpl,
        returnValue OUT number, flags IN number)
        RETURN number,
    
      MEMBER FUNCTION ODCIAggregateMerge(self IN OUT MyStddevImpl,
       ctx2 IN MyStddevImpl)
       RETURN number
    );
    /
    show error
    
    CREATE OR REPLACE TYPE BODY MyStddevImpl
    AS
    STATIC FUNCTION ODCIAggregateInitialize(sctx IN OUT MyStddevImpl)
    RETURN number
    AS
    BEGIN
      sctx := MyStddevImpl(0,0,0);
      RETURN ODCIConst.Success;
    END;
    
    MEMBER FUNCTION ODCIAggregateIterate(self IN OUT MyStddevImpl, value IN number)
    RETURN number
    AS
    BEGIN
      self.v_sum   := self.v_sum + value;   -- used to get averages
      self.v_power := self.v_power + power(value,2);
      self.v_iteration := self.v_iteration + 1;  -- total  number of rows
      return ODCIConst.Success;
    END;
    
    MEMBER FUNCTION ODCIAggregateTerminate(self IN MyStddevImpl, returnValue OUT
                                           number, flags IN number)
    RETURN number
    AS
      v_avg number;
    BEGIN
      v_avg :=  self.v_sum/self.v_iteration;   -- this is the average value
       -- sqrt((sum(power(amount_sold,2))-(count(1)*power(avg(amount_sold),2)))/(count(1)-1))
      returnValue := sqrt((self.v_power - (self.v_iteration * power(v_avg,2))) /(self.v_iteration-1));
      RETURN ODCIConst.Success;
    EXCEPTION
      WHEN VALUE_ERROR
      THEN
        RETURN ODCIConst.error;
    END;
    
    MEMBER FUNCTION ODCIAggregateMerge(self IN OUT MyStddevImpl, ctx2 IN
    MyStddevImpl)
    RETURN number
    AS
    BEGIN
     RETURN ODCIConst.Success;
    END;
    END;
    /
    show error
    CREATE OR REPLACE FUNCTION MyStddev (input NUMBER)
    RETURN number
    AGGREGATE USING MyStddevImpl;
    /
    show error
    exit
    Now, it works very well and returns the results OK.
    select mystddev(amount_sold) AS "My standard deviation", stddev(amount_sold) from sales;
    
    My standard deviation STDDEV(AMOUNT_SOLD)
    --------------------- -------------------
                259.78049           259.78049
    The problem I have is that it takes 10.5 sec to run
     select mystddev(amount_sold) from ssdtester.sales;
    
    MYSTDDEV(AMOUNT_SOLD)
    ---------------------
               273.172955
    
    Elapsed: 00:00:10.48
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 1047182207
    
    ----------------------------------------------------------------------------
    | Id  | Operation          | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
    ----------------------------------------------------------------------------
    |   0 | SELECT STATEMENT   |       |     1 |     5 |  1324   (1)| 00:00:16 |
    |   1 |  SORT AGGREGATE    |       |     1 |     5 |            |          |
    |   2 |   TABLE ACCESS FULL| SALES |  1000K|  4882K|  1324   (1)| 00:00:16 |
    ----------------------------------------------------------------------------
    
    
    Statistics
    ----------------------------------------------------------
              1  recursive calls
              0  db block gets
           4965  consistent gets
              0  physical reads
              0  redo size
            558  bytes sent via SQL*Net to client
            524  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    Is there any scope to improve this code. Specifically can I use avg function in the code instead of working on myself?

    Thank you

    Mich

    Published by: Mich Talebzadeh on February 13, 2012 12:20

    >
    May I ask what is the purpose of the model of aggregate by Oracle functions if it will be row-by-row and he's not going to be effective.
    >
    Oracle online the way you did in your function.

    Your function, using the technology of data cartridges, will be called by Oracle for EACH LINE it reads each line corresponding to your query. This requires a change in context of SQL, PL/SQL, and then back to SQL. It is a very expensive operation in terms of time.

    The Oracle SQL engine is not that way for aggregate functions it provides. The functionality of data cartridge is provided to allow developers to extend Oracle to provide features that Oracle is not provde all. Use of these functions of cartridge cases, you develop may not be 'slow' because there is no equivalent Oracle to compare to. You can use the features of your new cartridge or do you without; you have no other choice.

    You should always use SQL from Oracle to do the job unless you are doing something that can be done in SQL. Then you should use of Oracle PL/SQL features (for example in BULK of treatment) to do the more complex things. Finally if you need to do something just that Oracle cannot do with out-of-the-box SQL or PL/SQL, then you turn cartridge data, custom Java or C code or other external solutions which you can interface to Oracle.

    The order of the solutions, you should look at is:
    1 SQL
    2 PL/SQL
    3 Java/C external
    4 data cartridge

    He explains a little better? (and it is frankly win again in a minute or two!)

  • Handle NULL values in BPEL

    Hello

    What follows is my payload-
    < variableentree >
    -part name = "payload" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" >
    -ns1:CancelCollectionRequest xmlns:ns1 = "http://xmlns.uns.com/SoaCcb/StartService" >
    < ns1:TransactionId > 123 < / ns1:TransactionId >
    < ns1:ExistingCustomerAccountId / >
    < ns1:ForceDateAppointment > true < / ns1:ForceDateAppointment >
    < ns1:PreAccountManagerCustomer > true < / ns1:PreAccountManagerCustomer >
    < / ns1:CancelCollectionRequest >
    < / part >

    If the value of ExistingCustomerAccountId is NULL - I should perform certain tasks
    and another series of tasks if the value of ExistingCustomerAccountId is NOT NULL

    Inside a switch block, I was hoping to make use of the Sub statement to check if the value is NULL
    bpws:getVariableData('inputVariable','payload','/client:CancelCollectionRequest/client:ExistingCustomerAccountId') = "

    And statement above does not correctly handle scenario NULL.

    I was hoping that ora: countNodes('inputVariable','payload','/client:CancelCollectionRequest/client:ExistingCustomerAccountId') will return zero, but it returns the value 1.

    No idea how to catch NULL condition in the above switch block?

    Appreciate any help.

    Thank you
    Shakur

    Hello

    Use something like below in the switch activity

    string-length(normalize-space(bpws:getVariableData('inputVariable','payload','/client:CancelCollectionRequest/client:ExistingCustomerAccountId')))>0 
    

    Kind regards

    Published by: Oraacler on July 20, 2010 11:56

  • Null value in the selection list

    I was wondering if there is a way to get a select list to return a value zero?

    I have a query with a condition like this where clause
    instr(upper("TYPE"),upper(nvl(:P3_TYPE,"TYPE"))) > 0 
    Where: P3_TYPE is a selection list. However, when it is null, no value no is returned in the report of sql - I guess that the nvl function is not picking up with the null value. I just that it displays all of the records when the value is zero in the list.

    Thanks in advance,
    Trent

    use

    instr(upper("TYPE"),upper(nvl(DECODE(:P3_TYPE,'null',NULL,:P3_TYPE),"TYPE"))) > 0
    

    When your selection list returns "null" for NULL values. Please note that select the return list value is a string that is not equivalent to PL/SQL NULL

    See you soon,.
    Hari

Maybe you are looking for