Control the Append KM, Group by clause

Hi all

I am using the max function in interface (KM: control IKM append), in the map apart from the source columns in the data store that I use few variables ODI (say LD_ID = 200). Sort of variable LD_ID is being picked up by the KM in the group clause, why Labour fails with the error
GROUP BY position 200 isn't in the target list. I understand the error but do not know why this variable in the grop is recovered by the clause. The substituition method that I see in the KM is odiRef.getGrpBy)

Can someone help me with this please?

Thank you
Ashok

Hey Ashok,

When using (a) or several global functions, like SUM, ODI add one GROUP BY clause with all other columns in it.
You can try to move the mapping of the LD_ID on the target and see if it works (it depends on the architecture you).

Kind regards
JeromeFr

Tags: Business Intelligence

Similar Questions

  • ORA-00907: lack the right parenthesis when using Group by clause with xmlagg

    I have the following query and I am getting ORA-00907 error when I use the clause with the xmlagg function group.
    select xmlelement("Mitigation",
                    xmlelement("m_szMethodName",tm.DisplayName),
                    xmlelement("SubstanceInterferenceProtocolList",
                                (select xmlagg(xmlelement("MitigationProtocol",
                                        xmlelement("m_szMethodName",tm.DisplayName),
                                        xmlelement("m_szInterferenceProtocolName",tmp.protocol_name),
                                        xmlelement("m_szInterferenceSubstance",tmp.intf_mtrl_prod_code),
                                        xmlelement("m_ProtocolParameters",
                                            xmlelement("m_szProtocolName",tmp.protocol_name),
                                                xmlelement("m_Consumables",
                                                    xmlelement("Consumable",
                                                        xmlelement("m_szConsumId", xrl.rgnt_pack_name),
                                                        xmlelement("m_szProductCode",xrl.pack_prod_code),
                                                        xmlelement("m_nVolume",tmp.fluid_vol),
                                                        xmlelement("m_szProtocolStep",xps.protocol_step_name))),
                                                    xmlelement("m_ProtParamList",
                                                        xmlagg(
                                                        xmlelement("ParameterValues",
                                                            xmlelement("m_szProtocolName",tmp.protocol_name),
                                                            xmlelement("m_Time",xpsd.parameter_ntime_value))
                                                        group by tmp.ccd_test_id,tmp.intf_mtrl_prod_code)
                    )))
                    order by tmp.ccd_test_id, tmp.intf_mtrl_prod_code, xps.protocol_step_intprotocolstep )
                    from XPR_tdef_mitigation_protocol tmp, xp_reagentlist xrl,
                    xpr_protocol_settings xps, xpr_protocol_settings_default xpsd
                    where tmp.ccd_test_id = tm.ccd_test_id
                    and tmp.ccd_test_id = xrl.ccd_test_id
                    and tmp.pack_prod_code = xrl.pack_prod_code
                    and tmp.intf_type = 1
                    and xps.protocol_name = xpsd.protocol_name
                    and xps.protocol_step_name = xpsd.protocol_step_name
                    and xps.ps_action_parameterlist = xpsd.ps_action_parameterlist
                    and xps.protocol_name =  tmp.PROTOCOL_NAME
                    )))
    from XPtoXPRTdef_defn_mapping tm
    where tm.DisplayName = 'SYPH'
    If I remove the clause xmlagg and the group by clause, the query works well and not give me the result.
    But in this code XML, the output format is incorrect for my application.

    Could someone help out here?

    Now my problem is that this unique coating is more than 32767 characters and utl_file can write 32767 bytes per line.
    Someone deal with this?

    Serialize the output as CLOB and DBMS_XSLPROCESSOR.clob2file procedure used to write to a file:

    DECLARE
      xml_output CLOB;
    BEGIN
      SELECT XMLElement("Department",
               XMLAgg(
                 XMLElement("Employee",e.job_id||' '||e.last_name)
                 ORDER BY e.last_name
               )
             ).getClobVal() AS "Dept_list"
      INTO xml_output
      FROM hr.employees e
      WHERE e.department_id = 30 OR e.department_id = 40;
    
      DBMS_XSLPROCESSOR.clob2file(xml_output, 'XML_DIR', 'test.xml');
    END;
    /
    
  • Select the columns not in the group by clause

    Hello

    My version of DB is 10.0.2

    I have query, where in I need to select two columns more but that should not be part of the group by Clause.

    Does perform a work around?
    SELECT  F.custnum, 
      V.Import_date,
     -- F.ErledigtMM,F.ErledigtGrundMM, (Columns to be selected additionally)
      nvl(sum(nvl(round(V.VerAuf16/1000,2), 0)  +nvl(round(V.VerAuf17/1000,2), 0)  + nvl(round(V.VerAuf18/1000,2), 0)  + nvl(round(V.VerAuf19/1000,2), 0)  + nvl(round(V.VerAuf20/1000,2), 0)  + nvl(round(V.VerAufKAPUn/1000,2), 0)  + nvl(round(V.VerAufKAPVz/1000,2), 0) ), 0)  Mandantenforderung,
      nvl(sum(nvl(round(V.VerAuf4/1000,2), 0) ), 0) Inkassokosten,
      nvl(sum(nvl(round(V.VerAuf5/1000,2), 0) ), 0) KontoFuehrungsgebuehren,
      nvl(sum(nvl(round(V.VerAuf1/1000,2), 0)  + nvl(round(V.VerAuf2/1000,2), 0) ), 0)  Verwertungskosten,
      nvl(sum(nvl(round(V.VerAuf10/1000,2), 0)  + nvl(round(V.VerAuf8/1000,2), 0) + nvl(round(V.VerAuf9/1000,2), 0) ), 0)  Barauslagen,
      nvl(sum(nvl(round(V.VerAuf13/1000,2), 0)  + nvl(round(V.VerAuf14/1000,2), 0) + nvl(round(V.VerAuf15/1000,2), 0)  + nvl(round(V.VerAuf6/1000,2), 0) ),0)  Gerichtskosten,
      nvl(sum(nvl(round(V.VerAuf11/1000,2), 0)  + nvl(round(V.VerAuf12/1000,2), 0)  + nvl(round(V.VerAuf7/1000,2), 0) ), 0) RAKosten,
      TO_CHAR(F.Created_Date,'MM.YYYY') Created_Date_MM ,
      TO_CHAR(F.Created_Date,'YYYY') Created_Date_MMRRRR
    FROM FACM F, VA V 
       WHERE  F.custnum =  DECODE(0,0,F.custnum,0) AND
      F.accnum = V.accnum 
      GROUP BY F.custnum, V.Import_date,TO_CHAR(F.Created_Date,'MM.YYYY') ,TO_CHAR(F.Created_Date,'YYYY'))

    Hello

    Here's what I suggest:

    select
    a.custnum,
    a.import_date,
    b.ErledigtMM,
    b.ErledigtGrundMM,
    a.Mandantenforderung,
    a.Inkassokosten,
    a.KontoFuehrungsgebuehren,
    a.Verwertungskosten,
    a.Barauslagen,
    a.Gerichtskosten,
    a.RAKosten,
    a.Created_Date_MM ,
    a.Created_Date_MMRRRR
    from (
    SELECT  F.custnum,
      V.Import_date,
      nvl(sum(nvl(round(V.VerAuf16/1000,2), 0)  +nvl(round(V.VerAuf17/1000,2), 0)  + nvl(round(V.VerAuf18/1000,2), 0)  + nvl(round(V.VerAuf19/1000,2), 0)  + nvl(round(V.VerAuf20/1000,2), 0)  + nvl(round(V.VerAufKAPUn/1000,2), 0)  + nvl(round(V.VerAufKAPVz/1000,2), 0) ), 0)  Mandantenforderung,
      nvl(sum(nvl(round(V.VerAuf4/1000,2), 0) ), 0) Inkassokosten,
      nvl(sum(nvl(round(V.VerAuf5/1000,2), 0) ), 0) KontoFuehrungsgebuehren,
      nvl(sum(nvl(round(V.VerAuf1/1000,2), 0)  + nvl(round(V.VerAuf2/1000,2), 0) ), 0)  Verwertungskosten,
      nvl(sum(nvl(round(V.VerAuf10/1000,2), 0)  + nvl(round(V.VerAuf8/1000,2), 0) + nvl(round(V.VerAuf9/1000,2), 0) ), 0)  Barauslagen,
      nvl(sum(nvl(round(V.VerAuf13/1000,2), 0)  + nvl(round(V.VerAuf14/1000,2), 0) + nvl(round(V.VerAuf15/1000,2), 0)  + nvl(round(V.VerAuf6/1000,2), 0) ),0)  Gerichtskosten,
      nvl(sum(nvl(round(V.VerAuf11/1000,2), 0)  + nvl(round(V.VerAuf12/1000,2), 0)  + nvl(round(V.VerAuf7/1000,2), 0) ), 0) RAKosten,
      TO_CHAR(F.Created_Date,'MM.YYYY') Created_Date_MM ,
      TO_CHAR(F.Created_Date,'YYYY') Created_Date_MMRRRR
    FROM FACM F, VA V
       WHERE  F.custnum =  DECODE(0,0,F.custnum,0) AND
      F.accnum = V.accnum
      GROUP BY F.custnum, V.Import_date,TO_CHAR(F.Created_Date,'MM.YYYY') ,TO_CHAR(F.Created_Date,'YYYY'))
    ) a,
    FACM b
    where b.custnum = a.custnum 
    

    By the way

    WHERE  F.custnum =  DECODE(0,0,F.custnum,0) AND F.accnum = V.accnum
    

    can be translated into

    WHERE F.accnum = V.accnum
    

    because

    F.custnum =  DECODE(0,0,F.custnum,0)
    

    is always true
    because

    DECODE(0,0,F.custnum,0)
    

    means

    if 0=0 then F.custnum else 0
    
  • Understanding of the multiple GROUP BY clause column

    Hi all
    Suppose I have the HR schema example, what is the difference between these two codes?
    select department_id, job_id, count(*) from employees GROUP BY department_id, job_id ORDER BY 1,2;
    and
    select department_id, job_id, count(*) from employees GROUP BY job_id,department_id ORDER BY 1,2;
    I do not see the difference when I run these queries.

    Best regards
    Valerie

    Well, semantically there is no difference: the two queries are equivalent, they return the same result as the value of lines.

    The order of columns in a GROUP BY clause is unrelated to the result set of a query. You group by this "group of columns.

    And since you order two games using the exact same ORDER BY clause, the order in which Oracle returns the bag of lines is the same too in your case.

  • CFQUERYPARAM tag does not work in the GROUP BY clause

    I get an error whenever I put a CFQUERYPARAM tag in a GROUP BY clause. I saw on another forum, someone had a similar problem with the ORDER BY clause

    Here's a sample of what might look like my code
    Select x, y, z of ABC
    Group of < cfqueryparam value = 'x' cfsqltype = "cf_sql_float" >

    Here is the error I get.

    Run database query error.
    [Macromedia] [Oracle JDBC Driver] [Oracle] ORA-00979: not a GROUP BY expression

    Any idea?

    Cachedwithin and cachedafter functions store the query results in the RAM of the server. This means that, even if it is cached, when you run it, you get the cached result instead of going to the database to run again. This increases the speed of course, but if the data is changed during the period of cover, you have accuracy problems.

    It creates no memory problems. In the administrator you book a certain amount of memory for the query cache. If you exceed this amount, the last request to shoot the first query on, or something like that.

    In regards to what you're trying to do on the binding of variables to your group by clause, this isn't what cfqueryparam has been designed for. It has been designed to
    where clauses (where it =
    or insert queries (insert in my values in the table (field) ())
    and things like that.

    You try to use it for anything other than what it was designed for, which explains why it does not work for you.

  • Concatenation of data with the GROUP BY clause

    Hi again!

    Following my previous thread...
    Re: Need help with RANK() on data ZERO

    I tried to apply the GROUP BY clause instead of preforming my query with RANK() to manage records NULL... I have a scenario where I also need to concatenate data from several lines.

    CREATE TABLE T_EMP (NUMBER OF EMP_NO, NAME VARCHAR2 (20));
    INSERT INTO T_EMP VALUES (1001, 'MARK');
    INSERT INTO T_EMP VALUES (1002, 'DAVID');
    INSERT INTO T_EMP VALUES (1003, "SHAUN");
    INSERT INTO T_EMP VALUES (1004, "JILL");

    CREATE TABLE T_EMP_DEPT (NUMBER OF EMP_NO, DEPT_NO NUMBER);
    INSERT INTO T_EMP_DEPT VALUES (1001, 10);
    INSERT INTO T_EMP_DEPT VALUES (1001, 20);
    INSERT INTO T_EMP_DEPT VALUES (1002, 10);
    INSERT INTO T_EMP_DEPT VALUES (1002, 20);
    INSERT INTO T_EMP_DEPT VALUES (1002, 30);
    INSERT INTO T_EMP_DEPT VALUES (1003, 20);
    INSERT INTO T_EMP_DEPT VALUES (1003, 30);
    INSERT INTO T_EMP_DEPT VALUES (1004, 10);

    CREATE TABLE T_EMP_VISITS (NUMBER OF EMP_NO, DEPT_NO NUMBER, VISITED DATE);
    INSERT INTO T_EMP_VISITS VALUES (1001, 10, 1 JAN 2009');
    INSERT INTO T_EMP_VISITS VALUES (1002, 10, 1 JAN 2009');
    INSERT INTO T_EMP_VISITS VALUES (1002, 30, 11 APR 2009');
    INSERT INTO T_EMP_VISITS VALUES (1003, 20, 3 MAY 2009');
    INSERT INTO T_EMP_VISITS VALUES (1003, 30: 14 FEB 2009');
    COMMIT;

    I have a T_EMP master table that stores the name and number of the emp. Each emp is required to visit some departments. This mapping is stored in the T_EMP_DEPT table. An employee can visit one or more departments. T_EMP_VISITS table stores the dates where the employee visited the services required. I need to view the report which should show when an employee all completed visits, which is the maximum date when it finished to visit all departments. If he did not visit any of the report should display date max, otherwise NULL. I was able to do using GROUP BY such proposed by Salim, but how do I show a list separated by commas of the services required for an employee in the same query.

    SELECT
    EMP_NO,
    NAME,
    MAX (DEPT_NO) KEEP (DENSE_RANK LAST ORDER BY VISITED) MAX_DEPT_NO,.
    MAX (VISITED) KEEP (DENSE_RANK LAST ORDER PER VISIT) VISITS_COMP
    DE)
    SELECT
    T_EMP. EMP_NO,
    NAME,
    T_EMP_DEPT. DEPT_NO,
    VISITED
    OF T_EMP
    LEFT OUTER JOIN T_EMP_DEPT
    ON T_EMP. EMP_NO = T_EMP_DEPT. EMP_NO
    LEFT OUTER JOIN T_EMP_VISITS
    ON T_EMP_DEPT. EMP_NO = T_EMP_VISITS. EMP_NO
    AND T_EMP_DEPT. DEPT_NO = T_EMP_VISITS. DEPT_NO)
    GROUP EMP_NO, NAME;

    Output
    EMP_NO NAME MAX_DEPT_NO VISITS_COMP
    1001 MARK 20
    1002 DAVID 20
    1003 SHAUN 20 3 MAY 09
    JILL 1004

    Power required
    EMP_NO NAME REQ_DEPTS MAX_DEPT_NO VISITS_COMP
    1001 MARC 20 10.20
    1002 DAVID 10,20,30 20
    1003 SHAUN 20,30 20 3 MAY 09
    JILL 10 1004

    Can we do this in a single query?

    Hello

    user512647 wrote:
    ... Sanjay
    The query you provided that stragg() use seems to work but my requirement is not in the result set. I don't know how to use stragg with
    MAX (DEPT_NO) KEEP (DENSE_RANK LAST ORDER BY VISITED) MAX_DEPT_NO,.
    MAX (VISITED) KEEP (DENSE_RANK LAST ORDER PER VISIT) VISITS_COMP
    I need more, these two columns these gives me the date when they have completed all visits. If they missed any Department then the result must be NULL in the VISITS_COMP field.

    Just add them to the SELECT clause:

    SELECT    t_emp.emp_no,
           name,
           STRAGG (t_emp_dept.dept_no)     AS deptno,
           MAX (t_emp_dept.dept_no) KEEP (DENSE_RANK LAST ORDER BY visited)
                                      AS max_dept_no,
           MAX (visited)                      AS visits_comp
    FROM             t_emp
    LEFT OUTER JOIN      t_emp_dept     ON   t_emp.emp_no     = t_emp_dept.emp_no
    LEFT OUTER JOIN      t_emp_visits     ON   t_emp_dept.emp_no     = t_emp_visits.emp_no
                                 AND  t_emp_dept.dept_no = t_emp_visits.dept_no
    GROUP BY  t_emp.emp_no
    ,            name
    ;
    

    The column called visit_comp is simply the last visited, regardless of how the employee visited departments.
    If you want to have the NULL value if the employee has not yet visited all 3 departments:

    ...       CASE
              WHEN  COUNT (DISTINCT t_emp_dept.dept_no) = 3
              THEN  MAX (visited)
           END                    AS visits_comp
    

    The 'magic number' 3 is the total number of departments.
    If you want to understand the correct value of that at the time of the execution of the query, replace the code literal 3 hard with a scalar subquery.

    Note that 'KEEP MAX (x) (DENSE_RANK OVER LAST SERVICE BY x)' (where the exact same column is used as an argument and that the ORDER BY column) is just "MAX (x)".

  • A question about the analytical function used with the GROUP BY clause in SHORT

    Hi all

    I created the following table named myenterprise
    CITY       STOREID    MONTH_NAME TOTAL_SALES            
    ---------- ---------- ---------- ---------------------- 
    paris      id1        January    1000                   
    paris      id1        March      7000                   
    paris      id1        April      2000                   
    paris      id2        November   2000                   
    paris      id3        January    5000                   
    london     id4        Janaury    3000                   
    london     id4        August     6000                   
    london     id5        September  500                    
    london     id5        November   1000
    If I want to find which is the total sales by city? I'll run the following query
    SELECT city, SUM(total_sales) AS TOTAL_SALES_PER_CITY
    FROM myenterprise
    GROUP BY city
    ORDER BY city, TOTAL_SALES_PER_CITY;
    that works very well and produces the expected result, i.e.
    CITY       TOTAL_SALES_PER_CITY   
    ---------- ---------------------- 
    london     10500                  
    paris      17000            
    Now in one of my books SQL (Mastering Oracle SQL) I found another method by using the SUM, but this time as an analytic function. Here's what the method of the book suggests as an alternative to the problem:
    SELECT city, 
           SUM(SUM(total_sales)) OVER (PARTITION BY city) AS TOTAL_SALES_PER_CITY
    FROM myenterprise
    GROUP BY city
    ORDER BY city, TOTAL_SALES_PER_CITY;
    I know that the analytic functions are executed after the GROUP BY clause has been transformed completely and Unlike regular aggregate functions, they return their result for each line belonging to the partitions specified in the partition clause (if there is a defined partition clause).

    Now my problem is that I do not understand what we have to use two functions SUM? If we only use one only, i.e.
    SELECT city, 
           SUM(total_sales) OVER (PARTITION BY city) AS TOTAL_SALES_PER_CITY
    FROM myenterprise
    GROUP BY city
    ORDER BY city, TOTAL_SALES_PER_CITY;
    This generates the following error:
    Error starting at line 2 in command:
    SELECT city, 
           SUM(total_sales) OVER (PARTITION BY city) AS TOTAL_SALES_PER_CITY
    FROM myenterprise
    GROUP BY city
    ORDER BY city, TOTAL_SALES_PER_CITY
    Error at Command Line:2 Column:11
    Error report:
    SQL Error: ORA-00979: not a GROUP BY expression
    00979. 00000 -  "not a GROUP BY expression"
    *Cause:    
    *Action:
    The error is generated for the line 2 column 11 which is, for the expression SUM (total_sales), well it's true that total_sales does not appear in the GROUP BY clause, but this should not be a problem, it has been used in an analytical function, so it is evaluated after the GROUP BY clause.

    So here's my question:

    Why use SUM (SUM (total_sales)) instead of SUM (total_sales)?


    Thanks in advance!
    :)





    In case you are interested, that's my definition of the table:
    DROP TABLE myenterprise;
    CREATE TABLE myenterprise(
    city VARCHAR2(10), 
    storeid VARCHAR2(10),
    month_name VARCHAR2(10),
    total_sales NUMBER);
    
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('paris', 'id1', 'January', 1000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('paris', 'id1', 'March', 7000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('paris', 'id1', 'April', 2000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('paris', 'id2', 'November', 2000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('paris', 'id3', 'January', 5000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('london', 'id4', 'Janaury', 3000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('london', 'id4', 'August', 6000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('london', 'id5', 'September', 500);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('london', 'id5', 'November', 1000);
    Edited by: dariyoosh on April 9, 2009 04:51

    It is clear that thet Analytics is reduntant here...
    You can even use AVG or any analytic function...

    SQL> SELECT city,
      2         avg(SUM(total_sales)) OVER (PARTITION BY city) AS TOTAL_SALES_PER_CITY
      3  FROM myenterprise
      4  GROUP BY city
      5  ORDER BY city, TOTAL_SALES_PER_CITY;
    
    CITY       TOTAL_SALES_PER_CITY
    ---------- --------------------
    london                    10500
    paris                     17000
    
  • By the way where and group by clause Cursor

    I'm working on a procedure that generates a where clause clause and needs of a group by clause to return the correct results. I'm moving the two where and group variables in the cursor.

    The variables are is filled correctly, but when the cursor is created, variables are not in the cursor.

    Here's the code I'm working with. It is part of a package, but does no appeal to other parts of the package.

    PROCEDURE createFollowUpTask_Exposure (psUppgkedjetyp IN tis.tial.uppgkedjetyp%TYPE NULL by default,
    psAlarmtyp IN tis.tial.alarmtyp%TYPE by default NULL,
    psSubtyp IN tis.tial.subtyp%TYPE by default NULL,
    pnDays in NUMBER NULL by default,
    psKampkod IN tis.tiin.kampkod%TYPE by default NULL,
    psKatnr IN tis.tiin.katnr%TYPE by default NULL,
    psUtgava IN tis.tiin.utgava%TYPE by default NULL,
    psKatslag IN tis.tikg.katslag%TYPE by default NULL,
    psProdsyst IN tis.tikg.prodsyst%TYPE by default NULL,
    psUppgtyp IN tis.tiin.uppgtyp%TYPE by default NULL,
    psProdkod IN tis.tiin.prodkod%TYPE by default NULL,
    psStatus IN tis.tiin.status%TYPE by default NULL
    ) AS
    --
    cTIAL tis.tial%ROWTYPE;
    vLopnr tis.tial.lopnr%TYPE;
    vSqlWhere VARCHAR2 (4000);
    vGroupBy VARCHAR2 (1000): = "tiin.kampkod, tiin.abnr, tiko.fordsalj;
    cSelectCursor SYS_REFCURSOR;
    vSqlSelect VARCHAR2 (4000);
    psDays VARCHAR2 (50);
    cRec T_TIAL_REC;
    nCount number: = 0;

    --
    CURSOR cSqlSelect (SqlWhere IN VARCHAR2, GroupBy IN VARCHAR2) IS
    SELECT tiin.kampkod, tiin.abnr, tiko.fordsalj, MAX (tici.regdat) ALARMDATE
    OF tis.tiin
    JOIN tis.tiko ON tiin.kampkod = tiko.kampkod AND tiin.abnr = tiko.abnr
    JOIN core.tici ON tiin.kampkod = tici.kampkod AND tiin.abnr = tici.abnr AND tici.inplnr = tiin.inplnr
    WHERE 1 = 1 | SqlWhere
    GroupBy GROUP;
    --
    BEGIN
    -If these parameters are null, trigger the error
    IF psUppgkedjetyp IS NULL and psSubtyp IS NULL THEN
    raise_application_error (-20001,
    "String from the event or events must be assigned");
    END IF;
    -Fill the TIAL values
    IF psUppgkedjetyp IS NOT NULL THEN
    cTIAL.Uppgkedjetyp: = psUppgkedjetyp;
    END IF;
    --
    IF psAlarmtyp IS NOT NULL THEN
    cTIAL.Alarmtyp: = psAlarmtyp;
    END IF;
    --
    cTIAL.Handklass: = 't';
    cTIAL.Blobid: = 0;
    --
    IF pnDays IS NOT NULL THEN
    psDays: = '+' | pnDays;
    END IF;
    IF psSubtyp IS NOT NULL THEN
    cTIAL.Subtyp: = psSubtyp;
    END IF;
    -Create Where clause for cursor
    vSqlWhere: = ";
    IF psKampkod IS NOT NULL THEN
    vSqlWhere: = vSqlWhere | "AND tiin.kampkod ="' | psKampkod | " ' ;
    END IF;
    --
    IF psKatnr IS NOT NULL THEN
    vSqlWhere: = vSqlWhere | "AND tiin.katnr ="' | psKatnr | " ' ;
    END IF;
    --
    IF psUtgava IS NOT NULL THEN
    vSqlWhere: = vSqlWhere | "AND tiin.utgava ="' | psUtgava | " ' ;
    END IF;
    --
    IF psKatslag IS NOT NULL THEN
    vSqlWhere: = vSqlWhere | "AND tikg.katslag ="' | psKatslag | " ' ;
    END IF;
    --
    IF psProdsyst IS NOT NULL THEN
    vSqlWhere: = vSqlWhere | "AND tikg.prodsyst ="' | psProdsyst | " ' ;
    END IF;
    --
    IF psUppgtyp IS NOT NULL THEN
    vSqlWhere: = vSqlWhere | "AND tiin.uppgtyp ="' | psUppgtyp | " ' ;
    END IF;
    --
    IF psProdkod IS NOT NULL THEN
    vSqlWhere: = vSqlWhere | "AND tiin.prodkod ="' | psProdkod | " ' ;
    END IF;
    --
    IF psStatus IS NOT NULL THEN
    vSqlWhere: = vSqlWhere | "AND tiin.status ="' | psStatus | " ' ;
    END IF;
    -Browse all records in input parameters of the meeting and set values required TIAL.
    I'm IN cSqlSelect (vSqlWhere, vGroupBy)
    --
    LOOP
    -EXTRACT cSelectCursor INTO cRec;
    cTIAL.Kampkod: = ";
    cTIAL.Abnr: = ";
    cTIAL.Sign: = ";
    cTIAL.Alarmdate: = ";
    cTIAL.Kampkod: = i.Kampkod;
    cTIAL.Abnr: = i.Abnr;
    cTIAL.Sign: = i.fordsalj;
    cTIAL.Alarmdate: = i.alarmdate;
    --
    nCount: = nCount + 1;
    --
    IF vLopnr = - 1 THEN
    raise_application_error (-20002,
    "Error creating task for: ' | '. cTIAL.Kampkod |' '|| cTIAL.Abnr |' Sales representative: ' | cTIAL.Alarmdate);
    END IF;
    END LOOP;
    DBMS_OUTPUT. Put_line (' I created ' | nCount |) "documents.");



    END createFollowUpTask_Exposure;

    Thanks in advance for any help.

    Hello

    Welcome to the forum!

    Try this (untested) example:

    PROCEDURE createFollowUpTask_Exposure(psUppgkedjetyp IN tis.tial.uppgkedjetyp%TYPE DEFAULT NULL,
                                          psAlarmtyp     IN tis.tial.alarmtyp%TYPE DEFAULT NULL,
                                          psSubtyp       IN tis.tial.subtyp%TYPE DEFAULT NULL,
                                          pnDays         IN NUMBER DEFAULT NULL,
                                          psKampkod      IN tis.tiin.kampkod%TYPE DEFAULT NULL,
                                          psKatnr        IN tis.tiin.katnr%TYPE DEFAULT NULL,
                                          psUtgava       IN tis.tiin.utgava%TYPE DEFAULT NULL,
                                          psKatslag      IN tis.tikg.katslag%TYPE DEFAULT NULL,
                                          psProdsyst     IN tis.tikg.prodsyst%TYPE DEFAULT NULL,
                                          psUppgtyp      IN tis.tiin.uppgtyp%TYPE DEFAULT NULL,
                                          psProdkod      IN tis.tiin.prodkod%TYPE DEFAULT NULL,
                                          psStatus       IN tis.tiin.status%TYPE DEFAULT NULL) AS
       --
       cTIAL         tis.tial%ROWTYPE;
       vLopnr        tis.tial.lopnr%TYPE;
       vSqlWhere     VARCHAR2(4000);
       vGroupBy      VARCHAR2(1000) := ' tiin.kampkod, tiin.abnr, tiko.fordsalj';
       cSelectCursor SYS_REFCURSOR;
       vSqlSelect    VARCHAR2(4000);
       psDays        VARCHAR2(50);
       cRec          T_TIAL_REC;
       nCount        NUMBER := 0;
    
       FUNCTION fnc_cSqlSelect(SqlWhere IN VARCHAR2,
                               GroupBy  IN VARCHAR2) RETURN VARCHAR2 IS
       BEGIN
          RETURN 'SELECT tiin.kampkod,
                 tiin.abnr,
                 tiko.fordsalj,
                 MAX(tici.regdat) ALARMDATE
            FROM tis.tiin
            JOIN tis.tiko ON tiin.kampkod = tiko.kampkod
                         AND tiin.abnr = tiko.abnr
            JOIN core.tici ON tiin.kampkod = tici.kampkod
                          AND tiin.abnr = tici.abnr
                          AND tici.inplnr = tiin.inplnr
           WHERE 1 = 1 ' || SqlWhere || ' GROUP BY ' || GroupBy;
       END fnc_cSqlSelect;
    
    BEGIN
       -- If these parameters are null, raise error
       IF psUppgkedjetyp IS NULL AND psSubtyp IS NULL THEN
          raise_application_error(-20001,
                                  'Either Event Chain or Starting Event must be assigned');
       END IF;
       -- Populate TIAL values
       IF psUppgkedjetyp IS NOT NULL THEN
          cTIAL.Uppgkedjetyp := psUppgkedjetyp;
       END IF;
       --
       IF psAlarmtyp IS NOT NULL THEN
          cTIAL.Alarmtyp := psAlarmtyp;
       END IF;
       --
       cTIAL.Handklass := 'T';
       cTIAL.Blobid    := 0;
       --
       IF pnDays IS NOT NULL THEN
          psDays := '+ ' || pnDays;
       END IF;
       IF psSubtyp IS NOT NULL THEN
          cTIAL.Subtyp := psSubtyp;
       END IF;
       -- Create Where clause for cursor
       vSqlWhere := '';
       IF psKampkod IS NOT NULL THEN
          vSqlWhere := vSqlWhere || ' AND tiin.kampkod = ''' || psKampkod || '''';
       END IF;
       --
       IF psKatnr IS NOT NULL THEN
          vSqlWhere := vSqlWhere || ' AND tiin.katnr = ''' || psKatnr || '''';
       END IF;
       --
       IF psUtgava IS NOT NULL THEN
          vSqlWhere := vSqlWhere || ' AND tiin.utgava = ''' || psUtgava || '''';
       END IF;
       --
       IF psKatslag IS NOT NULL THEN
          vSqlWhere := vSqlWhere || ' AND tikg.katslag = ''' || psKatslag || '''';
       END IF;
       --
       IF psProdsyst IS NOT NULL THEN
          vSqlWhere := vSqlWhere || ' AND tikg.prodsyst = ''' || psProdsyst || '''';
       END IF;
       --
       IF psUppgtyp IS NOT NULL THEN
          vSqlWhere := vSqlWhere || ' AND tiin.uppgtyp = ''' || psUppgtyp || '''';
       END IF;
       --
       IF psProdkod IS NOT NULL THEN
          vSqlWhere := vSqlWhere || ' AND tiin.prodkod = ''' || psProdkod || '''';
       END IF;
       --
       IF psStatus IS NOT NULL THEN
          vSqlWhere := vSqlWhere || ' AND tiin.status = ''' || psStatus || '''';
       END IF;ç
       -- Loop through all records meeting input parameters and set required TIAL values.
       OPEN cSelectCursor FOR fnc_cSqlSelect(vSqlWhere,
                                             vGroupBy);
    
       LOOP
          FETCH cSelectCursor
             INTO v; -- You must define a variable 'v' to hold the data of cursor
          EXIT WHEN cSelectCursor%NOTFOUND;
    
          --FETCH cSelectCursor INTO cRec;
          cTIAL.Kampkod   := '';
          cTIAL.Abnr      := '';
          cTIAL.Sign      := '';
          cTIAL.Alarmdate := '';
          cTIAL.Kampkod   := i.Kampkod;
          cTIAL.Abnr      := i.Abnr;
          cTIAL.Sign      := i.fordsalj;
          cTIAL.Alarmdate := i.alarmdate;
          --
          nCount := nCount + 1;
          --
          IF vLopnr = -1 THEN
             raise_application_error(-20002,
                                     'Error Creating task for: ' || cTIAL.Kampkod || ' ' ||
                                     cTIAL.Abnr || ' Sales Rep: ' || cTIAL.Alarmdate);
          END IF;
       END LOOP;
    
       CLOSE cSelectCursor;
    
       DBMS_OUTPUT.PUT_LINE('I created ' || nCount || ' records.');
    
    END createFollowUpTask_Exposure;
    /
    

    Kind regards

  • NEED HELP IN THE GROUP BY CLAUSE CASES PLEASE

    User1983440 thanks for the help with the script below grouped by product category, can you or someone else help me group by another Case statement as well.


    WITH p AS)
    Select distinct
    partner, region, od. ORDER_AFFILIATE_NAME,
    Oh.external_order_number,
    Ain.get_g1 (queue_type) offers,
    Case
    When disp.category = 100 Then 'ORDER'
    When disp.category = 200 Then 'ACCESS'
    When disp.category = 300 Then 'DSL'
    When disp.category = 600 Then 'IPTV'
    "When disp.category = 700 Then'INTERNET"
    When disp.category = 800 Then 'VOIP'
    End up like product_category,
    To_char(OH.created_ts, 'yyyy-mm-dd HH24:mi:ss') CREATE_DATE
    -Case when ip.offer_type = "IPDSLAM" or instr (ip.display_name, "-d") > 0
    THEN 'IP - LAN'
    ELSE 'FTTN.
    end as product_type
    Case
    When disp.state = 4 and disp.state = 9 or disp.state = 21 or 22 = disp.state then 'cancelled '.
    When disp.state = 17 then "NRFC cancelled.
    When disp.state = 7 Then 'incomplete '.
    When disp.state = 3 or disp.state = 8, then "Finish".
    When disp.state = 6 or disp.state = 10 and disp.state = 13 or disp.state = 14 then 'pending - other ".
    When disp.state = 19 disp.state = 20 then "sent".
    When disp.state = 21 or disp.state = 22 then "Cancelled - CSUS.
    When disp.state = 23 or 24 = disp.state then 'Order Confirmation '.
    When disp.state = 1 or disp.state = 2 or disp.state = 15 then "receipt".
    Another 'other '.
    End as STATE_desc
    of AIN.impl_oh_order_header oh,.
    Ain.impl_order_data od,
    DISP AIN.sncr_order_curr_disp,
    AIN.impl_package ip
    where oh.created_ts between to_date ('2013-02-04', ' yyyy-mm-dd "")
    and to_date ('2013-02-11', ' yyyy-mm-dd "")
    and oh.order_type = 'COMMAND '.
    and disp.category to (200, 300, 600, 700, 800)
    and disp.state! = '5'
    and uscs = 0
    and disp.transaction_id = oh.transaction_id
    and od. transaction_id = oh.transaction_id
    and ip.transaction_id = oh.transaction_id
    and ip.package_type = 'PACKAGE '.
    and ip.parent_package_id is null
    and ip.product_type = 'COMMAND '.
    )
    SELECT product_category,
    COUNT (*)
    P
    GROUP BY product_category

    To summarize, by category of product, and then by state_desc:

    WITH p AS (
    Select distinct
    partner, region, od.ORDER_AFFILIATE_NAME,
    oh.external_order_number,
    ain.get_g1(queue_type) offer,
    Case
    When disp.category = 100 Then'ORDER'
    When disp.category = 200 Then'ACCESS'
    When disp.category = 300 Then'DSL'
    When disp.category = 600 Then'IPTV'
    When disp.category = 700 Then'INTERNET'
    When disp.category = 800 Then'VOIP'
    End as product_category,
    TO_CHAR(oh.created_ts, 'yyyy-mm-dd hh24:mi:ss') CREATE_DATE,
    Case when ip.offer_type = 'IPDSLAM' or instr(ip.display_name, '- D')> 0
    THEN 'IP-DSL'
    ELSE 'FTTN'
    end as product_type,
    Case
    When disp.state = 4 or disp.state = 9 or disp.state= 21 or disp.state= 22 Then 'Canceled'
    When disp.state = 17 Then 'Canceled NRFC'
    When disp.state = 7 Then 'Incomplete'
    When disp.state = 3 or disp.state = 8 Then 'Complete'
    When disp.state = 6 or disp.state = 10 or disp.state = 13 or disp.state =14 Then 'Pending - Other'
    When disp.state = 19 or disp.state = 20 Then 'Submitted'
    when disp.state = 21 or disp.state = 22 then 'Cancelled- CSUS'
    when disp.state =23 or disp.state = 24 then 'Order Confirmation'
    when disp.state =1 or disp.state = 2 or disp.state = 15 then 'Received'
    Else 'Other'
    End as STATE_desc
    from AIN.impl_oh_order_header oh,
    ain.impl_order_data od,
    AIN.sncr_order_curr_disp disp ,
    AIN.impl_package ip
    where oh.created_ts between to_date('2013-02-04', 'yyyy-mm-dd')
    and to_date('2013-02-11', 'yyyy-mm-dd')
    and oh.order_type = 'ORDER'
    and disp.category in (200, 300, 600, 700, 800)
    and disp.state !='5'
    and uscs= 0
    and disp.transaction_id = oh.transaction_id
    and od. transaction_id = oh.transaction_id
    and ip.transaction_id = oh.transaction_id
    and ip.package_type = 'PACKAGE'
    and ip.parent_package_id is null
    and ip.product_type = 'ORDER'
    )
    SELECT product_category, STATE_desc,
    COUNT(*)
    FROM p
    GROUP BY product_category, STATE_desc
    

    To summarize by state_desc, just remove "product category", the query above.

  • Control the Boolean commands and generate a corresponding digital output

    Hi all

    I'm working on a project of activation of the electrode, here, I thought that how could I order an electrode in a time and generate a digital output of it accordingly. I want to replace it with each electrode with a LED on the front panel and generate a numerical value to each LED on the block diagram.

    If it can be divided into two parts

    1 control the Boolean outputs

    Here, my goal is that if I have 5 leds that are used as a Boolean control, must be ordered so that only one of them lights up at the same time and the rest goes off.

    I mean for example if #3 was turned on and that the user pressed the #3 #2 should be turned off and only #2 lights.

    2. generate the corresponding numerical value


    Depending on the position of the LEDs I want to generate a corresponding numerical value, as previously released 3 coming and exit 2 then comes when the second LED illuminates.

    I ask all participants to this group to help me with this.

    Concerning

    Why don't you use the radio button control? You can replace the boxes if you want the buttons.

  • Script to add a domain user to the local Administrators group raises the error "the network path is not found."

    I have a Windows Server 2008 R2 domain and a Windows XP Pro workstation that has been attached to the domain and then disconnected. I am trying to create a VBS script to add a domain user to the local Administrators group.

    I log on my computer as a local administrator and run the following script:

    Dim oNetwork: Set oNetwork = WScript.CreateObject ("WScript.Network")
    StrPC Dim: strPC = oNetwork.ComputerName
    Dim OGroup: Set oGroup = GetObject ("WinNT: / /" & strPC & "/ directors")
    Dim OUser: Set oUser = GetObject ("WinNT://domainname/username")
    oGroup.Add (oUser.ADsPath)

    This script returns the error "the network path is not found."

    However, I am able to go into control panel > user accounts > enter the user name and the domain name > click Next... > choose the administrators of the 'other' group and the user name will be added to the local Admin group.

    The same script runs without error if it is launched after logon on the workstation with a domain administrator account.

    How can I get my script runs without error, when you are logged into the workstation as a local administrator?

    Best regards, Andy

    The code that I used came from here. If the syntax of the Add method is passed to oUser.ADsPAth to "WinNT: / /" & domainname & "/" & username, the script works correctly.

    Therefore, the modified script:

    Dim oNetwork: Set oNetwork = WScript.CreateObject ("WScript.Network")
    StrPC Dim: strPC = oNetwork.ComputerName
    Dim OGroup: Set oGroup = GetObject ("WinNT: / /" & strPC & "/ directors")
    Dim strUser: strUser = "WinNT://domainname/username."
    oGroup.Add strUser

    Thanks to Qasim Zaidi to show the code of work here.

    Best regards, Andy

  • Where to find the local Administrators group?

    I wonder had to find what he's talking about if I change the number of Directors.

    Group members check Description

    This check identifies and lists the individual user accounts that belong to the local Administrators group. If more than two individual administrator accounts are detected, Microsoft Baseline Security Analyzer® will list the names of account and flag the check as a potential vulnerability. In general, we recommend that you keep the number of Directors to a minimum because administrators essentially have complete control over the computer.

    © 2002-2007 Microsoft Corporation. All rights reserved.

    NT TrustedInstaller service is necessary as an administrator?

    Yes.

  • Domain users do not have local administrator rights, although I already added them in the local Administrators group

    I gave my domain users with local administrator rights. But they do not get the Control Panel, rights to open the network and sharing Center, and they could not change the registry... etc what is the solution for this? domain administrator I could be able to make any changes in this PC. We are facing this problem in all of our VMWare PC 7 on windows. I tried to add everyone in the local system Local Administrator and add the domain users group to the local administrator groups, but no luck...

    This issue is beyond the scope of this site and must be placed on Technet or MSDN

    http://social.technet.Microsoft.com/forums/en-us/home

    http://social.msdn.Microsoft.com/forums/en-us/home

  • The concept of Group of tunnels WebVPN

    I'm WebVPN configuration in ASA (7.1.2) and I have a question about the tunnels WebVPN group attributes. I would if I can get a link useful to understand or explain quickly.

    Group Q1 alias). It is the name of group policy, and then choose when connecting? If so, can I configure group such as URL-list policy and choose when connecting to choose different group policy?

    Group - url of Q2). According to the doc, not necessary to choose the name of the group if the user types the URL (or IP) configured here. If I have two groups WebVPN and a single public IP address of ASA, how can I differenticate between groups of WebVPN.

    Q3) when connecting WebVPN, how can I control a user to choose a specific group policy name when you use the AAA authentication? I can associate local users on behalf of the group, but I don't know is it possible in the case of the AAA authentication.

    Thanks in advance,

    (2) group-url is another way to give users the right tunnel-group and political party. It is also configured under the params webvpn of the tunnel group. You must specify a url for each group of tunnel.

    (3) in order to put the user in the right group with aaa you go back 25 Radius attribute to the ASA. The user will send user/pass to the ASA. The ASA will transmit to the user/pass to the aaa server.

    The aaa server will search the user and return a past or a failure response AND assign 25 = something. All ASA receives for attribute 25, it will try to match a group - policy.group - lock in group policy must be enabled to place the user in the correct tunnel group.

  • Doubts formidable wrt "select", "join" and "group by" clause to calm a while...

    Dear all,

    Kindly advise on below 2 doubts which have been daunting for quiet some time. The bottom has forced our requests to take alternative routes to receive solutions.

    Doubt 1) is it possible for us to use 'select (*)' with a group and a join clause, if we have at least 2/3 tables with minimum 15-20 columns... given the constraint of having to add all the names column in the group by clause.

    Question 2) is it possible to use "select" (*) with the exception of a single column of the table?
    That is to say, I hate the output of a statement select (*) to have the entire field except a field in a table

    Ask your advisor for the same thing. Excuse me because I have no examples to illustrate this point in time. A successful idea will do.

    Thank you and best regards,

    Séverine Suresh

    Hey, Sebastian,

    Séverine Suresh - 3035408 wrote:

    Dear all,

    Kindly advise on below 2 doubts which have been daunting for quiet some time. The bottom has forced our requests to take alternative routes to receive solutions.

    Doubt 1) is it possible for us to use 'select (*)' with a group and a join clause, if we have at least 2/3 tables with minimum 15-20 columns... given the constraint of having to add all the names column in the group by clause.

    Sure.  If you had problems, you did it wrong.  Your postal code, examples of data (CREATE TABLE and INSERT statements) and the results desired from these data.

    Check out the Forum FAQ: Re: 2. How can I ask a question on the forums?

    Normally, you don't want to ' SELECT *...» "in a join.  Are most joins are equijoins, ' SELECT *...» "produced 2 copies of / columns used for Assembly.  In addition, many tables have columns (for example, modified_date) that are not necessary in most applications.

    All columns must be included explicitly in a GROUP BY clause. You cannot use * it.

    You can not have parentheses around the * in ' SELECT *...» ».  You might think 'SELECT COUNT (*) '

    Question 2) is it possible to use "select" (*) with the exception of a single column of the table?
    That is to say, I hate the output of a statement select (*) to have the entire field except a field in a table

    ...

    No.; If you don't want a particular column in the result set, you cannot use "SELECT *...» ».

    Your front end can have so as not to display a column in the result set.  For example, in SQL * more:

    COLUMN modified_date NOPRINT

    means that you won't see any column called modified_date.

Maybe you are looking for