Help regarding Materialized view ( subquery expression not allowed here )

Hi all,
while creating materialized view i got following error
ORA- 22818
subquery expression not allowed here
following is my query
CREATE  MATERIALIZED VIEW MV_NAV_REC
BUILD IMMEDIATE
REFRESH COMPLETE ON DEMAND
as
select folio_no FOLIONO,CHKDIGIT as Check_Digit,sch_code SCHEMECODE, sysdate as FOLIODATE ,
     (select case when count(distinct SUBBROKERCODE) =1 then to_char(max(SUBBROKERCODE)) else 'Multiple Broker' end   from transaction_st
     where folio_no = tst.folio_no
     group by  folio_no)  ARN_Number ,
     (select sum(case when tran_type in ('PURCHASE','SWITCH IN') then UNITS else 0 - UNITS end ) from transaction_st
     where folio_no = tst.folio_no AND SCH_CODE = tst.sch_code
     group by  folio_no,sch_code)  NUM_UNITS_NEW ,
--SUM (case when tran_type NOT in ('REDEMPTION','SWITCH OUT') THEN UNITS ELSE 0 - UNITS END )  AS  Num_Units,
     (select sum(case when tran_type in ('PURCHASE','SWITCH IN') then AMOUNT else 0 - AMOUNT end ) from transaction_st
     where folio_no = tst.folio_no AND SCH_CODE = tst.sch_code
     group by  folio_no,SCH_CODE) as NUM_AMOUNT_NEW ,
--SUM (case when tran_type NOT in ('REDEMPTION','SWITCH OUT') THEN AMOUNT ELSE 0 -AMOUNT  END )  AS  Scheme_Amount,
sum(  CASE WHEN upper(tran_type) NOT in ('REDEMPTION','SWITCH OUT') THEN
             units * (select nav_rs from nav_rec where nav_rec.sch_code = tst.sch_code and nav_rec."Date" = /*trunc(sysdate)*/to_date('23/03/2009','dd/mm/yyyy'))
           ELSE  (0 - units) * (select nav_rs from nav_rec where nav_rec.sch_code = tst.sch_code and nav_rec."Date" = /*trunc(sysdate)*/to_date('23/03/2009','dd/mm/yyyy')) END  ) Scheme_Valuation ,
null as SCHEMEPHRASEID ,
null as "Prefered Mode of SOA",
(  select sum(      case when upper(tran_type) NOT in ('REDEMPTION','SWITCH OUT') THEN AMOUNT ELSE 0 - AMOUNT END  ) from transaction_st t where t.folio_no = tst.folio_no group by folio_no )  as Folio_Amount,
               select sum(CASE when upper(tran_type) NOT in ('REDEMPTION','SWITCH OUT') THEN
                                          units * ( select nav_rs from nav_rec where nav_rec.sch_code = ts.sch_code and nav_rec."Date" = /*trunc(sysdate)*/to_date('23/03/2009','dd/mm/yyyy'))
                              ELSE
                                  (0 - units) * ( select nav_rs from nav_rec where nav_rec.sch_code = ts.sch_code and nav_rec."Date" = /*trunc(sysdate)*/to_date('23/03/2009','dd/mm/yyyy')) END     
                              )  from transaction_st ts where ts.folio_no =tst.folio_no  group by ts.folio_no
) as Folio_Valuation
from transaction_st   tst 
group by folio_no ,sch_code,CHKDIGIT
order by folio_no , SCH_CODE
please help me

