PL/SQL equivalent of T-SQL - "group function is not allowed here"

Hi all, hope someone can give me a hand as I'm pretty stuck! I have been trying to convert some MS SQL Server T-SQL statements into Oracle PL/SQL and am stuck on the below one:
SELECT
CA.AssessmentID,
(SELECT ProductName + ISNULL(' - ' + PrincipalBenefit,'')
FROM rptPolicySnapshot WHERE PolicyID = MAX(CA.PolicyID)
AND SnapshotID = 1),
MAX(CA.PolicyID)
FROM rptClaimInvoiceLineSnapshot CIL
INNER JOIN rptClaimAssessmentSnapshot CA
ON CIL.AssessmentID = CA.AssessmentID
AND CIL.SnapshotID = CA.SnapshotID
WHERE CIL.SnapshotID = 1
GROUP BY CA.AssessmentID
This works fine in MSSQL but returns the below error in Oracle:
'ORA-00934: group function is not allowed here'
If I take out the subquery the query works fine.
Any ideas as to the syntax? I am new to Oracle so not sure as to how I should go about writing this.
Thanks in advance!
Leo

WITH x AS (SELECT   ca.assessmentid,
                    MAX (ca.policyid) policy_id
           FROM rptclaiminvoicelinesnapshot cil
                INNER JOIN rptclaimassessmentsnapshot ca
                    ON cil.assessmentid = ca.assessmentid
                   AND cil.snapshotid = ca.snapshotid
           WHERE cil.snapshotid = 1
           GROUP BY ca.assessmentid
SELECT x.assessment_id,
       x.policy_id,
       productname + decode(principalbenefit,null,null,' - ' || principalbenefit ) prodname
FROM   rptpolicysnapshot, x
WHERE  policyid = x.policy_id
AND    snapshotid = 1I think that's in the neighbourhood.

Similar Messages

  • PL/SQL: ORA-00934: group function is not allowed here

    Hi,
    I am writing a PL/SQL procedure. The structure is like :
    SET SERVEROUTPUT ON;
    CREATE OR REPLACE Procedure abc
    IS
    v_total_ip_rec number(14);
    v_total_op_rec number(14);
    v_total_rec number(14);
    BEGIN
    SELECT SUM (CASE
    WHEN <condition 1>
    THEN 1
    ELSE 0
    END
    ) into v_total_ip_rec,
    SUM (CASE
    WHEN <condition 2>
    THEN 1
    ELSE 0
    END
    ) into v_total_op_rec,
    SUM (1) into v_total_rec
    FROM A,B
    WHERE A.Col1=B.Col1;
    EXCEPTION
    WHEN OTHERS THEN
    raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
    END;
    When I run this procedure it gives me following error:
    "PL/SQL: ORA-00934: group function is not allowed here"
    Anybody have any idea?
    Any help would be appreciated.
    Thanks.

    Hi Arunkumar ,
    I think you don't need subquery.
    Regards Salim.
    Or.
    SELECT COUNT (CASE
                     WHEN <condition 1>
                        THEN 1
                  END) v_total_ip_rec,
           COUNT (CASE
                     WHEN <condition 2>
                        THEN 1
                  END) v_total_op_rec,
           COUNT (1) v_total_rec
      FROM a, b
    WHERE a.col1 = b.col1

  • ORA-00934: group function is not allowed here

    Hi,
    My requirement is to check oi.quantity is equal to sum of packing_detail. quantity
    by order_number
    select oi.quantity_ordered oi_qu, pd.quantity pq
    from ordered_items oi, packing_details pd
    where oi.ordered_item_id = pd.ordered_item_id
    and oi.quantity_ordered = sum(pd.quantity)
    and oi.order_number = '29';
    after executing above query I get error
    SQL Error: ORA-00934: group function is not allowed here
    00934. 00000 - "group function is not allowed here"
    Please tell me how to resolve it.
    Thanks in advance
    Sandy

    You have to make use of a subquery;
    select oi.quantity_ordered oi_qu, pd.quantity pq
    from ordered_items oi, packing_details pd 
    where oi.ordered_item_id = pd.ordered_item_id 
    and oi.quantity_ordered = *(select sum(pd.quantity) from packing_details pd1 group by pd1.ordered_item_id)* 
    and oi.order_number = '29';  This is based on the assumption that ordered_items is the summarize data and packing_details are the line item level data.
    regards,
    Dipankar.

  • Group function is not allowed here

    Hi,
    I have a problem running the following sql command, i know the error is over the count function, but i don't know how to solve this. Can you please help me solve this.
    ( i would like to select titles that have more than 2 authors.)
    select distinct titles.title_id, titles.title_name, titles.publisher_ID
    from authors, titles, author_titles
    where titles.title_ID= author_titles.title_id
    and author_titles.au_id = authors.au_id and count(authors) > 2
    ORDER BY titles.title_id DESC ;
    thank Yoy

    Sorry i'm new to databases....
    I tried to add the group by function ... but i still get errors
    select distinct titles.title_id, titles.title_name, titles.publisher_ID
    from authors, titles, author_titles
    where titles.title_ID= author_titles.title_id
    and author_titles.au_id = authors.au_id
    group by titles.title_id
    having count(authors.au_id) > 2
    ORDER BY titles.title_id DESC ;
    error
    select distinct titles.title_id, titles.title_name, titles.publisher_ID
    ERROR at line 1:
    ORA-00979: not a GROUP BY expression
    * >>> on titles.title_name

  • Group function is not allowed here - where statement

    I have a select that is basically:
    select a,b,
    sum(c),sum(d),
    sum(c) - sum(d)
    from A
    group by a, b
    I would like to add:
    where sum(c) - sum(d) <> 0
    I know that I can't use the sum function in the where statement.
    Any ideas how I can get around it?
    Thanks.
    Leah

    Hi ,
    for instance ... using the count aggregate function... which is the same as using sum function.....
    SQL> select job , cnt_emp , cnt_sal
      2    from
      3    (
      4      select job, count(empno) cnt_emp, count(sal) cnt_sal
      5        from emp
      6      group by job
      7    )
      8   where cnt_emp- cnt_sal=0
      9  /
    JOB                            CNT_EMP    CNT_SAL
    CLERK                                5          5
    SALESMAN                             5          5
    PRESIDENT                            1          1
    MANAGER                              3          3
    ANALYST                              2          2Greetings....

  • ORA-00934: group function is not allowed here Error - On validation screen

    Can anyone help me with this funtion Returning boolean PL/SQL expression
    begin
    select max(sim_trip.finish_time) into finish_time,
          max(sim_trip.start_time) into start_time  from sim_trip
    WHERE ((sim_trip.operator_counter = :P500_operator_counter));
    if (:P500_start_time > finish_time)
       then   return true;
    else
    return false;
    end if;
    end;

    Lucy,
    begin
    select max(sim_trip.finish_time) into finish_time,
          max(sim_trip.start_time) into start_time  from sim_trip
    WHERE ((sim_trip.operator_counter = :P500_operator_counter));
    if (:P500_start_time > finish_time)
       then   return true;
    else
    return false;
    end if;
    end;Your select statement is wrong. It should be:
    begin
    select max(sim_trip.finish_time),max(sim_trip.start_time)
      into :P500_start_time,:P500_finsh_time 
      from sim_trip
      WHERE ((sim_trip.operator_counter = :P500_operator_counter));
    if (:P500_start_time > :P500_finish_time)
       then   return true;
    else
    return false;
    end if;
    end;Robert
    http://apexjscss.blogspot.com

  • Error: Group Function Is Not Allowed Here

    Post Author: simiora
    CA Forum: WebIntelligence Reporting
    Hi,
    Created a measure in the Universe, which is based on a BO built-in function "PERCENTILE".
    When this measure is in the WebI report, this field is also added to the GROUP BY caluse of the select statement, which will give the above error.
    Is measure defined wrong? How to eliminate a field from the GROUP BY clause. We are using Oracle database and BOXI Rel 2.
    Thanks.

    Lucy,
    begin
    select max(sim_trip.finish_time) into finish_time,
          max(sim_trip.start_time) into start_time  from sim_trip
    WHERE ((sim_trip.operator_counter = :P500_operator_counter));
    if (:P500_start_time > finish_time)
       then   return true;
    else
    return false;
    end if;
    end;Your select statement is wrong. It should be:
    begin
    select max(sim_trip.finish_time),max(sim_trip.start_time)
      into :P500_start_time,:P500_finsh_time 
      from sim_trip
      WHERE ((sim_trip.operator_counter = :P500_operator_counter));
    if (:P500_start_time > :P500_finish_time)
       then   return true;
    else
    return false;
    end if;
    end;Robert
    http://apexjscss.blogspot.com

  • Getting Group Function is not Allowed

    Hello All....
    When I run the following in the SQL command screen it works fine... But when I try to use it in APEX to populate page values, it gives me the error...
    ERROR
    1 error has occurred
    ORA-06550: line 25, column 74: PL/SQL: ORA-00934: group function is not allowed here ORA-06550: line 24, column 1: PL/SQL: SQL Statement ignored
    CODE THAT WORKS IN SQL COMMAND SCREEN
    SELECT
    SUM(CASE WHEN SLOT = 'Q' THEN '1' ELSE '0' END) AS C_SLOT,
    SUM(CASE WHEN TEST = 'P' THEN '1' ELSE '0' END) AS C_TEST,
    FROM TBL_REC;
    CODE THAT GIVES ERROR ON APPLICATION EXPRESS PAGE
    SELECT
    SUM(CASE WHEN SLOT = 'Q' THEN '1' ELSE '0' END) INTO :P2_C_SLOT,
    SUM(CASE WHEN TEST = 'P' THEN '1' ELSE '0' END) INTO :P2_C_TEST,
    FROM TBL_REC;
    The colums SLOT and TEST have letter codes, I just want it to count just when it matches a certain letter. In the SQL Command Screen, it is returning one row, with the counts, everything is fine. It is only a problem when I try to use it anywere on a page in Application Express.
    The full version has about 20 lines that are all sum lines, but I can not even get the 2 line ver above to work.
    Any thoughts?

    This will work .. the into clause goes after the select columns ... into var1 ,var2 etc ..
    SELECT SUM(CASE
                 WHEN SLOT = 'Q' THEN
                  '1'
                 ELSE
                  '0'
               END),
           SUM(CASE
                 WHEN TEST = 'P' THEN
                  '1'
                 ELSE
                  '0'
               END)
      INTO :P2_C_SLOT, :P2_C_TEST,
      FROM TBL_REC;SS

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

    I am Trying to compile this procedure, but i get error, could please anybody help me out.
    Thanks.
    SQL> create or replace procedure FOF_sport_setup(
    2 v_model_cd in varchar2, -- model_cd used in many place
    3 v_portfolio_name in varchar2, -- portfolio name
    4 v_src_acct_nbr in varchar2, -- source account number for port
    5 v_src_fund_nbr in varchar2, -- source fund number
    6 v_fmr_fund_nbr in varchar2, -- fidelity fund number
    7 v_src_cd in varchar2, -- source code
    8 v_last_mod_id in varchar2 -- your corp id
    9 )
    10 as
    11 v_new_portf_id number(12);
    12
    13 begin
    14
    15 select max(portf_id) into v_new_portf_id from portfolios;
    16
    17 insert into portfolios
    18 (portf_id,
    19 portf_cd,
    20 portf_name,
    21 portf_typ_cd,
    22 inception_date,
    23 sub_product_cd,
    24 product_cd,
    25 product_line_cd,
    26 bus_line_cd,
    27 dly_perf_restr_ind,
    28 portf_mgr_id,
    29 seed_acct_nbr,
    30 use_epas_ind,
    31 epas_drop_perf_ind,
    32 src_acct_nbr,
    33 src_fund_nbr,
    34 fmr_fund_nbr,
    35 src_cd,
    36 last_mod_id,
    37 last_mod_dt)
    38 values
    39 (new_portf_id,
    40 v_model_cd,
    41 v_portfolio_name,
    42 "RETAIL",
    43 v_inception_date,
    44 "FREE",
    45 "FREE",
    46 "FREE",
    47 "PAS",
    48 "Yes",
    49 3,
    50 "31635C101",
    51 "N",
    52 "Y",
    53 v_src_acct_nbr,
    54 v_src_fund_nbr,
    55 v_fmr_fund_nbr,
    56 v_src_cd,
    57 v_last_mod_id,
    58 sysdate);
    59
    60 end;
    61 /
    Warning: Procedure created with compilation errors.
    SQL> show errors procedure FOF_sport_setup
    Errors for PROCEDURE FOF_SPORT_SETUP:
    LINE/COL ERROR
    17/2 PL/SQL: SQL Statement ignored
    51/3 PL/SQL: ORA-00984: column not allowed here
    SQL>

    create or replace procedure FOF_sport_setup(
    v_model_cd in varchar2, -- model_cd used in many places for portf_id,
    v_portfolio_name in varchar2, -- portfolio name
    v_inception_date in varchar2,
    v_src_acct_nbr in varchar2, -- source account number for portfolio table in sport db
    v_src_fund_nbr in varchar2, -- source fund number
    v_fmr_fund_nbr in varchar2, -- fidelity fund number
    v_src_cd in varchar2, -- source code
    v_last_mod_id in varchar2 -- your corp id
    as
    v_new_portf_id number(12);
    begin
    select max(portf_id) into v_new_portf_id from portfolios;
    insert into portfolios
    (portf_id,
    portf_cd,
    portf_name,
    portf_typ_cd,
    inception_date,
    sub_product_cd,
    product_cd,
    product_line_cd,
    bus_line_cd,
    dly_perf_restr_ind,
    portf_mgr_id,
    seed_acct_nbr,
    use_epas_ind,
    epas_drop_perf_ind,
    src_acct_nbr,
    src_fund_nbr,
    fmr_fund_nbr,
    src_cd,
    last_mod_id,
    last_mod_dt)
    values
    (v_new_portf_id,
    v_model_cd,
    v_portfolio_name,
    'RETAIL',
    to_date('v_inception_date'),
    'FREE',
    'FREE',
    'FREE',
    'PAS',
    'Yes',
    3,
    '31635C101',
    'N',
    'Y',
    v_src_acct_nbr,
    v_src_fund_nbr,
    v_fmr_fund_nbr,
    v_src_cd,
    v_last_mod_id,
    sysdate);
    end;
    =====================
    The procedure got created without any errors, when i am trying to execute the procedure i am getting errors.
    this is the parameters which i am passing:
    exec FOF_sport_setup('01213', 'PAS International Fund of Funds', '2/15/2006', '01213', 'IFOFB', 'IFOFB', 'FPCMS', 'a382077')
    SQL> exec FOF_sport_setup('01213', 'PAS International Fund of Funds', '2/15/2006', '01213', 'IFOFB',
    'IFOFB', 'FPCMS', 'a382077')
    BEGIN FOF_sport_setup('01213', 'PAS International Fund of Funds', '2/15/2006', '01213', 'IFOFB', 'IF
    ERROR at line 1:
    ORA-01858: a non-numeric character was found where a numeric was expected
    ORA-06512: at "SPORT.FOF_SPORT_SETUP", line 15
    ORA-06512: at line 1
    ===============
    the description for the table is below
    ===========
    SQL> desc portfolios
    Name Null? Type
    PORTF_ID NOT NULL NUMBER(25)
    PORTF_CD VARCHAR2(10)
    PORTF_NAME VARCHAR2(60)
    STRATEGY_CD VARCHAR2(10)
    CO_STOCK_LEV_CD VARCHAR2(10)
    EFF_DATE DATE
    PORTF_WEB_NAME VARCHAR2(60)
    PORTF_TYP_CD VARCHAR2(10)
    INCEPTION_DATE DATE
    CLOSE_DATE DATE
    SUB_PRODUCT_CD VARCHAR2(10)
    PRODUCT_CD VARCHAR2(10)
    PRODUCT_LINE_CD VARCHAR2(10)
    BUS_LINE_CD VARCHAR2(10)
    BUS_GRP_CD VARCHAR2(10)
    PLAN_CD VARCHAR2(10)
    ADVISOR_CD VARCHAR2(10)
    RISK_LEVEL_CD VARCHAR2(10)
    DLY_PERF_RESTR_IND VARCHAR2(3)
    SUB_PORTF_IND CHAR(1)
    PORTF_MGR_ID NUMBER(25)
    SEED_ACCT_NBR VARCHAR2(9)
    OBJECTIVE VARCHAR2(255)
    PORTF_COMPOSITION_DESC VARCHAR2(50)
    LGL_GRP VARCHAR2(30)
    USE_EPAS_IND VARCHAR2(3)
    EPAS_MODEL_NAME VARCHAR2(50)
    EPAS_DROP_PERF_IND VARCHAR2(3)
    SRC_ACCT_NBR VARCHAR2(15)
    SRC_FUND_NBR VARCHAR2(6)
    FMR_FUND_NBR VARCHAR2(6)
    NET_ASSETS NUMBER(25,8)
    SEED_MKT_VAL NUMBER(25,10)
    ACCT_MKT_VAL NUMBER(25,10)
    TOTAL_ASSETS NUMBER(25,10)
    NET_OTHER_ASSETS NUMBER(25,8)
    ACCRUED_INCOME NUMBER(25,10)
    ACCRUED_INTEREST NUMBER
    LIABILITIES NUMBER(25,10)
    SHARES_OUTSTANDING NUMBER(25,10)
    PRINCIPAL_CASH NUMBER(25,10)
    INCOME_CASH NUMBER(25,10)
    INVESTIBLE_CASH NUMBER(25,10)
    SHIP_DATE DATE
    REBALANCE_IND CHAR(1)
    OUTBOUND_IND VARCHAR2(5)
    LGL_MSG_CD CHAR(1)
    LAST_SETTLE_DATE DATE
    LAST_TRD_DATE DATE
    LAST_ALLOC_DATE DATE
    STATUS_CD CHAR(1)
    SRC_CD NOT NULL VARCHAR2(5)
    LAST_MOD_ID NOT NULL VARCHAR2(10)
    LAST_MOD_DT NOT NULL DATE
    PORTF_MGD_CD VARCHAR2(10)
    ==========

  • Getting an error - group function not allowed here

    Below is the merge statement...
    getting an error - group function not allowed here
    WHY????
    merge into summary
    using
    (select
    a.user_id,
    min(a.start_time_utc),
    max(a.end_time_utc),
    sum(a.duration_seconds),
    /*total_upload
    total_download
    total_traffic,*/
    max(r.package_id),
    last_usage_charge, -------hard coded
    max(r.peak_rate),
    max(r.bst_plantype),
    max(r.free_value), ---for free value
    a.IsPeak,
    sum(a.TotalDiscount)
    from aaa_sessions a,rate_plan r,subscriber_info si
    where
    si.EXTERNAL_ID=a.USER_ID
    and
    si.PACKAGE_ID=r.PACKAGE_ID
    group by
    user_id,bst_plantype,ispeak)t ------do we need to use alias here
    on
    (summary.user_id=t.user_id
    and
    summary.type_of_summary=t.bst_plantype
    and
    summary.ispeak=t.ispeak)
    When matched then
    update
    set
    start_date =decode((t.start_time_utc-summary.start_date)-abs(t.start_time_utc-summary.start_date),0,summary.start_date,t.start_time_utc),
    end_date=decode((t.end_time_utc-summary.end_date)-abs(t.end_time_utc-summary.end_date),0,t.end_time_utc,s.end_date),
    total_duration=summary.total_duration+sum(duration_seconds),
    total_upload=summary.total_upload+sum(upload_bytes),
    total_download=summary.total_download+sum(download_bytes),
    total_traffic=summary.total_upload+sum(upload_bytes)+summary.total_download+sum(download_bytes)
    When not matched then
    INSERT
    (user_id ,
    start_date,
    end_date,
    total_duration,
    /*total_upload
    total_download
    total_traffic,*/
    rate_plan_id,
    last_usage_charge,
    peak_rate,
    type_of_summary,
    IsPeak,
    TotalDiscount)
    VALUES
    (t.user_id,
    t.start_time_utc,
    t.end_time_utc,
    t.duration_seconds,
    /*t.output_bytes,
    t.input_bytes,
    t.output_bytes+aa.input_bytes,*/
    t.PACKAGE_ID,
    1, ---hard coded the value
    t.PEAK_RATE,
    t.BST_PLANTYPE,
    t.ispeak,
    t.free_value);

    This is the query,...
    Its giving no complilation errors..
    I have not used aggregate functions in the insert/update..
    have used only decode...
    and nowhere i found that aggegate functions not allowed in the insert/update stmts of merge..
    Can u please post a link where it is mentioned...
    MERGE INTO summary
    USING (SELECT a.user_id, MIN (a.start_time_utc) stc,
    MAX (a.end_time_utc) etc, SUM (a.duration_seconds) ds,
    SUM (a.download_bytes) download,
    SUM (a.upload_bytes) upload, MAX (r.package_id) pkg_id,
    MAX (r.peak_rate) p_rate, MAX (r.offpeak_rate)
    ofp_rate,
    MAX (r.bst_plantype) plan_type,
    SUM (r.free_value) free_val, a.ispeak,
    MAX (r.peak_pulse) p_pulse,
    MAX (r.offpeak_pulse) ofp_pulse
    FROM aaa_sessions a, rate_plan r, subscriber_info si
    WHERE si.external_id = a.user_id
    AND si.package_id = r.package_id
    GROUP BY user_id, bst_plantype, ispeak) t
    ON ( summary.user_id = t.user_id
    AND summary.type_of_summary = t.plan_type
    AND summary.rate_plan_id = t.pkg_id
    AND summary.ispeak = t.ispeak)
    WHEN MATCHED THEN
    UPDATE
    SET start_date =
    DECODE ( (t.stc - summary.start_date)
    - ABS (t.stc - summary.start_date),
    0, summary.start_date,
    t.stc
    end_date =
    DECODE ( (t.etc - summary.end_date)
    - ABS (t.etc - summary.end_date),
    0, t.etc,
    summary.end_date
    total_duration = summary.total_duration + t.ds,
    total_download = summary.total_download + t.download,
    total_upload = summary.total_upload + t.upload,
    total_traffic =
    summary.total_upload
    + t.upload
    + summary.total_download
    + t.download,
    last_usage_charge =
    DECODE (t.plan_type,
    0, (t.ds - t.free_val)
    / DECODE (t.ispeak, 0, t.ofp_pulse, p_pulse)
    * DECODE (t.ispeak, 0, t.ofp_rate, t.p_rate),
    ((t.download + t.upload) - t.free_val
    * DECODE (t.ispeak, 0, t.ofp_rate, t.p_rate)
    WHEN NOT MATCHED THEN
    INSERT (user_id, start_date, end_date, total_duration,
    total_download, total_upload, total_traffic, rate_plan_id,
    last_usage_charge, peak_rate, type_of_summary, ispeak,
    totaldiscount)
    VALUES (t.user_id, t.stc, t.etc, t.ds, t.download, t.upload,
    t.download + t.upload, t.pkg_id,
    DECODE (t.plan_type,
    0, (t.ds - t.free_val)
    / DECODE (t.ispeak, 0, t.ofp_pulse, p_pulse)
    * DECODE (t.ispeak, 0, t.ofp_rate, t.p_rate),
    ((t.download + t.upload) - t.free_val
    * DECODE (t.ispeak, 0, t.ofp_rate, t.p_rate)
    t.p_rate, t.plan_type, t.ispeak, t.free_val);
    COMMIT;

  • ORA-04044: procedure, function, package, or type is not allowed here

    Hi,
    I am trying to build an object hierarchy.The object hirarcy is for a multi division, multi department, multi cost center and multi operation Organisation.Multiple department can store into multiple divisions, multiple cost center can store into multiple departments, multiple operations can store into multiple cost centers.
    The structure I try to built like this:
    create type div_obj_new as object
    (id number,
    divdesc varchar2(100)
    create type div_obj_tab as
    table of div_obj_new
    create type dept_obj_new as object
    (id number,
    deptdesc varchar2(100),
    dept_div number
    create type dept_obj_tab as
    table of dept_obj_new
    create type cctr_obj_new as object
    (id number,
    cctrdesc varchar2(100),
    cctr_dept number
    create type cctr_obj_tab as
    table of cctr_obj_new
    create type oper_obj_new as object
    (id number,
    operdesc varchar2(100),
    oper_cctr number
    create type oper_obj_tab as
    table of oper_obj_new
    ==========================
    create type div_obj_type as object
    (divid div_obj_tab)
    NOT FINAL
    create type dept_obj_type under div_obj_type
    (deptid dept_obj_tab)
    NOT FINAL
    create type cctr_obj_type under dept_obj_type
    (cctrid cctr_obj_tab)
    NOT FINAL
    create type oper_obj_type under cctr_obj_type
    (operid oper_obj_tab)
    NOT FINAL
    =======This Table creation is not working=================
    create table organisation
    (div div_obj_type,
    dept dept_obj_type,
    cctr cctr_obj_type,
    oper oper_obj_type)
    nested table div store as division_table
    nested table dept store as department_table
    nested table cctr store as costcntr_table
    nested table oper store as operation_table
    nested table oper store as operation_table
    ERROR at line 9:
    ORA-22912: specified column or attribute is not a nested table type
    =========================================================
    Then I try to insert record into the div_obj_type instead of organisation table as it was not working.
    The insert script is as follows:
    ===================================
    insert into div_obj_type values
    div_obj_tab
    (div_obj_new(01,'Division 01'),
    div_obj_new(02,'Division 02'),
    div_obj_new(03,'Division 03'),
    div_obj_new(04,'Division 04')
    dept_obj_tab
    dept_obj_new(10,'Department 10',1),
    dept_obj_new(11,'Department 11',1),
    dept_obj_new(12,'Department 12',2),
    dept_obj_new(13,'Department 13',3),
    dept_obj_new(14,'Department 14',4),
    dept_obj_new(15,'Department 15',5),
    dept_obj_new(16,'Department 16',6),
    dept_obj_new(17,'Department 17',7)
    cctr_obj_tab
    cctr_obj_new(100,'Cost Center 100',10),
    cctr_obj_new(101,'Cost Center 101',11),
    cctr_obj_new(100,'Cost Center 102',12),
    cctr_obj_new(100,'Cost Center 103',13),
    cctr_obj_new(100,'Cost Center 104',14),
    cctr_obj_new(100,'Cost Center 105',15),
    cctr_obj_new(100,'Cost Center 106',16),
    cctr_obj_new(100,'Cost Center 107',17),
    cctr_obj_new(100,'Cost Center 108',10),
    cctr_obj_new(100,'Cost Center 109',11),
    cctr_obj_new(100,'Cost Center 110',12)
    oper_obj_tab
    oper_obj_new(1000,'Operation 1000',100),
    oper_obj_new(1000,'Operation 1001',101),
    oper_obj_new(1000,'Operation 1002',102),
    oper_obj_new(1000,'Operation 1003',103),
    oper_obj_new(1000,'Operation 1004',104),
    oper_obj_new(1000,'Operation 1005',105),
    oper_obj_new(1000,'Operation 1006',106),
    oper_obj_new(1000,'Operation 1007',107),
    oper_obj_new(1000,'Operation 1008',108),
    oper_obj_new(1000,'Operation 1009',109),
    oper_obj_new(1000,'Operation 1010',110),
    oper_obj_new(1000,'Operation 1011',101),
    oper_obj_new(1000,'Operation 1012',102),
    oper_obj_new(1000,'Operation 1013',103),
    oper_obj_new(1000,'Operation 1014',104),
    oper_obj_new(1000,'Operation 1015',105),
    oper_obj_new(1000,'Operation 1016',106),
    oper_obj_new(1000,'Operation 1017',107),
    oper_obj_new(1000,'Operation 1018',108)
    insert into div_obj_type values
    ERROR at line 1:
    ORA-04044: procedure, function, package, or type is not allowed here
    Actually I want to create an object view or object table with all the details of division, department , cost center and operation and it will store depending upon the respective upper level hirarcy 's id.For eg. department details can be fetched through division id etc..
    So I can't figure out what to do for this kind of structure and how to do that.
    I am running Oracle Release 2 (9.2.0.1.0) for Windows 2000.
    Any help , advice or suggestions will be appreciated.
    Thanks & Regards
    Nihar

    Hi Cameron,
    Thanks for your great suggestion.Actually what you have suggested is correct and it was tested by me correctly.But actually I want to store records in the multiple objects hirarcy depending upon the respective upper level hirarcy 's id.For say how can I retrive all records related to divisionID which is in the top level hirarchy? So by selecting divisionID=01, how can I easily select all depts,cost centers and Operation details?
    Again I have another problem , when try to retrive record using PL/SQL I got some problem.
    Structure as created above.Again I am giving here.
    create type div_obj_new as object
    (id number,
    divdesc varchar2(100)
    create type div_obj_tab as
    table of div_obj_new
    create type dept_obj_new as object
    (id number,
    deptdesc varchar2(100),
    dept_div number
    create type dept_obj_tab as
    table of dept_obj_new
    create type cctr_obj_new as object
    (id number,
    cctrdesc varchar2(100),
    cctr_dept number
    create type cctr_obj_tab as
    table of cctr_obj_new
    create type oper_obj_new as object
    (id number,
    operdesc varchar2(100),
    oper_cctr number
    create type oper_obj_tab as
    table of oper_obj_new
    create table organisation
    (div div_obj_tab,
    dept dept_obj_tab,
    cctr cctr_obj_tab,
    oper oper_obj_tab)
    nested table div store as division_table
    nested table dept store as department_table
    nested table cctr store as costcntr_table
    nested table oper store as operation_table
    insert into organisation values
    div_obj_tab
    (div_obj_new(01,'Division 01'),
    div_obj_new(02,'Division 02'),
    div_obj_new(03,'Division 03'),
    div_obj_new(04,'Division 04')
    dept_obj_tab
    dept_obj_new(10,'Department 10',1),
    dept_obj_new(11,'Department 11',1),
    dept_obj_new(12,'Department 12',2),
    dept_obj_new(13,'Department 13',3),
    dept_obj_new(14,'Department 14',4),
    dept_obj_new(15,'Department 15',5),
    dept_obj_new(16,'Department 16',6),
    dept_obj_new(17,'Department 17',7)
    cctr_obj_tab
    cctr_obj_new(100,'Cost Center 100',10),
    cctr_obj_new(101,'Cost Center 101',11),
    cctr_obj_new(100,'Cost Center 102',12),
    cctr_obj_new(100,'Cost Center 103',13),
    cctr_obj_new(100,'Cost Center 104',14),
    cctr_obj_new(100,'Cost Center 105',15),
    cctr_obj_new(100,'Cost Center 106',16),
    cctr_obj_new(100,'Cost Center 107',17),
    cctr_obj_new(100,'Cost Center 108',10),
    cctr_obj_new(100,'Cost Center 109',11),
    cctr_obj_new(100,'Cost Center 110',12)
    oper_obj_tab
    oper_obj_new(1000,'Operation 1000',100),
    oper_obj_new(1000,'Operation 1001',101),
    oper_obj_new(1000,'Operation 1002',102),
    oper_obj_new(1000,'Operation 1003',103),
    oper_obj_new(1000,'Operation 1004',104),
    oper_obj_new(1000,'Operation 1005',105),
    oper_obj_new(1000,'Operation 1006',106),
    oper_obj_new(1000,'Operation 1007',107),
    oper_obj_new(1000,'Operation 1008',108),
    oper_obj_new(1000,'Operation 1009',109),
    oper_obj_new(1000,'Operation 1010',110),
    oper_obj_new(1000,'Operation 1011',101),
    oper_obj_new(1000,'Operation 1012',102),
    oper_obj_new(1000,'Operation 1013',103),
    oper_obj_new(1000,'Operation 1014',104),
    oper_obj_new(1000,'Operation 1015',105),
    oper_obj_new(1000,'Operation 1016',106),
    oper_obj_new(1000,'Operation 1017',107),
    oper_obj_new(1000,'Operation 1018',108)
    ===============
    declare
    div number;
    divdesc varchar2(100);
    divdetails varchar2(100);
    dept number;
    deptdesc varchar2(100);
    deptdetails varchar2(100);
    cctr number;
    cctrdesc varchar2(100);
    cctrdetails varchar2(100);
    oper number;
    operdesc varchar2(100);
    operdetails varchar2(100);
    cursor c_div is
    select d.id , d.divdesc from table(select div from organisation) d
    where d.id=1;
    --union
    cursor c_dept is
    select dp.id , dp.deptdesc "Dept Details" from table(select dept from organisation) dp
    where dp.dept_div=1;
    --union
    cursor c_cctr is
    select cc.id , cc.cctrdesc "Cctr Details" from table(select cctr from organisation ) cc
    where cc.cctr_dept=10;
    --union
    cursor c_oper is
    select op.id , op.operdesc "Oper Details" from table(select oper from organisation) op
    where op.oper_cctr=100;
    TYPE oper_type IS RECORD
    (oper_no NUMBER,
    oper_desc VARCHAR(50));
    TYPE cctr_type IS RECORD
    (cctr_no NUMBER,
    cctr_desc VARCHAR(50),
         oper_detl oper_type);
    TYPE dept_type IS RECORD
    (dept_no NUMBER,
    dept_desc VARCHAR(50),
         cctr_detl cctr_type);
    TYPE div_type IS RECORD
    (div_no NUMBER,
    div_desc VARCHAR2(50),
    dept_detl dept_type);
         division_rec div_type;
    begin
    for i_div in c_div%rowcount
         loop
         exit when c_div%notfound;
         division_rec.div_no:=i_div.id;
         division_rec.div_desc:=i_div.divdesc;
         dbms_output.put_line('Division details = ' || division_rec.div_no || division_rec.div_desc);
    --end loop;
    for i_dept in c_dept%rowcount
         loop
         exit when c_dept%notfound;
         select dp.id , dp.deptdesc ,
         into
         division_rec.dept_detl.dept_no, division_rec.dept_detl.dept_desc
         from
         table(select dept from organisation) dp
         where dp.dept_div=division_rec.div_no;
    -- division_rec.dept_detl.dept_no:=c_dept.id;
    -- division_rec.dept_detl.dept_desc:=c_dept.deptdesc;
         dbms_output.put_line('Department details = ' || division_rec.dept_detl.dept_no ||      
    division_rec.dept_detl.dept_desc);
    --end loop;
         for i_cctr in c_cctr
              loop
              exit when c_cctr%notfound;
              select cc.id , cc.cctrdesc
              into
              division_rec.dept_detl.cctr_detl.cctr_no ,           
    division_rec.dept==_detl.cctr_detl.cctr_desc
              from
              table(select cctr from organisation ) cc
              where cc.cctr_dept=division_rec.dept_detl.dept_no;
    -- division_rec.dept_detl.cctr_detl.cctr_no:=c_cctr.id;
    -- division_rec.dept_detl.cctr_detl.cctr_desc:=c_cctr.cctrdesc;
         dbms_output.put_line('Cost Center details = ' || division_rec.dept_detl.cctr_detl.cctr_no ||
         division_rec.dept_detl.cctr_detl.cctr_desc);
    --end loop;
              for i_oper in c_oper%rowcount
                   loop
                   exit when c_oper%notfound;
              select op.id , op.operdesc
              into
              division_rec.dept_detl.cctr_detl.oper_detl.oper_no,           
    division_rec.dept_detl.cctr_detl.oper_detal.oper_desc
              from
              table(select oper from organisation) op
              where op.oper_cctr=division_rec.dept_detl.cctr_detl.cctr_no;
    -- division_rec.dept_detl.cctr_detl.oper_detl.oper_no:=c_oper.id;
    -- division_rec.dept_detl.cctr_detl.oper_detal.oper_desc:=c_oper.operdesc;
         dbms_output.put_line('Operation details = ' ||
    division_rec.dept_detl.cctr_detl.oper_detl.oper_no ||
    division_rec.dept_detl.cctr_detl.oper_detal.oper_desc);
    end loop;
    end loop;
    end loop;
    end loop;
    end;
    for i_div in c_div%rowcount
    ERROR at line 46:
    ORA-06550: line 46, column 14:
    PLS-00999: implementation restriction (may be temporary)
    ORA-06550: line 46, column 1:
    PL/SQL: Statement ignored
    New version of PL/SQL bloc
    ==============================
    declare
    div number;
    divdesc varchar2(100);
    divdetails varchar2(100);
    dept number;
    deptdesc varchar2(100);
    deptdetails varchar2(100);
    cctr number;
    cctrdesc varchar2(100);
    cctrdetails varchar2(100);
    oper number;
    operdesc varchar2(100);
    operdetails varchar2(100);
    cnt_div number;
    cnt_dept number;
    cnt_cctr number;
    cnt_oper number;
    cursor c_div is
    select d.id , d.divdesc from table(select div from organisation) d
    where d.id=1;
    --union
    cursor c_dept is
    select dp.id , dp.deptdesc from table(select dept from organisation) dp
    where dp.dept_div=1;
    --union
    cursor c_cctr is
    select cc.id , cc.cctrdesc from table(select cctr from organisation ) cc
    where cc.cctr_dept=10;
    --union
    cursor c_oper is
    select op.id , op.operdesc from table(select oper from organisation) op
    where op.oper_cctr=100;
    TYPE oper_type IS RECORD
    (oper_no NUMBER,
    oper_desc VARCHAR(50));
    TYPE cctr_type IS RECORD
    (cctr_no NUMBER,
    cctr_desc VARCHAR(50),
         oper_detl oper_type);
    TYPE dept_type IS RECORD
    (dept_no NUMBER,
    dept_desc VARCHAR(50),
         cctr_detl cctr_type);
    TYPE div_type IS RECORD
    (div_no NUMBER,
    div_desc VARCHAR2(50),
    dept_detl dept_type);
         division_rec div_type;
    begin
    /*select count(*) into cnt_div from table(select div from organisation) d
    where d.id=1;*/
    for i_div in c_div
         loop
         exit when c_div%notfound;
         division_rec.div_no:=i_div.id;
         division_rec.div_desc:=i_div.divdesc;
         dbms_output.put_line('Division details = ' || division_rec.div_no || division_rec.div_desc);
    --end loop;
    /*select count(*) into cnt_dept from table(select dept from organisation) dp
    where dp.dept_div=i_div.id;*/
    for i_dept in c_dept
         loop
         exit when c_dept%notfound;
         select dp.id , dp.deptdesc
         into
         division_rec.dept_detl.dept_no, division_rec.dept_detl.dept_desc
         from
         table(select dept from organisation) dp
         where dp.dept_div=division_rec.div_no;
    -- division_rec.dept_detl.dept_no:=c_dept.id;
    -- division_rec.dept_detl.dept_desc:=c_dept.deptdesc;
         dbms_output.put_line('Department details = ' || division_rec.dept_detl.dept_no ||      division_rec.dept_detl.dept_desc);
    --end loop;
    /*select count(*) into cnt_cctr from table(select cctr from organisation ) cc
    where cc.cctr_dept=division_rec.dept_detl.dept_no;*/
         for i_cctr in c_cctr
              loop
              exit when c_cctr%notfound;
              select cc.id , cc.cctrdesc
              into
              division_rec.dept_detl.cctr_detl.cctr_no ,           division_rec.dept_detl.cctr_detl.cctr_desc
              from
              table(select cctr from organisation ) cc
              where cc.cctr_dept=division_rec.dept_detl.dept_no;
    -- division_rec.dept_detl.cctr_detl.cctr_no:=c_cctr.id;
    -- division_rec.dept_detl.cctr_detl.cctr_desc:=c_cctr.cctrdesc;
         dbms_output.put_line('Cost Center details = ' || division_rec.dept_detl.cctr_detl.cctr_no ||      division_rec.dept_detl.cctr_detl.cctr_desc);
    --end loop;
    /*select count(*) into c_oper from table(select oper from organisation) op
    where op.oper_cctr=division_rec.dept_detl.cctr_detl.cctr_no;*/
              for i_oper in c_oper
                   loop
                   exit when c_oper%notfound;
              select op.id , op.operdesc
              into
              division_rec.dept_detl.cctr_detl.oper_detl.oper_no,           division_rec.dept_detl.cctr_detl.oper_detl.oper_desc
              from
              table(select oper from organisation) op
              where op.oper_cctr=division_rec.dept_detl.cctr_detl.cctr_no;
    -- division_rec.dept_detl.cctr_detl.oper_detl.oper_no:=c_oper.id;
    -- division_rec.dept_detl.cctr_detl.oper_detl.oper_desc:=c_oper.operdesc;
         dbms_output.put_line('Operation details = ' || division_rec.dept_detl.cctr_detl.oper_detl.oper_no || division_rec.dept_detl.cctr_detl.oper_detl.oper_desc);
    end loop;
    end loop;
    end loop;
    end loop;
    end;
    declare
    ERROR at line 1:
    ORA-01422: exact fetch returns more than requested number of rows
    ORA-06512: at line 64
    I hope you might have the solutions.
    Thanks & Regards
    Nihar

  • Error while creating Notification: Partner Function is Not Allowed in Partner Determination Profile Q2

    During Notification Creation I get the error --Partner Function is Not Allowed in Partner Determination Profile Q2
    As I enter Purchase Document Number in the transaction QM01 and press Enter. I get the above error and donot go further.
    Can anyone help me here.

    Hello Prashant,
    You are missing some configuration for the partner function;
    Go- to
    SPRO>IMG>QM>Quality Notifications>Notification Creation>Partners>Define partner Determination Procedure>
    Again Select "Define Partner Determination Procedure".
    Select Quality management> Change Partner
    Now Select Q2.
    Compare settings with Partner Determination Procedure on any other client. Also check Partner functions on the same screen.
    Amol.

  • The storage location/batch function * is not defined here - Message no. M7116

    Hi Experts,
    we have a scenario - Project Subcontracting Purchase Order, Item Category - L and Account Assignment - Q.
    Delivery created, one of the component is Batch managed and  with Batch Spli Exists.
    When performing Good Receipt in MB01 t-code for movement type 543 R (Special Stock), batch determination fails for batch split scenarios; we get the following error message:
    The storage location/batch function * is not defined here:
    Message no. M7116
    The batch determination works fine, if the PO is with Item Category - L and Account assignment - Blank, then the movement type will be 543 O
    Steps for Reconstruction
    MB01, Mvt 101, enter SUBCON PO (Item Cat L and Account assignment
    Q), SL
    Delivery should have batch split
    for 101 Mvt, system determine the batch
    543 R Mvt should allow for wildcard search in batch field, the
    wildcard search works for other Mvt like 543 O.
    Note:
    we foresee we have to maintain an entry in OMCG for Movement type 543 and Special Stock R.
    543 o already exists there. But we are unable to Add/Delete any entry there.
    Please advise.
    Thanks and Regards,
    Nagaraja Achar.

    Hello Dennis,
    try the new transaction (MIGO): Use the 'Distribute qty' pushbutton. For all goods receipts (with or without special stock) it is possible to create several batches.
    Regards
    Michael

  • IDOC error 51- Function module not allowed:

    Hi,
    I am getting following error in IDOC inbouond.I verifyed all parameters mentioned in error.
    Issue still not resolved.
    When debugged from WE19 this issue dosnt arise.
    Kindly guide.
    Function module not allowed: ZIDOC_INPUT_MATCLASS
    Message no. B1252
    Diagnosis
    The function module ZIDOC_INPUT_MATCLASS and the application object type BUS1001 which were determined are not valid for this IDoc.
    Procedure
    1. Please check that the process code in the inbound partner profile is correct.
    2. If this is the case, you should check the ALE inbound methods ALE inbound methods for the process code and see whether the specified function module and application object type are correct.
    3. If this is also the case, then the function module and the application object type are not permitted for the logical message type, message variant, message function and basis type that are contained in the IDoc control record. You should check whether the correct values have been assigned to these fields in the control record. If they do have the correct values, then the assignment to the function module and the application object type needs to be maintained.

    Hi,
    Check in WE42, for the process code, you have assigned this function module and given the correct process code in the partner profile.
    Sujay

  • Idoc error 51 - "Function module not allowed - APPL_IDOC_INPUT1'

    Hello everyone,
    We are uploading GL balances from legacy to SAP using the LSMW Bapi
    object - bus6035
    method - post
    message type - ACC_DOCUMENT
    Basic type - ACC_DOCUMENT03
    When we run the lsmw, idoc is created, however with an error 51 saying
    "Function module not allowed - APPL_IDOC_INPUT1'
    The partner no. is the logical system (the system on which the lsmw is executed)
    In the partner profile, we have defined this as LS. In the inbound parameters, we have defined message type = ACC_DOCUMENT, the process code is APL1 and the corresponding function module is - APPL_IDOC_INPUT1
    Please let me know if we are missing something or doing anything wrong ?
    Since the data in the LSMW will be read frmo a file on the presentation server, do we need to have a port configuration for the same ?
    Thanks,
    Sushil Joshi`

    Hello Sushil
    The long text of message B1(252) is quite informative for error analysis:
    NA B1252
    Short Text
         Function module not allowed: &
    Diagnosis
         The function module  and the application object type  which were
         determined are not valid for this IDoc.
    Procedure
         1.  Please check that the process code in the  inbound partner profile
             is correct.
         2.  If this is the case, you should check the ALE inbound methods ALE
             inbound methods for the process code and see whether the specified
             function module and application object type are correct.
         3.  If this is also the case, then the function module and the
             application object type are not permitted for the logical message
             type, message variant, message function and basis type that are
             contained in the IDoc control record. You should check whether the
             correct values have been assigned to these fields in the control
             record. If they do have the correct values, then the assignment to
             the function module and the application object type needs to be
             maintained.
    On ECC 6.0 this long text contains 3 transactions for analysis:
    - WE20
    - BD67
    - WE57
    Regards
      Uwe

Maybe you are looking for

  • Attachments  in XI

    Hi Experts, I have a requirement to attach a pdf file. I refered to the blog below . How to send any data (even binary) through XI, without using the Integration Repository How to send any data (even binary) through XI, without using the Integration

  • Sort Components in task list

    Dear Friends, I have 20 different components [Assigned to a header assembly] connected to a single operation 010 in general task list. Now I have sorted this components based on Item number as the default sort is based on material criteria. After sor

  • How to take video on 3gs, how to take video on 3gs

    I dont know how to take video on 3gs and how to install skype for ios 4.1.

  • How can I save a long (166 in), narrow (9 in) PDF, as an unpaginated Tiff?

    How can I save a long (166 in), narrow (9 in) PDF, as an un-paginated Tiff?

  • Added a signature, all comments got erased!

    I added a signature to my eBook in Acrobat 11.0.03 for Mac. The eBook had about 20-30 hours of work in terms of comments. Adding a signature and saving the document on top of the original caused all the comments to be erased! This is a pretty ridicul