materialized view ora-00907, although sql query works well

Hello

It seems to be a bug with db oracle 10.2.0.1 and his prod. env, I can't apply the patch quickly, can anyone give me a tip

CREATE THE MV_TEN MATERIALIZED VIEW
BUILDING THE INDEX REFRESH IMMEDIATE TO COMPLETE ON DEMAND HELP
AS
SELECT ten.tcy_refno AS TENANCY_REF,
Rev.rac_accno AS REV_ACC_NO,
Rev.rac_last_aba_date AS LAST_ABA_DATE,
Rev.rac_last_aba_balance AS LAST_ABA_BALANCE,
AAA.aca_status AS ARREARS_STATUS,
AAA.aca_ara_code AS ARREARS_ACTION_CODE,
AAA.aca_effective_date AS EFFECTIVE_DATE,
AAA.aca_balance AS ACCOUNT_BALANCE,
ARA.ara_description AS ARREARS_DESCRIPTION,
NPA.nop_text
OF REVENUE@remotedb rev.
Ten TENANCT@remotedb.
ACCOUNT_ARREARS_ACTIONS@remotedb aaa
LEFT OUTER JOIN ARREARS_ACTIONS@remotedb ara
ON aaa.aca_ara_code = ara.ara_code
LEFT OUTER JOIN NOTEPADS@remotedb IR
ON aaa.aca_reusable_refno = npa.nop_reusable_refno
WHERE ten.tcy_refno = rev.rac_tcy_refno
AND rev.rac_end_date IS NULL
AND rev.rac_accno = aaa.aca_rac_accno
AND aaa.aca_status! = "DEL".
AND npa.nop_current_ind = 'Y ';

ORA-00907: missing just paraenthesis


Thank you

See

http://asktom.Oracle.com/pls/asktom/f?p=100:11:4226402560732847:P11_QUESTION_ID:6585774577187

Tags: Database