Hi,
You cannot use scalar subqueries in a materialized view.
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:4110947624538#22981269011674
edit
From 10g doc:
ORA-22818: subquery expressions not allowed here
Cause: An attempt was made to use a subquery expression where these are not supported.
Action: Rewrite the statement without the subquery expression.
(http://download.oracle.com/docs/cd/B19306_01/server.102/b14219/e19400.htm#sthref6020)
Edited by: hoek on Jun 10, 2009 7:56 AM

Similar Messages

  • Received ORA-22818 subquery expressions not allowed here when creating mate

    Hello,
    I was trying to create a materialized view to describe the referential integrity between the tables in my schema:
    create materialized view user_references
    tablespace tbspc
    build immediate
    using index
    refresh complete on demand next sysdate + 1
    as
    select uic.table_name to_table, uic.column_name to_column,
    ucc.table_name from_table, ucc.column_name from_column
    from user_ind_columns uic, user_constraints uc, user_cons_columns ucc
    where uic.index_name = uc.r_constraint_name
    and uc.constraint_name = ucc.constraint_name
    and uc.owner=upper('my_schema');
    I was able to create this MV in Oracle 9.2. It failed with the following error when I ran it against Oracle 10.1:
    from user_ind_columns uic, user_constraints uc, user_cons_columns ucc
    ERROR at line 9:
    ORA-22818: subquery expressions not allowed here
    Is not allowing subqueries in MV a new restriction in Oracle 10? Is there a workaround?
    Thanks

    Hello
    This may be a bug in your version as I can do it successfully on 10.2
    tylerd@DEV2> create materialized view user_references
      2  build immediate
      3  using index
      4  refresh complete on demand next sysdate + 1
      5  as
      6  select uic.table_name to_table, uic.column_name to_column,
      7  ucc.table_name from_table, ucc.column_name from_column
      8  from user_ind_columns uic, user_constraints uc, user_cons_columns ucc
      9  where uic.index_name = uc.r_constraint_name
    10  and uc.constraint_name = ucc.constraint_name
    11  and uc.owner=upper('my_schema');
    Materialized view created.
    tylerd@DEV2> select * from v$version
      2  /
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Prod
    PL/SQL Release 10.2.0.2.0 - Production
    CORE    10.2.0.2.0      Production
    TNS for 32-bit Windows: Version 10.2.0.2.0 - Production
    NLSRTL Version 10.2.0.2.0 - Production
    5 rows selected.HTH
    David

  • ORA-22818: subquery expressions not allowed here

    I am currently optimizing my report. Before, this report has only a single query for all. But when I have revised it having subquery it is performing much more faster. The problem is, I cannot perform a calculation on my query since subquery expressions are not allowed in 'group by'. Heres my sample report:
    SELECT     ab.batch_name,
    ai.invoice_amount,
    ai.invoice_date,
    ai.invoice_num,
    ai.invoice_id,
         (SELECT     pv.vendor_name
         FROM     apps.po_vendors pv
         WHERE     pv.vendor_id = ai.vendor_id)vendor_name,
         aid.distribution_line_number,
         SUM(aid.amount * (atc.tax_rate/100))amount,
         (SELECT     gcc.segment2
         FROM     apps.gl_code_combinations gcc
         WHERE     gcc.code_combination_id = aid.dist_code_combination_id)segment2,
         (SELECT     gcc.segment5
         FROM     apps.gl_code_combinations gcc
         WHERE     gcc.code_combination_id = aid.dist_code_combination_id)segment5      
    FROM     apps.ap_batches_all ab,
              apps.ap_invoices_all ai,
              apps.ap_invoice_distributions_all aid,
              apps.ap_awt_groups aag,
              apps.ap_tax_codes_all atc
    WHERE     ab.batch_id = ai.batch_id
              AND ai.invoice_id = aid.invoice_id
              AND aag.group_id = aid.awt_group_id
    GROUP BY ab.batch_name,
    ai.invoice_amount,
    ai.invoice_date,
    ai.invoice_num,
    ai.invoice_id,
         (SELECT     pv.vendor_name
         FROM     apps.po_vendors pv
         WHERE     pv.vendor_id = ai.vendor_id),
         aid.distribution_line_number,
         (SELECT     gcc.segment2
         FROM     apps.gl_code_combinations gcc
         WHERE     gcc.code_combination_id = aid.dist_code_combination_id),
         (SELECT     gcc.segment5
         FROM     apps.gl_code_combinations gcc
         WHERE     gcc.code_combination_id = aid.dist_code_combination_id)
    Can anyone advise on what to do? I really need the computation part but at the same time I would like to optimize my report using subqueries.

    You dont need to group by the actual inline SQL/sub-query but only the columns you used from the main query ( ie, aid.dist_code_combination_id, ai.vendor_id )
    You also have to make sure that the in-line SQL you are using will return not more than 1 row.
    Also, why not just use a normal join (or outer join if necessary)?

  • Materialized view ....subquery expression not allowed

    Hi,
    I have been assigned to create a materialized view using the following subquery.
    When I executed it is giving error ora-22818:subquery expressions not allowed here. The same query is good for view but not MV.
    Can anybody help me in writing MV for my query.
    select rownum as ROWNUMBER,f.id Folder_ID, concatyear(f.id) year_name,
    (select nvl(fr.requestor,fr.requested_by) from fts_folder_request fr where
    fr.folder_id=f.id and fr.status=0 ) Pending_Requestor,
    (select nvl(fr.requestor,fr.requested_by)
    from fts_folder_request fr,fts_folder_checkout_history fch where
    fr.folder_id=f.id and fch.folder_requested=fr.id and fch.return_date is null) CheckOut_To from fts_folder f;
    Thanks in advance.

    Any help in creating MV for my query.It contains subquery expressions that have to be avoided in MV.
    select rownum as ROWNUMBER,f.id Folder_ID, concatyear(f.id) year_name,
    (select nvl(fr.requestor,fr.requested_by) from fts_folder_request fr where
    fr.folder_id=f.id and fr.status=0 ) Pending_Requestor,
    (select nvl(fr.requestor,fr.requested_by)
    from fts_folder_request fr,fts_folder_checkout_history fch where
    fr.folder_id=f.id and fch.folder_requested=fr.id and fch.return_date is null) CheckOut_To from fts_folder f;
    Thanks.
    Message was edited by:
    user617694

  • ORA-22902 CURSOR expression not allowed Error Cause: CURSOR on a subquery..

    Hi,
    I found same issue in a metalink thread which is addressed in Oracle 12.1 which doesn't help me now. I need to rewrite the below query. Does anyone have any suggestions how to go about it?
    thanks,
    April
    working in Oracle 11.2.0.3.1, windows server, doing an upgrade from 10g to 11g. Piece of code is failing with following error via TOAD
    Oracle Database Error Code ORA-22902 Description :
    CURSOR expression not allowed
    Error Cause:
    CURSOR on a subquery is allowed only in the top-level SELECT list of a query.
    The below code is returning a tree of data for projects, units within the buildings.
    Code as follows:
    SELECT LEVEL
    , p.project_id
    || NVL (p.file_ref, ' ')
    || '] ['
    || NVL (p.project_ref, ' ')
    || '] '
    || p.project_name
    || ' ( '
    || (SELECT COUNT (*)
    FROM PROJECT p1
    WHERE p1.parent_project_id = p.project_id)
    || ' sub-projects, '
    || (SELECT COUNT (*)
    FROM PROJECT_ELEMENT pe2
    WHERE pe2.project_id = p.project_id)
    || ' elements)' AS project_description
    CURSOR
    (SELECT pe.element_id
    || pe.element_ref
    || '] '
    || pe.element_name
    || ' ('
    || pe.unit_count
    || ')' AS element_description
    CURSOR
    (SELECT hu.hu_id
    || hu.hu_ref
    || '] '
    || CASE
    WHEN hu.bedroom_count IS NOT NULL
    THEN ', Bedrooms: ' || hu.bedroom_count
    ELSE NULL
    END
    || CASE
    WHEN hu.bedspace_count IS NOT NULL
    THEN ', Bedspaces: ' || hu.bedspace_count
    ELSE NULL
    END AS hu_descripton
    FROM HOUSING_UNIT hu
    WHERE hu.element_id = pe.element_id
    ORDER BY hu.hu_ref
    ) AS housing_units
    FROM PROJECT_ELEMENT pe
    WHERE pe.project_id = p.project_id
    ORDER BY pe.element_ref, pe.element_name
    ) elements
    FROM PROJECT p
    START WITH p.project_id = l_root_project_id
    CONNECT BY PRIOR p.project_id = p.parent_project_id -- connect by used with LEVEL keyword
    ORDER SIBLINGS BY p.file_ref DESC
    , p.project_ref DESC
    , p.project_name DESC;
    Edited by: AprilM on Jul 17, 2012 10:28 AM

    Interesting. I am getting even worse results on 11.2.0.1.0:
    SQL> select * from v$version
      2  /
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL> select dname,cursor(select ename from emp e where e.deptno = d.deptno) from dept d
      2  /
    select dname,cursor(select ename from emp e where e.deptno = d.deptno) from dept d
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-00905: missing keyword
    SQL> connect scott
    Enter password: *****
    Connected.
    SQL> select * from v$version
      2  /
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
    PL/SQL Release 10.2.0.4.0 - Production
    CORE    10.2.0.4.0      Production
    TNS for 32-bit Windows: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    SQL> select dname,cursor(select ename from emp e where e.deptno = d.deptno) from dept d
      2  /
    DNAME          CURSOR(SELECTENAMEFR
    ACCOUNTING     CURSOR STATEMENT : 2
    CURSOR STATEMENT : 2
    ENAME
    CLARK
    KING
    MILLER
    RESEARCH       CURSOR STATEMENT : 2
    CURSOR STATEMENT : 2
    ENAME
    SMITH
    JONES
    SCOTT
    ADAMS
    FORD
    SALES          CURSOR STATEMENT : 2
    CURSOR STATEMENT : 2
    ENAME
    ALLEN
    WARD
    MARTIN
    BLAKE
    TURNER
    JAMES
    6 rows selected.
    OPERATIONS     CURSOR STATEMENT : 2
    CURSOR STATEMENT : 2
    no rows selected
    SQL> And double CURSOR also works fine in 10g:
    SQL> select cursor(select dname,cursor(select ename from emp e where e.deptno = d.deptno) from dept d) from dual
      2  /
    CURSOR(SELECTDNAME,C
    CURSOR STATEMENT : 1
    CURSOR STATEMENT : 1
    DNAME          CURSOR(SELECTENAMEFR
    ACCOUNTING     CURSOR STATEMENT : 2
    CURSOR STATEMENT : 2
    ENAME
    CLARK
    KING
    MILLER
    RESEARCH       CURSOR STATEMENT : 2
    CURSOR STATEMENT : 2
    ENAME
    SMITH
    JONES
    SCOTT
    ADAMS
    FORD
    SALES          CURSOR STATEMENT : 2
    CURSOR STATEMENT : 2
    ENAME
    ALLEN
    WARD
    MARTIN
    BLAKE
    TURNER
    JAMES
    6 rows selected.
    OPERATIONS     CURSOR STATEMENT : 2
    CURSOR STATEMENT : 2
    no rows selectedSY.
    Edited by: Solomon Yakobson on Jul 17, 2012 1:27 PM

  • SharePoint 2010 list view - How to filter on a multiline text box field - the view filter does not allow me to select it.

    Hi there,
    Does someone know in SharePoint 2010 list view - How to filter on a multiline text box field - the view filter does not allow me to select it.
    Thanks,

    Hi,
    Per my knowledge,
    it is by design that the data type multiple lines of text can only use “contains” and “begins with” operators.
    You can also filter the list view using SharePoint Designer,
    Open your list AllItem.aspx page in SPD ->click “Filter” > in “Field Name” select your multipe line of text field, in “Comparison” will displayed four choices.
    Best Regards,
    Lisa Chen
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • [Help] Signs are not allowed here

    Hello Expers,
    I am using ALV to change a value and the system telling me 'Signs are not allowed here'. The data type is DEC, length 13 with 2 Decimal places. I entered -1 to the field and the error message poped out. Can you help to solve my problem?
    Thanks in advance.

    Hi Alex,
    You will normally receive this error if your data type is Currency.
    Try changing the type and see if it works.
    If it doesnt, tell us which type (or table type) you are using.
    Regards
    Jovito.

  • I cannot open iCal because of a problem. Can anybody help me? The computer will not allow it to open and sends a message to apple each time. The icon has gone from the dock, but ical works on my iPad and I am afraid to sync it with my computer.?

    I cannot open iCal because of a problem. Can anybody help me? The computer will not allow it to open and sends a message to apple each time. The icon has gone from the dock, but ical works on my iPad and I am afraid to sync it with my computer in case it wipes everything .

    I have the exact same problem. I have not changed anything. This is probably a bug or something that has gone bad with Mac OS X (10.7.2). I have not found any solution for this on the web.
    MacBook Pro, Mac OS X (10.7.2).

  • Help on Materialized view

    Hi all ,
    I need some help on materialized view. I have to make a MV in dbms_dtm schema
    I have 2 tables like below
    sales and orduct
    salescolumns: salesid,prodid,subid,charges
    and product columns: subid and billid
    sales.subid = product.subid.
    i need a materialized view for this columns salesid,prodid,sum(charges),count(subid) and billid in dbms_dtm.
    have to create another materialized view for below tables
    order and ordertype
    order columns: orderstaus,ordertype,address,ordertypeid
    ordertype columns: ordername,subordername,ordertypeid
    order.ordertypeid = ordertype.ordertypeid
    need a materialized view for columns orderstaus,orderstaus,ordertype,address,ordername,subordername and granularity for this cloumns.
    please some give me some guidens on this issue
    Thanks in advance

    You should read chapters 8 & 9 of the Data Warehousing Guide:
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28313/basicmv.htm
    Just saying "you need a materialized view" doesn't provide enough information on what you need or how you plan to use it.

  • Subquery is not allowed within FILTER arguments

    In a report I need to show two columns of same type but with values obtained with different criterias.
    The criterias are difined in 2 different reports
    Report
    Month, ColumnA , ColumnB, Number_of_Nights
    ColumnA refers to the actual column Member_id= criteria are defined with REPORT1 (where joined date between X and Y and market code=Z)
    ColumnB refers to the actual column Member_id=criteria are defined with REPORT2 (where joined date between A and B and market code=C)
    I can not use on ColumnA the normal filter and than filter based on results from another request, because it would apply to columnB as well.
    I need therefore to use the filter from the "Edit Formula" screen and than filter on a column and select REPORT1 for ColumnA and REPORT2 for ColumnB.
    This approach doesn't seem to work because I return :
    [nQSError: 10058] A general error has occurred. [nQSError: 22033] Subquery is not allowed within FILTER arguments. (HY000)
    How do you manage such reports?
    Thanks!!
    Edited by: user6185307 on 14.05.2012 06:00
    Edited by: user6185307 on 14.05.2012 06:01
    Edited by: user6185307 on 14.05.2012 06:02

    Try creating the report in one go...
    Instead of creating a subquery, and then a subquery using that subquery, and finally a "master" query, create the "master" query first, and within the conditions, create your subquery as you go along.
    I'm not sure whether this would work, as I don't currently have access to Discoverer!
    Alternatively, subqueries are rarely the most efficient way of processing information, so consider writing a PL/SQL function to do some of the work for you.

  • ORA-01733- virtual column not allowed here  - Insert using inline view

    Does anyone know why I am getting ORA-01733- virtual column not allowed here
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE 11.1.0.6.0 Production
    TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    ---no error without WITH CHECK option
    SQL> INSERT INTO
    2 (SELECT
    3 location_id,
    4 city,
    5 l.country_id
    6 FROM countries c, locations l,regions r
    7 where l.country_id = c.country_id
    8 and r.region_id=c.region_id
    9 and r.region_name = 'Asia')
    10 VALUES (5500, 'Wansdworth Common', 'UK');
    1 row created.
    SQL> rollback;
    Rollback complete.
    -----error with WITH CHECK OPTION
    SQL> INSERT INTO
    2 (SELECT
    3 location_id,
    4 city,
    5 l.country_id
    6 FROM countries c, locations l,regions r
    7 where l.country_id = c.country_id
    8 and r.region_id=c.region_id
    9 and r.region_name = 'Asia' WITH CHECK OPTION)
    10 VALUES (5500, 'Wansdworth Common', 'UK');
    INSERT INTO
    ERROR at line 1:
    ORA-01733: virtual column not allowed here
    I was expecting
    ORA-01402: view WITH CHECK OPTION where-clause violation
    for the second one. Is there anything I am missing here ?

    Randolf
    Thank you very much for the update to this old question
    After reading the link I think I should ignore this error and accept it as ORA-01402
    The information you asked me to check did not lead me an understanding of different error types.
    SQL> ----view for ORA-01733
    SQL> create view test_v_1
      2  as
      3  SELECT
      4  location_id,
      5  city,
      6  l.country_id
      7  FROM countries c, locations l,regions r
      8  where l.country_id = c.country_id
      9  and r.region_id=c.region_id
    10  and r.region_name = 'Asia' WITH CHECK OPTION;
    View created.
    SQL>
    SQL>
    SQL>
    SQL> select * from user_updatable_columns where table_name='TEST_V_1';
    OWNER                          TABLE_NAME                     COLUMN_NAME                    UPD INS DEL
    HR                             TEST_V_1                       CITY                           YES YES YES
    HR                             TEST_V_1                       COUNTRY_ID                     NO  NO  NO
    HR                             TEST_V_1                       LOCATION_ID                    YES YES YES
    SQL>
    SQL> ----view for ORA-01402
    SQL>
    SQL> create view test_v_2
      2  as
      3  SELECT
      4  d.department_id,
      5  d.department_name,
      6  d.location_id
      7  FROM hr.departments d,hr.locations l
      8  WHERE l.location_id=d.location_id
      9  and d.location_id < 2000
    10  WITH CHECK OPTION;
    View created.
    SQL>
    SQL> select * from user_updatable_columns where table_name='TEST_V_2';
    OWNER                          TABLE_NAME                     COLUMN_NAME                    UPD INS DEL
    HR                             TEST_V_2                       DEPARTMENT_ID                  YES YES YES
    HR                             TEST_V_2                       DEPARTMENT_NAME                YES YES YES
    HR                             TEST_V_2                       LOCATION_ID                    NO  NO  NO
    SQL>
    SQL>
    SQL> ----INSERT STILL FAILING WITH DIFFERENT ERROR DESPITE THE SAME UPDATABLE COLUMN STRUCTURE
    SQL> insert into test_v_1 values  (5500, 'Wansdworth Common', 'UK');
    insert into test_v_1 values  (5500, 'Wansdworth Common', 'UK')
    ERROR at line 1:
    ORA-01733: virtual column not allowed here
    SQL> insert into test_v_2 values  (9999, 'Entertainment', 2500);
    insert into test_v_2 values  (9999, 'Entertainment', 2500)
    ERROR at line 1:
    ORA-01402: view WITH CHECK OPTION where-clause violation
    SQL>A. Coskan GUNDOGAR
    Oracle DBA
    http://coskan.wordpress.com
    “A man's errors are his portals of discovery.”
    James Joyce

  • ORA-00984 Column not allowed here. Please help.

    Hey, I have made a table;
    CREATE TABLE Borrower (
    BorId VARCHAR2(5) NOT NULL,
    BorName VARCHAR2(20),
    BorMaxBooks NUMBER(10),
    PRIMARY KEY (BorId));
    I am trying to enter values into this table;
    INSERT INTO Borrower VALUES (
    001, "Jack Jones", 5);
    And I get an error; ORA-00984 Column not allowed here. Please can anyone help?? I have tried changing BorName VARCHAR2(20) to BorName CHAR(20) and everything I can think of.

    Hi sorry to bother you again but is it the same method as in MySQL to enter multiple data at once?
    I am trying to save time by entering all the contents of a table all at once,
    Would it be;
    INSERT INTO Borrower (BorId, BorName, BorMaxBooks) VALUES (
    (001, 'Bob', 4),
    (002, 'James', 5),
    (003, 'Dave', 6);
    Thanks.

  • Help - error : ORA-00984: Column not allowed here

    Hi,
    I'm writing a simple Java program to update values into Oracle tables. But getting error - 'ORA-00984: Column not allowed here' in the line - sql2.executeUpdate(acctTabSql);
    There is no column name used in 'insert statement - and referred suggestion here to resolve the error, but couldn't. Please write me how to resolve it. ?
    Here is the code snippet below.
    Thanks, Vasu
    T_ACCT
    ACCT_ID (PK) GEN INTEGER
    ALS_NBR:STRING
    STATUS_CD:STRING
    NOTE_DT:DATE
    int intVal1 = 0;
              int intVal2 = 0;
              Statement sql1 = oraConnection.createStatement();
              ResultSet rs = sql1.executeQuery("SELECT ACCT_ID_SEQ.NEXTVAL, APPL_ID_SEQ.NEXTVAL FROM DUAL");
              while(rs.next()){
              intVal1 = rs.getInt(1);
              intVal2 = rs.getInt(2);
              System.out.println("ACCT_ID :" + intVal1);
              System.out.println("APPL_ID :" + intVal2);
              sql1.close();
              Statement sql2 = oraConnection.createStatement();
              String acctTabSql = "INSERT INTO VPDBO.T_ACCT (ACCT_ID, ALS_NBR, NOTE_DT, HELMS_NBR, SL_REF_NBR, BK_MSG_RECEIVED_DT) " +
                        "VALUES (intVal1,'' ,'' ,'' ,'' ,'' )";
              System.out.println(acctTabSql);
    -/Error/-     sql2.executeUpdate(acctTabSql);
              sql2.close();
              Statement sql3 = oraConnection.createStatement();
              String applTabSql = "INSERT INTO T_APPL (APPL_ID, ACAPS_ID, STATUS_CD, ACAPS_PROD_CD, ACCT_ID, DCAPP_MSG_RECEIVED_DT) " +
                        "VALUES (intVal1, valappIdValue, 'EN', '', intVal2, '08/26/09')";
              System.out.println(applTabSql);
              sql3.executeUpdate(applTabSql);
              sql3.close();
              oraConnection.commit();

    Hi,
    make sure final statement is like :
    INSERT INTO VPDBO.T_ACCT (ACCT_ID, ALS_NBR, NOTE_DT, HELMS_NBR, SL_REF_NBR, BK_MSG_RECEIVED_DT)
    VALUES(intVal1,NULL,NULL,NULL,NULL,NULL)instead of
    String acctTabSql = "INSERT INTO VPDBO.T_ACCT (ACCT_ID, ALS_NBR, NOTE_DT, HELMS_NBR, SL_REF_NBR, BK_MSG_RECEIVED_DT) " +
    "VALUES (intVal1,'' ,'' ,'' ,'' ,'' )";Cheers,
    Avin ash

  • Sequence Number does not allowed here

    Hi,
    I am inserting rows in a table called membership with seqence number membership_id.nextval. But i am getting error like
    "Sequence number not allowed here"
    Before i inserted about 3852 rows in that table
    Here is the statement i am using
    INSERT INTO MEMBERSHIP (membership_id,ACTIVIST_ID,G_N_ID,ROLE_ID,
    REGION_ID,START_dATE,END_DATE,STATUS,state_id)
    SELECT membership_id.nextval,a.activist_id,G.g_n_id,R.ROLE_ID,
    '',mwlgmemship.start_date,'','Active',''
    FROM activist a,
    role r,
    group_network g,
    final.mwlgmemship mwlgmemship,final.mwlgmem mwlgmem
    WHERE
    a.first_name=mwlgmem.fname and a.last_name=mwlgmem.lname and a.c_zip_code=mwlgmem.czip and
    a.c_country=mwlgmem.country and mwlgmem.person_id=mwlgmemship.person_id and
    to_char(mwlgmemship.grno)=g.g_n_reference and mwlgmemship.role_id=r.role_id order by r.role_id
    I could not understand the problem, please help me
    I am selecting the other fields from other tables.
    Thanks
    Srinivas

    Restrictions on Sequence Values You cannot use CURRVAL and NEXTVAL in the following constructs:
    A subquery in a DELETE, SELECT, or UPDATE statement
    A query of a view or of a materialized view
    A SELECT statement with the DISTINCT operator
    A SELECT statement with a GROUP BY clause or ORDER BY clause
    A SELECT statement that is combined with another SELECT statement with the UNION, INTERSECT, or MINUS set operator
    The WHERE clause of a SELECT statement
    The DEFAULT value of a column in a CREATE TABLE or ALTER TABLE statement
    The condition of a CHECK constraintAbove text is from the sql reference manual.
    HTH
    Regards
    Raj

  • Virtual Column not allowed here Error

    Hi All,
    I am facing "Virtual Column not allowed here" Error when running a simple select statement. I have identified that if I am removing a primary key constraint and an index on top of month table which is used in the SQL solving this issue. But want to know the exact reason of this error. FYI I am having two indexes on Month_end_date_key (which is also a primary key) and Month_end_date. Could you please let me know the reason for this.
    FYI I am not doing any insert,update deletion operations. I am using only the tables in the SQL not using any views.
    Regards,
    Radhakrishna

    924486 wrote:
    Hi All,
    I am facing "Virtual Column not allowed here" Error when running a simple select statement. I have identified that if I am removing a primary key constraint and an index on top of month table which is used in the SQL solving this issue. But want to know the exact reason of this error. FYI I am having two indexes on Month_end_date_key (which is also a primary key) and Month_end_date. Could you please let me know the reason for this.
    FYI I am not doing any insert,update deletion operations. I am using only the tables in the SQL not using any views.
    Regards,
    RadhakrishnaAre you sure none of those is a view?
    Cause:     An attempt was made to use an INSERT, UPDATE, or DELETE statement on an expression in a view.
    Action:     INSERT, UPDATE, or DELETE data in the base tables, instead of the view.

Maybe you are looking for