Similar Questions

  • The Materialized View - ORA-12052: is unable to fast refresh materialized view

    Hello

    I was hitting my head all day trying to create materialized views. I have made some progress, but have hit a brick wall, unfortunately!

    Basically, I have been invited to take a view and see if I can get the benefits of performance by transforming all or part of it in materialized views. Because the underlying tables of the config is updated quite frequently, I want to fast refresh materialized views on commit. However, when I try to create a materialized view containing an outer join in an aggregated materialized view table, I get ORA-12052: is unable to fast refresh materialized view.

    I went through the documentation and also Rob van Wijkvery useful series of blogs on the topic (especially http://rwijk.blogspot.co.uk/2009/09/fast-refreshable-materialized-view.html) but have not found anything that matches. Maybe I missed something somewhere along the line, or maybe I'm asking just something completely impossible?

    My db is 11.2.0.2.

    Here's the test scripts, I've worked with that:

    drop materialized view test1_test2_mv;
    Drop materialized view test2 journal;
    drop table test2;
    Drop materialized view test1_mv newspaper;
    drop materialized view test1_mv;
    Drop materialized view test1 journal;
    drop table test1;

    create table test1 (identification number,
    type varchar2 (10),
    number of Val,
    update_time date,
    constraint t1_pk primary key (id, type, val));

    Insert into test1
    Select 1, 'a', 1001, sysdate - 10/24 Union double all the
    Select 1, 'b', 1003, sysdate - 9/24 Union double all the
    Select 1, 'c', 1002, sysdate - 8/24 Union double all the
    Select 1, had ', 1004, sysdate - 7/24 Union double all the
    Select 1, 'e', 1005, sysdate - 6/24 Union double all the
    Select 1, 'c', 1006, sysdate - 5/24 Union double all the
    Select 2, 'a', 1002, sysdate - 4/24 Union double all the
    Select 2, 'b', 1005, sysdate - 3/24 Union double all the
    Select 3, 'a', 1001, sysdate - 2/24 Union double all the
    Select 3, 'c', 1006, sysdate - 1/24 Union double all the
    Select 3, 'e', 1008, sysdate - 2/24 Union double all the
    Select option 4, has ', 1004, sysdate - 3/24 Union double all the
    Select 5, 'b', 1002, sysdate - 4/24 Union double all the
    Select 5, 'g', 1001, sysdate - 5/24 Union double all the
    Select 6, 'h', 1004, sysdate - 6/24 Union double all the
    Select 7, 'b', 1007, sysdate - 7/24 Union double all the
    Select 7, had ', 1001, sysdate - 8/24 double;

    commit;

    Select * from test1;


    CREATE MATERIALIZED VIEW LOG ON test1
    WITH rowid, primary key (update_time)
    including the new values;


    Test1_mv CREATE MATERIALIZED VIEW
    IMMEDIATE CONSTRUCTION
    COOL OFF QUICKLY ON COMMIT
    Did YOU SELECT id,
    MAX (case when type = "there" end of val) THAT col_a,.
    MAX (case when type = 'b', then val end) AS col_b,.
    MAX (case when type = 'c' then end val) AS col_c,.
    MAX (case when type = ' then end of val) AS col_d,
    MAX (update_time) AS update_time
    OF test1
    WHERE TYPE in ('a',
    « b »,
    « c »,
    a ')
    GROUP BY id;

    CREATE MATERIALIZED VIEW LOG ON test1_mv
    WITH rowid
    including the new values;


    create table test2 (identification number,
    col2 number,
    COL3 varchar2 (10),
    number of COL4,
    constraint t2_pk primary key (id));

    Insert into test2
    Select 1, 1, 'bob', 1 double Union all
    Select 2, 1, "sue", 1 double Union all
    Select 3, 1, 'tom', 1 double Union all
    Select 4, 1, 'jay', 1 double Union all
    Select 5, 1, 'art', 1 double Union all
    Select 6, 1, 'kay', 1 double Union all
    Select 7, 1, 'max', 1 double Union all
    Select 8, 1, 'tim', 1 double Union all
    Select 9, 1, "liz", 1 from dual;

    commit;


    CREATE MATERIALIZED VIEW LOG ON test2
    WITH rowid, primary key
    including the new values;


    Test1_test2_mv CREATE MATERIALIZED VIEW
    IMMEDIATE CONSTRUCTION
    COOL OFF QUICKLY ON COMMIT
    LIKE SOME t2.rowid,.
    T1.ID,
    T1.col_a,
    T1.col_b,
    T1.col_c,
    T1.col_d,
    T1.update_time,
    T2.col2,
    T2. COL3
    OF test1_mv t1,.
    Test2 t2
    WHERE (+) t1.id = t2.id; -symbol of outer join is not correctly displayed on the forums without space, grr!

    ORA-12052: is unable to fast refresh materialized view TEST1_TEST2_MV

    Y at - it any way I can get the materialized view fast refresh on commit or I asking the impossible?

    Add t1.rowid:

    SQL > CREATE MATERIALIZED VIEW test1_test2_mv

    2 BUILD IMMEDIATE

    3 QUICK REFRESH YOU COMMIT

    4 AS t2.rowid SELECT rid2,

    5 t1.rowid rid1,

    6 t1.id

    T1.col_a 7,.

    T1.col_b 8,.

    T1.col_c 9,.

    T1.col_d 10,

    T1.update_time 11,

    T2.col2 12,

    13 t2.col3

    14 OF test1_mv t1,

    15 test2 T2

    16 WHERE t1.id = t2.id

    17.

    Materialized view created.

    SQL > select * from test1_test2_mv

    2.

    RID2 RID1 ID COL_A, COL_B, COL_C COL_D UPDATE_TIME COL2 COL3

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

    AAAYB6AANAAAANDAAA AAAYB/AANAAAAN/AAA 1 1001 1003 1006 1004 25 / 06 / 2014 12:54:16 1 bob

    AAAYB6AANAAAANDAAB AAAYB/AANAAAAN/AAB 2 1002 1005 25 / 06 / 2014 1 sue 14:54:16

    AAAYB6AANAAAANDAAC AAAYB/AANAAAAN/AAC 3 1001 1006 25 / 06 / 2014 16:54:16 1 tom

    AAAYB/AANAAAAN/AAD AAAYB6AANAAAANDAAD 4 1004 25/06/2014 14:54:16 1 jay

    AAAYB6AANAAAANDAAE AAAYB / AANAAAAN / AAE 5 1002 2014/06/25 13:54:16 1 art

    AAAYB6AANAAAANDAAF AAAYB/AANAAAAN/AAG 7 1007 1009 25 / 06 / 2014 10:54:16 max 1

    AAAYB/AANAAAAN/AAH                                                                                                        1 tim

    AAAYB/AANAAAAN/AAF                                                                                                        1 kay

    AAAYB/AANAAAAN/AAI                                                                                                        1 liz

    9 selected lines.

    SQL > update of test2

    2 set col3 = "fly."

    3 where id = 7

    6 m

    1 line update.

    SQL > validation

    2.

    Validation complete.

    SQL > select * from test1_test2_mv

    2.

    RID2 RID1 ID COL_A, COL_B, COL_C COL_D UPDATE_TIME COL2 COL3

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

    AAAYB6AANAAAANDAAA AAAYB/AANAAAAN/AAA 1 1001 1003 1006 1004 25 / 06 / 2014 12:54:16 1 bob

    AAAYB6AANAAAANDAAB AAAYB/AANAAAAN/AAB 2 1002 1005 25 / 06 / 2014 1 sue 14:54:16

    AAAYB6AANAAAANDAAC AAAYB/AANAAAAN/AAC 3 1001 1006 25 / 06 / 2014 16:54:16 1 tom

    AAAYB/AANAAAAN/AAD AAAYB6AANAAAANDAAD 4 1004 25/06/2014 14:54:16 1 jay

    AAAYB6AANAAAANDAAE AAAYB / AANAAAAN / AAE 5 1002 2014/06/25 13:54:16 1 art

    AAAYB/AANAAAAN/AAH                                                                                                        1 tim

    AAAYB/AANAAAAN/AAF                                                                                                        1 kay

    AAAYB/AANAAAAN/AAI                                                                                                        1 liz

    AAAYB6AANAAAANDAAF AAAYB/AANAAAAN/AAG 7 1007 1009 25 / 06 / 2014 10:54:16 1 rob

    9 selected lines.

  • Find the name of the view based on a sql query

    Can anyone suggest me how to find the name of the view based on a sql query? When I try to the following select statement:
    select view_name from user_views where text like '%SELECT * from TABLE%';
    but I get this error:
    SQL Error: ORA-00932: inconsistent datatypes: expected NUMBER got LONG
    00932. 00000 -  "inconsistent datatypes: expected %s got %s"
    But as I notice that the TEXT column is really LONG to type... Are there any other table system that store information about the text using each view?

    See this example, using DBMS_METADATA. GET_DDL:

    Re: Search text in column

  • Problem with the materialized view (ORA-02345)

    Hello

    I am trying to create a view materialized, based on the following function:

    CREATE OR REPLACE function RBS_USER.dynamic_pivot return sys_refcursor
    as
    sql_query varchar2(8000);
    p_cursor sys_refcursor;
    
    
    begin
        for x in (select distinct report_mm from UC_SOURCE_CUR_ACCT_CLASSIF order by 1)
        loop
            sql_query := sql_query || '''' || x.report_mm || ''' as "' || to_char(x.report_mm,'mm/dd/yyyy') || '", ';
        end loop;
    
    
        sql_query := 'select * from (
           select UC_BUSINESS_TYPE, PRODUCT_PORTFOLIO, REVENUE, REPORT_MM FROM UC_SOURCE_CUR_ACCT_CLASSIF
        )
        pivot
        (
           sum(revenue)
           for report_mm in (' || substr(sql_query,1,length(sql_query)-2) || '))';
    
    
        open p_cursor for sql_query;
        return p_cursor;
    end;
    
    

    I'm getting ORA-02345: cannot create a view with column based on CURSOR operator.

    How can I re - write the code in order to to use to generate a materialized view?

    Perhaps using a PIPELINED function? But the problem is that I don't know beforehand the return type that it can vary (based on a range of months in the UC_SOURCE_CUR_ACCT_CLASSIF table, which does not.

    Thank you

    M.R.

    I'm getting ORA-02345: cannot create a view with column based on CURSOR operator.

    How can I re - write the code in order to to use to generate a materialized view?

    You can't - a slider is PL/SQL, SQL not and has all the data.

    Perhaps using a PIPELINED function? But the problem is that I don't know beforehand the return type that it can vary (based on a range of months in the UC_SOURCE_CUR_ACCT_CLASSIF table, which does not.

    Then explain how a materialized view THAT REFRESH could possibly work if the return type could change after the MV was last refreshed?

    You should base a MV on real data such as returned by a SQL query.

  • need help on the name of the column in double materialized view ORA-00957

    I have a query, long enough and several (8ways) joins.

    When I run it as a SQL query, it is fine.

    When I add create materialized, view myViewName it errors with
    ORA-00957: duplicate column name.

    How is there is no problem when executing the SQL statement, and how to fix this?

    Thank you.

    Hello

    Columns in a query do not need a unique name:

    SELECT     dummy
    ,     dummy
    FROM     dual;
    
    D D
    - -
    X X
    

    At least not in SQL * Plus; other front ends might oppose it.
    In previous versions of Oracle, subqueries (such as online views) does not need to have unique names, but you've got an error if you tried to reference a non-unique column (and it is unnecessary to have the column if never reference you).

    Columns in a table or a view need unique names:

    CREATE OR REPLACE VIEW view_x
    AS
    SELECT     dummy
    ,     dummy
    FROM     dual;
    
    ,     dummy
          *
    ERROR at line 4:
    ORA-00957: duplicate column name
    
  • Cannot create Materialized View using the PL/SQL procedure

    Hello

    I have a question related to the creation of materialized view.
    I have a stored procedure that creates the materialized view. When you try to perform this procedure, I get not enough privileges error: ORA-01031.

    When I run the content of this procedure as a PL/SQL block anonymous their materialized view is created without any complications.
    Can you please advice me on this subject?
    It is even possible to create a materialized view in the stored procedure as I found no info on this subject.

    Thank you
    Petr

    Hi chudapet,

    Whenever you make in procedure, you must have direct subsidies and not through a role.

    Most likely the grant to create a materialized view is available via a role to your username.
    Assign a direct grant to the user:

    grant create materialized view to scott;
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
    
  • Create Materialized View ORA-01723: columns of length zero are not allowed

    I am trying to create a materialized view that derives from a column of a function and I get: ORA-01723: columns null are not allowed.

    I use 10 gr 2 with the following definition (simple version):

    CREATE MATERIALIZED VIEW ACES
    SELECT
    function_name (column_name) alias_de_colonne
    FROM table_name;

    I even tried to cast it as below:

    CREATE MATERIALIZED VIEW ACES
    SELECT
    Cast (function_name (column_name) AS VARCHAR2 (200)) alias_de_colonne
    FROM table_name;

    My function has an exception to return a value, even if no value are.

    I looked everywhere for the solution. Someone at - there a way around this problem? I really need my function to calculate the column because it has business rules that I can't join in my definition of the materialized view. My only hope around this is to insert values into a table and then create a materialized table view, I don't want to do that if someone has a solution around this.

    Any help would be greatly appreciated.

    Thank you

    Kyle

    Published by: Kyle Miller on April 19, 2011 08:28

    Have you tried to create a table with the correct structure and then by creating the view materialized, based on the predefined table as described here...

    http://www.oaktable.NET/content/ultra-fast-MV-alteration-using-prebuilt-table-option

    ?

    See you soon

    Ben

  • With as subquery block in create MATERIALIZED view or bulk pl/sql

    Hi all

    Can I use the with as subquery block in create MATERIALIZED view?

    or in pl/sql



    -Thank you

    Published by: xwo0owx on March 31, 2011 11:23

    Published by: xwo0owx on March 31, 2011 11:23

    Have you tried to test it? :)

    SQL > SELECT * FROM V$VERSION;
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE    11.2.0.2.0      Production
    TNS for 32-bit Windows: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    
    SQL > CREATE VIEW TEST_VIEW
      2  AS
      3  WITH d AS
      4  (
      5          SELECT * FROM DUAL
      6  )
      7  SELECT *
      8  FROM   d
      9  ;
    
    View created.
    
    SQL > SELECT * FROM test_view;
    
    D
    -
    X
    
    SQL > DECLARE
      2          x DUAL.DUMMY%TYPE;
      3  BEGIN
      4          WITH d AS
      5          (
      6                  SELECT * FROM DUAL
      7          )
      8          SELECT dummy
      9          INTO   x
     10          FROM   d
     11          ;
     12
     13          DBMS_OUTPUT.PUT_LINE(x);
     14  END;
     15  /
    X
    
    PL/SQL procedure successfully completed.
    
  • Query works well in an environment, but not in the other environment

    Hello

    I have a question that I am trying to run in two different environments.

    Test: - Oracle Database 11 g Release 11.2.0.1.0 - 64 bit Production
    Prod: - Oracle Database 11 g Release 11.2.0.1.0 - 64 bit Production

    Now the query runs fine in one environment and fails in the other environment.
    It gives following error.


    ORA-01861: literal does not match the format string
    01861 00000 - "literal does not format string.

    The query is too long and contains CHAR-DATE and DATE-CHAR conversions.

    The same query works very well on the TEST environment and the PROD environment.

    Any help related to it would be appreciated.

    Thank you
    Mahesh

    MaheshGx wrote:
    Hello

    I have a question that I am trying to run in two different environments.

    Test: - Oracle Database 11 g Release 11.2.0.1.0 - 64 bit Production
    Prod: - Oracle Database 11 g Release 11.2.0.1.0 - 64 bit Production

    Now the query runs fine in one environment and fails in the other environment.
    It gives following error.

    ORA-01861: literal does not match the format string
    01861 00000 - "literal does not format string.

    The query is too long and contains CHAR-DATE and DATE-CHAR conversions.

    The same query works very well on the TEST environment and the PROD environment.

    Any help related to it would be appreciated.

    Thank you
    Mahesh

    This is called a bug. One caused by the person who developed the code. They relied on an implicit conversion between strings and dates when
    production quality code will always use the function to_char and to_date with a format mask.

  • Update query works well when a subquery in where the article is wrong.

    Hello

    I executes a statement-update

    Update table set Column1 = 2000
    where a.column2 in (select column 3 of table b where b.col4 = 111)

    Now when I run the subquery: select column 3 of table b where b.col4 = 111-> it gives me the error ' identifier not valid col 3.

    But when I run the full query, then it updates the 700 lines.

    Can someone there explain please?
    My subquery throw error but when I use it in another application it works well.

    Col_3 must be in your external table (table_a, I guess).

    If you always the prefix names of columns with a table alias, you know in an instant.

  • Problems...  ORA-00907 otherwise ORA-00937 complex SQL query.

    Hello

    Anyone can solve this query? or tell me what is wrong with him?

    SELECT COUNT (1) Total, RAPP_SERVER, SYSTEM, GOOD, ERROR
    Of
    (
    SELECT tblName.RAPP_SERVER,

    DECODE (SUBSTR (tblName.NOM_SYSTEM, 1, 2), "C0", "CON", "C1", "CON", "CH", "PEPS", "AD", "PEPS", "EA", "PEPS", "OE", "PEPS", "CR", "SYSSERV", 'GS', 'SYSSERV', 'MC', 'SYSSERV', 'EC', 'SYSSERV', a ', 'SYSSERV',)

    ('DB', 'INFO', 'PP', 'INFO', 'ED', 'INFO', 'DO', 'END_SUP', EM ","HIGHER EDUCATION","EP","END_SUP","SE","END_SUP","IF","END_SUP","SR","HIGHER EDUCATION","EI","END_SUP","SG","SAID","ZA","AEL","ZF","AEL","ZI","AEL","IG", ' OTHER ',"LAUGHED", 'OTHER') SYSTEM,
    Sum (case when tblName.ST_CODE = 4 Gold tblName.ST_CODE = 12 Then 1 else null end) AS GOOD,
    Sum (case when tblName.ST_CODE = 4 tblName.ST_CODE = 12 Then NULL else 1 end gold) AS ERROR
    OF GPI01102.tblName
    GROUP BY tblName.RAPP_SERVER, ERROR SYSTEM, GOOD.
    UNION ALL
    SELECT tblName.RAPP_SERVER, DECODE (SUBSTR (NOM_SYSTEM, 1, 3), "DET", "' OTHERS, 'DEU', ' TEACHING)

    HIGHER ',' PRC ',' OTHER ', 'PRO', 'SAYS') SYSTEM.
    Sum (case when tblName.ST_CODE = 4 Gold tblName.ST_CODE = 12 Then 1 else null end) AS GOOD,
    Sum (case when tblName.ST_CODE = 4 tblName.ST_CODE = 12 Then NULL else 1 end gold) AS ERROR
    OF GPI01102.tblName
    GROUP BY tblName.RAPP_SERVER, ERROR SYSTEM, GOOD.
    WHEN FINISHED BETWEEN: P_Start_Date AND: P_End_Date
    )
    RAPP_SERVER GROUP, SYSTEM, GOOD ERROR

    Looking at your original with abbreviated instructions BOX query 2 queries appears to be identical with the exception of the data on the second query restriction.

    SELECT tblName.RAPP_SERVER,
           DECODE(SUBSTR(tblName.NOM_SYSTEM, 1, 2), 'C0', 'CON') SYSTEM,
           SUM(CASE
                 WHEN tblName.ST_CODE = 4 OR tblName.ST_CODE = 12 THEN
                  1
                 ELSE
                  NULL
               END) AS GOOD,
           SUM(CASE
                 WHEN tblName.ST_CODE = 4 OR tblName.ST_CODE = 12 THEN
                  NULL
                 ELSE
                  1
               END) AS ERROR
      FROM GPI01102.tblName
     GROUP BY tblName.RAPP_SERVER, SYSTEM, GOOD, ERROR
    
    UNION ALL
    
    SELECT tblName.RAPP_SERVER,
           DECODE(SUBSTR(NOM_SYSTEM, 1, 3), 'DET', 'AUTRES') SYSTEM,
           SUM(CASE
                 WHEN tblName.ST_CODE = 4 OR tblName.ST_CODE = 12 THEN
                  1
                 ELSE
                  NULL
               END) AS GOOD,
           SUM(CASE
                 WHEN tblName.ST_CODE = 4 OR tblName.ST_CODE = 12 THEN
                  NULL
                 ELSE
                  1
               END) AS ERROR
      FROM GPI01102.tblName
     GROUP BY tblName.RAPP_SERVER, SYSTEM, GOOD, ERROR
     WHERE FINISHED BETWEEN :P_Start_Date AND :P_End_Date
    

    Queries are on the same table twice? If so, can we explain the differences in the results of the 2 queries? You may be able to combine DECODES and use a single query.

  • SQL query works too slowly.

    Hi all

    I have this query that runs very slowly, the prob; em seems to be related to this part of the application

    * (select TO_CHAR (MAX (t.PLAYED), 'dd.mm.yyyy hh') from ticket t where t.GAME_PARTICIPANT = p.ID) as LAST_ASP *.

    I thought to rewrite that part of the query to a subquery in the where clause somewhere, but don't know how to do and always present is the value of the column in the output after "LAST_ASP".
    and do not know if it will be more effective to do so.

    Currently, I think that this subquery colum will run to run for each filled condition, and it seems to be the bottleneck in the application, took more than 30 minutes.

    The number of rows in this table is about 30 million.


    Select p.ID as PARTICIPANTID,
    Decode (concat (Sir SALUTATION_CODE, p.lang pp.), '1', 'Dear', '2nd', 'Madame', '1fr', 'Dear Sir', '2fr', 'Ch < E8 > re Madam', '1Il', 'Egregio Signor',')
    2 Gentile Signora ',' NA ',' ") as SALUTATION_TEXT,"
    pp. NAME,
    pp. LASTNAME,
    decode (p.VERIFIED, 0, p.EMAIL, 1, p.EMAIL, p.ISL_EMAIL, 2, 3, p.EMAIL, 'NA') than e-mail.
    p.LANG, TO_CHAR (pp. BIRTHDAY, 'dd.mm.yyyy') as an ANNIVERSARY,
    RAL STREET after street, pa. Number of HOME like NR,
    RAL ZIP as PLZ, pa. CITY as ORT,

    (select TO_CHAR (MAX (t.PLAYED), 'dd.mm.yyyy hh') from ticket t where t.GAME_PARTICIPANT = p.ID) as LAST_SPA,

    Decode (p.verified, 0, "checked", 1, 'Unverified', 2, 'Not migrated', 3, 'rejected', 4, 'changed to another participant', 5,)
    6 "Migres MoRo,", "ISL-active user', 'unknown') checked,.
    Decode (p.state, 0, 'eligible', 1, 'closed', 2, 'blocked', 'unknown') State
    Member p
    Join pp PERSINFO left p.ID = pp. PLAYER_ID
    PA ADDRESS left join on p.ID = pa. PLAYER_ID
    where p.ENABLED = 1
    AND STATUS = 1 pp.
    AND pa. STATUS = 1
    AND TO_CHAR (pp. BIRTHDAY, "mm") = TO_CHAR (ADD_MONTHS (CURRENT_DATE-1), 'mm')


    Your help to solve this will be very much appreciated.

    Thank you

    Hello

    1 - the first clue is a great idea. Perhaps the most useful it seems to be the birthday column that seem to be more selective than status.
    Is there any clue on the anniversary coumn?
    The index might be just that on the anniversary of the column and change the condition like this:

    Birthday between to_date(to_char(trunc(trunc(ADD_MONTHS(CURRENT_DATE, -1),'month')),'ddmm')||(to_char(birthday,'yyyy')),'ddmmyyyy')
     and
    to_date(to_char(trunc(CURRENT_DATE,'month'),'ddmm')||(to_char(birthday,'yyyy')),'ddmmyyyy')
    

    In this way you create an index that can be used in the future to querys.
    Of course, you can add the status column if it is useful.

    2 - the second index have lots of columns. Oracle recommends not create indexes on more than three columns. Indexing many columns claim and time with increment when you insert or update the table.
    I understand that this index only have access you to the index, and you don't need to access the table, which is faster.
    Perhaps accessing an index on the id column is sufficient.

    Published by: user648773 on 04/10/2013 10:22: I made a change to the State

  • My SQL query is well-formed?

    Schema:

    CARS (* cid *, - mi-, CLA)
    BUYERS (* offer *, Boss, city, age)
    MANUFACTURERS (* maname *, location)
    MODELS (* middle *, maname- model)
    SELLERS (* sid *, sname, years_employed)
    TRANSACTIONS (* - tender-*, * - cid-*, * - sid-*, quantity, day, month, year)

    * represents a pk
    -represents a fk
    * - to represent the fk and pk at the same time

    Q. print the SIDS of all of the vendors who sold both a Ford and Toyota in 1997.

    I wrote the request in the form:

    Select s.sid
    s sellers
    Join transactions t on t.sid = s.sid
    Join cars c on c.cid = t.cid
    Models join m on m.mid = c.mid
    where t.year = 1997 and (m.maname = 'Ford' and m.maname = 'Toyota');


    The assignment source: http://sandbox.mc.edu/~gwiggins/syllabi/csc415/SQL-HMWK-F99.html

    Published by: user11164565 on July 28, 2009 05:32

    No need for the subquery if marks are not needed, because they are already known:

    select s.sid
    from salespeople s
    join transactions t on t.sid = s.sid
    join cars c on c.cid = t.cid
    join models m on m.mid = c.mid
    where t.year = 1997 m.maname in ('Ford','Toyota')
    group by s.sid having count(distinct m.maname) > 1;
    
  • Why this erroneous query works well? -Answer

    DB version: 10 gr 2
    I wanted to reproduce the non-use of rownum when used with an ORDER BY clause.
    Because ORDER BY is evaluated finally (after ROWNUMs are generated), the query below give bad result put most of the time.
    But the following query
    select ename,join_date
    from test
    where rownum<4
    order by join_date
    give me a correct result. Then, when this query will start to give erroneous results?


    alter session set nls_date_format='DD-MM-YYYY HH:MI:SS';
    
     SELECT SYSDATE FROM DUAL;
    
    SYSDATE
    -------------------
    15-12-2008 11:40:30
    
    create table test
    (ename varchar2(15),
    join_date date);
    
    
    insert into test values('JAMES',SYSDATE);
    insert into test values('CHESTER',SYSDATE);
    insert into test values('SUNITA',SYSDATE);
    insert into test values('GARRY',SYSDATE);
    insert into test values('KAREN',SYSDATE);
    insert into test values('ABDUL',SYSDATE);
    insert into test values('YING',SYSDATE);
    
    set lines 400
    select * from test;
    
    ENAME           JOIN_DATE
    --------------- -------------------
    JAMES           15-12-2008 11:41:21
    CHESTER         15-12-2008 11:41:40
    SUNITA          15-12-2008 11:41:56
    GARRY           15-12-2008 11:42:17
    TIM             15-12-2008 11:42:44
    KAREN           15-12-2008 11:52:46
    ABDUL           15-12-2008 11:53:01
    YING            15-12-2008 11:53:18
    CHAICE          15-12-2008 12:14:27
    THELMA          15-12-2008 12:14:54
    
    
    select ename,join_date
    from test
    where rownum<4
    order by join_date;
    
    ENAME           JOIN_DATE
    --------------- -------------------
    JAMES           15-12-2008 11:41:21   --correct
    CHESTER         15-12-2008 11:41:40   --correct     
    SUNITA          15-12-2008 11:41:56   --correct
    Published by: Nichols on December 15, 2008 03:37

    Published by: Nichols on December 15, 2008 03:56

    Published by: Nichols on December 15, 2008 04:09

    Run the same query, but the order of join_date DESC. You will see that the result is completely incorrect.
    The query takes just three records (not the 'top three' - there is no order) and then ordered these records based on the ORDER BY in the final predicate.

  • ORA-12008: error path refresh materialized view... Bug?

    SQL> select * from v$version;
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for Linux: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    
    SQL> drop materialized view log on test_tbl;
    
    Materialized view log dropped.
    
    SQL> drop materialized view mv_test_tbl;
    
    Materialized view dropped.
    
    SQL> drop table test_tbl;
    
    Table dropped.
    
    SQL> create table test_tbl(
      2   test_id   number(10)   primary key,
      3   test_name varchar2(10) not null)
      4  ;
    
    Table created.
    
    SQL> insert into test_tbl values (1,'bob');
    
    1 row created.
    
    SQL> insert into test_tbl values (2,'joe');
    
    1 row created.
    
    SQL> insert into test_tbl values (3,'john');
    
    1 row created.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> create materialized view log on test_tbl
      2  with primary key , rowid, sequence
      3  (
      4   test_name
      5  )
      6  including new values;
    
    Materialized view log created.
    
    SQL> create materialized view mv_test_tbl
      2  refresh fast on commit
      3  as
      4  select test_id,
      5         test_name
      6  from   test_tbl;
    
    Materialized view created.
    
    SQL> update test_tbl set test_name = 'hello' where test_id = 1000;
    
    0 rows updated.
    
    SQL> commit;
    
    Commit complete.
    OK, so it's all good. Now, if I create the log of the materialized with the possibility of COMMETTRE SNA view:
    SQL> drop materialized view log on test_tbl;
    
    Materialized view log dropped.
    
    SQL> drop materialized view mv_test_tbl;
    
    Materialized view dropped.
    
    SQL> create materialized view log on test_tbl
      2  with primary key , rowid, sequence
      3  (
      4   test_name
      5  ),
      6  commit scn
      7  including new values;
    
    Materialized view log created.
    
    SQL> create materialized view mv_test_tbl
      2  refresh fast on commit
      3  as
      4  select test_id,
      5         test_name
      6  from   test_tbl;
    
    Materialized view created.
    
    SQL> update test_tbl set test_name = 'hello' where test_id = 1000;
    
    0 rows updated.
    
    SQL> commit;
    commit
    *
    ERROR at line 1:
    ORA-12008: error in materialized view refresh path
    ORA-01006: bind variable does not exist
    
    
    SQL>
    Commit an update that updates no line against a main table for a single table quickly updatable materialized view results in the error above when the log of the materialized on the main table view is created with the option of COMMETTRE YVERT. I'm guessing that's not how things are supposed to work. Or am I missing something here? Someone else has encountered this before?

    See you soon.

    Published by: task on 25 January 2013 13:27

    Hi, detaching,

    Looks like that Bug ID 13910043

    Concerning
    Peter

Maybe you are looking for

  • Wireless LAN not working after restart

    Hey My all new laptop suddenly deleted earlier today and when I restarted it I noticed that my wifi is not working. It is also asking me to install a new driver, the network controller? I'm confused that everything worked well and all of a sudden it'

  • HPE-475UK failure hard drive - need to replace

    For a HPE-475UK, can I replace the internal WD1001FAES 7200 rpm 1 TB Caviar Black HD with a 1 to Caviar Green 5400 RPM? Whatever it is will have to change the motherboard if you use the lower speed device? Thank you very much GTC357

  • HP Pavilion Slimline s7510.se - power switch?

  • Problems with graphics on Satellite P100-470

    Hi all Well... I had a little problem with my graphics card. Nvidia Go7600 has 'breaks' during the games, and I don't know what I have to do! I already turn off the firewall and all that! Can you tell me which driver can solve this problem! Thank you

  • Best practices of revision control

    I use the full Version of Labview 14 and trying to set up a system for a computer in test-lab. Currently, I want to have our published versions of test programs easily accessible to everyone while I work for my own use, the development versions. I am