PL/SQL: ORA-00905: missing keyword

Hi,
while i m adding and statement after when matched for the merge command i m getting this error. while the command is working fine without and statemnt when matched then...
does it have anything to do with oracle version. currently i m using oracle 9.2. i trind this on diff systems but getting the same error..
thansk in advance
deepak

Would you mind to post the query?

Similar Messages

  • ORA-00905: missing keyword -- with analytical query

    Hi Gurus,
    I created a function in my developer 10g server. where it worked fine.
    But my SIT server is a Version 9.2.0.6.0 . The same function is giving me this error.
    create or replace function test22 return number
    is
    CURSOR C2 IS
    SELECT MAX(sysdate) OVER(PARTITION BY TO_CHAR(sysdate, 'MMRRRR') ORDER BY sysdate ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) EFF_FROM_DT_CONV
    from dual ;
    begin
    for i in c2
    loop
    DBMS_OUTPUT.PUT_LINE('HI' || I.EFF_FROM_DT_CONV);
    end loop;
    null;
    return 1;
    end;
    Show error
    5/1 PL/SQL: SQL Statement ignored
    5/130 PL/SQL: ORA-00905: missing keyword
    Please help me how to resolve this issue.
    If I run the sql statement in sqlprmt it works fine. But when I integrate with PL/SQL am getting error

    You properbly hit bug
    Bug 3083373 ORA-905 when using an analytic clause in SQL within PLSQL
    which is fixed in 9.2.0.7
    As Workaround you could use dynamic SQL (EXECUTE IMMEDIATE...)

  • ORA-00905: missing keyword while generating sqltxplain.sql

    Hi All,
    I got the below error while generating the sqltxplain.sql, please help me to sort it out.
    SQL>/
    old 1: ^^explain_plan_for.
    new 1: EXPLAIN PLAN SET statement_id = '42881' INTO sqltxplain.sqlt$_sql_plan_table FOR
    Dump file /q02/app/oracle/oaqadb/oaqa_oaqadb/udump/oaqa_ora_1847432.trc
    ERROR at line 2:
    ORA-00905: missing keyword
    Database resides in
    Oracle Database 10g Enterprise Edition
    10.2.0.4.0
    64bit
    AIX(Operating System)
    Regards,
    Jagadish.
    Edited by: 941792 on Jun 26, 2012 4:25 PM

    Please read this:
    https://forums.oracle.com/forums/ann.jspa?annID=718

  • ORA-00905: missing keyword error while creating a materialized view

    Hi Gurus,
    I am trying to create a materialized view as :
    1 CREATE MATERIALIZED VIEW AMREG.ClientData
    2 TABLESPACE AMREG_DATA
    3 COMPRESS
    4 PARALLEL
    5 NOLOGGING
    6 BUILD IMMEDIATE
    7 REFRESH COMPLETE
    8 ON DEMAND
    9 DISABLE QUERY REWRITE
    10 REFRESH START WITH TRUNC( SYSDATE + 1 ) + 3/24 NEXT TRUNC( SYSDATE + 1 ) + 3/24
    11 AS
    12 SELECT
    13 CHILD.CLIENT_SGK "Child SGK",
    14 CHILD.CLIENT_NAME "Child Name",
    15 CHILD.ARC_ACCT_CD "Child ARC Acct Code",
    16 ULTIMATE.CLIENT_SGK "Ultimate Parent SGK",
    17 ULTIMATE.CLIENT_NAME "Ultimate Parent Name",
    18 ULTIMATE.ARC_ACCT_CD "Ultimate ARC Acct Code",
    19 HIER.LVL_FROM_ANCESTOR ,
    20 FROM [email protected] CHILD,
    21 [email protected] HIER,
    22 [email protected] ULTIMATE
    23 WHERE HIER.DESCENDANT_CLIENT_SGK = CHILD.CLIENT_SGK
    24* AND ULTIMATE.CLIENT_SGK = HIER.ANCESTOR_CLIENT_SGK;
    SQL> /
    REFRESH START WITH TRUNC( SYSDATE + 1 ) + 3/24 NEXT TRUNC( SYSDATE + 1 ) + 3/24
    ERROR at line 10:
    ORA-00905: missing keyword
    DBLink name is : DNYCPH60.WORLD
    Please guide me on this and help to resolve the issue.

    Ummm how about not posting the same question 4 times in 3 different forums?
    Gints Plivna
    http://www.gplivna.eu

  • ORA-00905: missing keyword error while creating a materialised view

    Hi Gurus,
    I am trying to create a materialized view as :
    1 CREATE MATERIALIZED VIEW AMREG.ClientData
    2 TABLESPACE AMREG_DATA
    3 COMPRESS
    4 PARALLEL
    5 NOLOGGING
    6 BUILD IMMEDIATE
    7 REFRESH COMPLETE
    8 ON DEMAND
    9 DISABLE QUERY REWRITE
    10 REFRESH START WITH TRUNC( SYSDATE + 1 ) + 3/24 NEXT TRUNC( SYSDATE + 1 ) + 3/24
    11 AS
    12 SELECT
    13 CHILD.CLIENT_SGK "Child SGK",
    14 CHILD.CLIENT_NAME "Child Name",
    15 CHILD.ARC_ACCT_CD "Child ARC Acct Code",
    16 ULTIMATE.CLIENT_SGK "Ultimate Parent SGK",
    17 ULTIMATE.CLIENT_NAME "Ultimate Parent Name",
    18 ULTIMATE.ARC_ACCT_CD "Ultimate ARC Acct Code",
    19 HIER.LVL_FROM_ANCESTOR ,
    20 FROM [email protected] CHILD,
    21 [email protected] HIER,
    22 [email protected] ULTIMATE
    23 WHERE HIER.DESCENDANT_CLIENT_SGK = CHILD.CLIENT_SGK
    24* AND ULTIMATE.CLIENT_SGK = HIER.ANCESTOR_CLIENT_SGK;
    SQL> /
    REFRESH START WITH TRUNC( SYSDATE + 1 ) + 3/24 NEXT TRUNC( SYSDATE + 1 ) + 3/24
    ERROR at line 10:
    ORA-00905: missing keyword
    DBLink name is : DNYCPH60.WORLD
    Please guide me on this and help to resolve the issue.

    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_6002.htm#i2063793 gives you the syntax of the command.
    I think the fact that you have two REFRESH clauses separated by a query rewrite clause is causing some confusion.
    7 REFRESH COMPLETE
    8 ON DEMAND
    9 DISABLE QUERY REWRITE
    10 REFRESH START WITH TRUNC( SYSDATE + 1 ) + 3/24 NEXT TRUNC( SYSDATE + 1 ) + 3/24
    11 AS
    probably should be
    REFRESH COMPLETE
            ON DEMAND
            START WITH TRUNC( SYSDATE + 1 ) + 3/24 NEXT TRUNC( SYSDATE + 1 ) + 3/24
    DISABLE QUERY REWRITE

  • Error: ORA-00905:Missing keyword while creating Materialized view

    Hi Gurus,
    I am trying to create a materialized view as :
    1 CREATE MATERIALIZED VIEW AMREG.ClientData
    2 TABLESPACE AMREG_DATA
    3 COMPRESS
    4 PARALLEL
    5 NOLOGGING
    6 BUILD IMMEDIATE
    7 REFRESH COMPLETE
    8 ON DEMAND
    9 DISABLE QUERY REWRITE
    10 REFRESH START WITH TRUNC( SYSDATE + 1 ) + 3/24 NEXT TRUNC( SYSDATE + 1 ) + 3/24
    11 AS
    12 SELECT
    13 CHILD.CLIENT_SGK "Child SGK",
    14 CHILD.CLIENT_NAME "Child Name",
    15 CHILD.ARC_ACCT_CD "Child ARC Acct Code",
    16 ULTIMATE.CLIENT_SGK "Ultimate Parent SGK",
    17 ULTIMATE.CLIENT_NAME "Ultimate Parent Name",
    18 ULTIMATE.ARC_ACCT_CD "Ultimate ARC Acct Code",
    19 HIER.LVL_FROM_ANCESTOR ,
    20 FROM [email protected] CHILD,
    21 [email protected] HIER,
    22 [email protected] ULTIMATE
    23 WHERE HIER.DESCENDANT_CLIENT_SGK = CHILD.CLIENT_SGK
    24* AND ULTIMATE.CLIENT_SGK = HIER.ANCESTOR_CLIENT_SGK;
    SQL> /
    REFRESH START WITH TRUNC( SYSDATE + 1 ) + 3/24 NEXT TRUNC( SYSDATE + 1 ) + 3/24
    ERROR at line 10:
    ORA-00905: missing keyword
    DBLink name is : DNYCPH60.WORLD
    Please guide me on this and help to resolve the issue.

    I provided the answer over at the duplicate post ...
    ORA-00905: missing keyword error while creating a materialised view
    Please, please, please ... please do not duplicate posts. Pick one. If you don't get an answer in a reasonable time - close it (edit the title) and THEN open in a different forum.

  • SAP Upgrade ORA-00905: missing keyword

    Dear experts,
    we have a very urgent SAP upgrade case,
    From SAP R/3 470 SR1 110 to ECC 6 EHP4 SPS09
    source system have three languages ZH EN DE,it's a
    non-unicode system,before SAP upgrade,From rscpinst, i delete language
    German and change contry code to CN,
    (China). Then there is only code page 8400,T-code: I18N check ok,now we have
    a error during upgrade,i was already replace the kernel to 385 version(640_Rel Non-unicode,TP and R3trans alreay the latest version) repeat the SHADOW_IMPORT_UPG1 step but still fail,log result as follow,the SAPKLZHSR1EHP4ERP6F8.GS1 has incomplete conversion
    but the previous log file I.E SAPKLZHSR1EHP4ERP6F7.GS1 also have incomplete conversion but no ORA-00905,we only have codepage 8400 and Non-unicode but why the log mention 4103 it's a Unicode code page,thanks a lot!
    SHDUPGIMP1.ELG
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    SHADOW IMPORT ERRORS and RETURN CODE in SAPKLZHSR1EHP4ERP6F8.GS1
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    2EETW000 SQL error 905 occured: ORA-00905: missing keyword
    2EETW000 SQL error 905 occured: ORA-00905: missing keyword
    1 ETP111 exit code           : "8"
    SAPKLZHSR1EHP4ERP6F8.GS1
    4 ETW000  22 entries for RSMPTEXTS~ imported (SAPLMCB2                                1*).
    4 ETW000   1 entry for TLIBT~ updated  (1MCB2).
    3WETW000 language = '1', converted from codepage 4103 to codepage 8400, incomplete conversion due to invalid chars: '41004e0041004c005900530045005f00440055005200430048004600dc004800520045004e0020002000200020002000200020002000200020002000' -> 'ANALYSE_DURCHF#HREN           '
    4 ETW000   0 entries from FUNCT~ (1ANALYSE_DURCHF#HREN           %) deleted.
    3WETW000 language = '1', converted from codepage 4103 to codepage 8400, incomplete conversion due to invalid chars: '41004e0041004c005900530045005f00440055005200430048004600dc004800520045004e0020002000200020002000200020002000200020002000' -> 'ANALYSE_DURCHF#HREN           '
    4 ETW000   0 entries from FUNCT~ (1ANALYSE_DURCHF#HREN           %) deleted.
    3WETW000 language = '1', converted from codepage 4103 to codepage 8400, incomplete conversion due to invalid chars: '41004e0041004c005900530045005f00440055005200430048004600dc004800520045004e0020002000200020002000200020002000200020002000' -> 'ANALYSE_DURCHF#HREN           '
    4 ETW000   0 entries from FUNCT~ (1ANALYSE_DURCHF#HREN           %) deleted.
    3WETW000 language = '1', converted from codepage 4103 to codepage 8400, incomplete conversion due to invalid chars: '41004e0041004c005900530045005f00440055005200430048004600dc004800520045004e0020002000200020002000200020002000200020002000' -> 'ANALYSE_DURCHF#HREN           '
    4 ETW000   0 entries from TFTIT~ (1ANALYSE_DURCHF#HREN           ) deleted.
    3WETW000 language = '1', converted from codepage 4103 to codepage 8400, incomplete conversion due to invalid chars: '41004e0041004c005900530045005f00440055005200430048004600dc004800520045004e0020002000200020002000200020002000200020002000' -> 'ANALYSE_DURCHF#HREN           '
    4 ETW000   0 entries from TFTIT~ (1ANALYSE_DURCHF#HREN           ) deleted.
    3WETW000 language = '1', converted from codepage 4103 to codepage 8400, incomplete conversion due to invalid chars: '41004e0041004c005900530045005f00440055005200430048004600dc004800520045004e0020002000200020002000200020002000200020002000' -> 'ANALYSE_DURCHF#HREN           '
    4 ETW000   0 entries from TFTIT~ (1ANALYSE_DURCHF#HREN           ) deleted.
    4 ETW000  [     dev trc,00000]  Wed Sep  7 10:41:04 2011                                             815387003  1338.120210
    4 ETW000  [     dev trc,00000]     OCIStmtExecute() failed with -1=OCI_ERROR                              10  1338.120220
    4 ETW000  [     dev trc,00000]     SQL error 905:                                                          6  1338.120226
    4 ETW000  [    dbsloci.,00000]  *** ERROR => Error 905 in stmt_fetch() from oci_execute_stmt(), orpc=0
    4 ETW000                                                                                12  1338.120238
    4 ETW000  [    dbsloci.,00000]  *** ERROR => ORA-905 occurred when executing SQL stmt (parse error offset=110)
    4 ETW000                                                                                9  1338.120247
    4 ETW000  [     dev trc,00000]  sc_p=0x140f618,no=67,idc_p=(nil),con=0,act=1,slen=149,smax=256,#vars=4,stmt=0x1783c10,table=
    4 ETW000                                                                                17  1338.120264
    4 ETW000  [     dev trc,00000]  SELECT ID,OBJECT,LANGU,TYP,VERSION FROM "DOKIL~" WHERE (LANGU IN ( :A0 )) AND ID = :A1 AND OBJECT BE\
    4 ETW000                                                                                9  1338.120273
    4 ETW000  [     dev trc,00000]  TWEEN :A2 ANALYSE#_DURCHF#REN           % :A3 #?;                         5  1338.120278
    4 ETW000  [     dev trc,00000]  sc_p=0x140f618,no=67,idc_p=(nil),con=0,act=1,slen=149,smax=256,#vars=4,stmt=0x1783c10,table=
    4 ETW000                                                                                11  1338.120289
    4 ETW000  [     dev trc,00000]  Dumping DBSL stmt. cache:                                                  5  1338.120294
    4 ETW000  [     dev trc,00000]  prep=0,lit=0,nsql=1,lobret=0,xop=1,dbcnt=0,upsh=(nil),stmtp=0x1784758,rtc=0
    4 ETW000                                                                                29  1338.120323
    4 ETW000  [     dev trc,00000]  IN : cols=4,rmax=1,xcnt=0,rpc=0,rowi=0,rtot=0,upto=4294967295,rsize=28,vmax=32,bound=1,iobuf_p=0x1493510,vda_p=0x1784db0
    4 ETW000                                                                                10  1338.120333
    4 ETW000  [     dev trc,00000]       lobs=0,lmax=0,lpcnt=0,larr=(nil),lcurr_p=(nil),rret=0                 6  1338.120339
    4 ETW000  [     dev trc,00000]  SELECT ID,OBJECT,LANGU,TYP,VERSION FROM "DOKIL~" WHERE (LANGU IN ( :A0 )) AND ID = :A1 AND OBJECT BE\
    4 ETW000                                                                                7  1338.120346
    4 ETW000  [     dev trc,00000]  TWEEN :A2 ANALYSE#_DURCHF#REN           % :A3 #?;                         5  1338.120351
    4 ETW000  [    dbds    ,00596]  ***LOG BY2=>sql error 905        performing FET        [dbds#2 @ 596]
    4 ETW000                                                                                14  1338.120365
    4 ETW000  [    dbds    ,00596]  ***LOG BY0=>ORA-00905: missing keyword [dbds#2 @ 596]                      6  1338.120371
    2EETW000 SQL error 905 occured: ORA-00905: missing keyword
    4 ETW000   0 entries from FUNCT~ (1MCB_GRAPHIC_DAILY             %) deleted.
    4 ETW000   0 entries from FUNCT~ (%MCB_GRAPHIC_DAILY             %) deleted.
    4 ETW000   0 entries from TFTIT~ (1MCB_GRAPHIC_DAILY             ) deleted.
    4 ETW000   0 entries from TFTIT~ (%MCB_GRAPHIC_DAILY             ) deleted.
    SAPKLZHSR1EHP4ERP6F7.GS1
    4 ETW000   1 entry for LDBNT~ imported (1FTI_TR_PL_CF        *).
    4 ETW000   0 d /   1 i /   0 u /   0 =   0% ucf LDBT~
    4 ETW000   1 entry for LDBT~ imported (1FTI_TR_PL_CF).
    4 ETW000   1 entry for TRDIRT~ inserted (SAPDBFTI_TR_POSITIONS                   1*).
    3WETW000 some text was mutilated during conversion from unicode to ascii in language '1'. This is the result: 'SP_JOTC          ###############'
    3WETW000 language = '1', converted from codepage 4103 to codepage 8400, incomplete conversion due to invalid chars: '530050005f004a004f005400430020002000200020002000200020002000200020003a571659a44e13664d881f75a74ec1542000200020002000200020002000' -> 'SP_JOTC          ###############'
    4 ETW000 REPOT1SAPDBFTI_TR_POSITIONS                    A replaced.
    4 ETW000   0 entries from D020T~ (SAPDBFTI_TR_POSITIONS                   %) deleted.
    4 ETW000   0 entries from D021T~ (SAPDBFTI_TR_POSITIONS                   %) deleted.
    4 ETW000   0 entries from TRDIRT~ (DBFTI_TR_POSITIONSFXXX                  1%) deleted.
    4 ETW000   0 entries from TRDIRT~ (DBFTI_TR_POSITIONSNXXX                  1%) deleted.
    4 ETW000   0 entries from TRDIRT~ (DBFTI_TR_POSITIONSN001                  1%) deleted.
    4 ETW000   0 entries from TRDIRT~ (DBFTI_TR_POSITIONSSEL                   1%) deleted.
    4 ETW000   0 entries from TRDIRT~ (DBFTI_TR_POSITIONSSXXX                  1%) deleted.
    4 ETW000   0 entries from TRDIRT~ (DBFTI_TR_POSITIONSTOP                   1%) deleted.
    SAPup.ECO
    Phase SHADOW_IMPORT_UPG1:
    BLOCKED SIGNALS: ''
    SAPup> Starting subprocess 2865 at 20110907101845
    ENV: DIR_LIBRARY=/usr/sap/upgrade/upg_dir/abap/exenew
    ENV: LD_LIBRARY_PATH=/usr/sap/upgrade/upg_dir/abap/exenew:/usr/sap/upgrade/upg_dir/jvm/jre/lib/amd64/server:/usr/sap/upgrade/upg_dir/jvm/jre/lib/amd64:/usr/sap/upgrade/upg_dir/jvm/jre/../lib/amd64:/usr/sap/GS1/SYS/exe/run:/oracle/GS1/102_64/lib
    ENV: NLS_LANG=AMERICAN_AMERICA.WE8DEC
    ENV: ORACLE_BASE=/oracle
    ENV: ORACLE_HOME=/oracle/GS1/102_64
    ENV: ORACLE_PSRV=GS1
    ENV: ORACLE_SID=GS1
    ENV: ORA_NLS33=/oracle/client/92x_64/ocommon/nls/admin/data
    ENV: PATH=/usr/sap/upgrade/upg_dir/abap/exenew:/oracle/GS1/102_64/bin:.:/home/gs1adm:/usr/sap/GS1/SYS/exe/run:/opt/gcc295/bin:/opt/gnome/bin:/usr/games:/usr/bin/X11:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/global_lx/bin:/usr/global/bin
    ENV: SAPSYSTEMNAME=GS1
    ENV: auth_shadow_upgrade=0
    ENV: dbms_type=ORA
    ENV: dbs_ora_schema=SAPDAT
    ENV: dbs_ora_tnsname=GS1
    EXECUTING /usr/sap/upgrade/upg_dir/abap/exenew/tp (/usr/sap/upgrade/upg_dir/abap/exenew/tp) pf=/usr/sap/upgrade/upg_dir/abap/bin/SHDUPGIMP1.TPP put GS1
    This is /usr/sap/upgrade/upg_dir/abap/exenew/tp version 376.03.38 (release 701)
    This is /usr/sap/upgrade/upg_dir/abap/exenew/R3trans version 6.14 (release 701 - 03.06.11 - 17:57:00).
    2EETW000 SQL error 905 occured: ORA-00905: missing keyword
    2EETW000 SQL error 905 occured: ORA-00905: missing keyword
    /usr/sap/upgrade/upg_dir/abap/exenew/R3trans finished (0008).
    ERROR: stopping on error 8 during SHADOW IMPORT
    Warning: Parameter INTERRUPT is no longer used.
    Warning: Parameter DAYLIGHT_SHUTDOWN is no longer used.
    Warning: Parameter WITH_TACOB is no longer used.
    Warning: Parameter IMPDP_BY_EVENT is no longer used.
    Warning: Parameter INTERRUPT is no longer used.
    Warning: Parameter DAYLIGHT_SHUTDOWN is no longer used.
    Warning: Parameter WITH_TACOB is no longer used.
    Warning: Parameter IMPDP_BY_EVENT is no longer used.
    Warning: Parameter DBCONFPATH is no longer used.
    stopping on error 8 during SHADOW IMPORT
    tp returncode summary:
    TOOLS: Highest return code of single steps was: 8
    WARNS: Highest tp internal warning was: 0118
    tp finished with return code: 8
    meaning:
      A tool used by tp produced errors
    Process with ID 2865 terminated with status 8
    B.R
    Lance.
    Edited by: Yen on Sep 7, 2011 8:11 AM

    Hello,
    Following upg master was used -
    51036889_1 BS 7 SR1 Upgrade Master 1/2
    51036889_2 BS 7 SR1 Upgrade Master 2/2
    And the kernel dvd used was NUC -
    51036767_4 BS 7 SR1 Kernel 7.01
    After successful upgrade to ecc6 EhP4, Unicode conversion was done later with UC kernel DVD (during IMPORT)
    Thanks

  • DBMS_ADVANCED_REQRITE getting ORA-00905: missing keyword

    What am I doing wrong here?
    17:17:29 NJ3417@pubd1> create table test_a (col_a varchar2(20));
    Table created.
    Elapsed: 00:00:00.04
    17:17:55 NJ3417@pubd1> insert into test_a values('Red');
    1 row created.
    Elapsed: 00:00:00.02
    17:18:09 NJ3417@pubd1> create table test_b (col_b varchar2(20));
    Table created.
    Elapsed: 00:00:00.02
    17:18:32 NJ3417@pubd1> insert into test_b values('Blue');
    1 row created.
    Elapsed: 00:00:00.03
    17:18:55 NJ3417@pubd1> commit;
    Commit complete.
    17:34:56 NJ3417@pubd1> begin
    17:34:56   2    sys.dbms_advanced_rewrite.declare_rewrite_equivalence(
    17:34:56   3           name => 'Mikes SQL override',
    17:34:56   4           source_stmt => 'SELECT col_a FROM test_a',
    17:34:56   5           destination_stmt => 'SELECT col_b FROM test_b',
    17:34:56   6           validate => FALSE);
    17:34:56   7  end;
    17:34:56   8  /
    begin
    ERROR at line 1:
    ORA-00905: missing keyword
    ORA-06512: at "SYS.DBMS_ADVANCED_REWRITE", line 29
    ORA-06512: at "SYS.DBMS_ADVANCED_REWRITE", line 185
    ORA-06512: at line 2
    17:54:18 NJ3417@pubd1> 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 Solaris: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    5 rows selected.Thanks,
    Mike

    mtefft wrote:
    What am I doing wrong here?I don't have your exact version but I believe you can not have any string as the name of the rewrite rule. See the documentation
    Here is the working example:
    SQL> select * from v$version ;
    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 Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL> create table test_a (col_a varchar2(20));
    Table created.
    SQL> insert into test_a values('Red');
    1 row created.
    SQL> create table test_b (col_b varchar2(20));
    Table created.
    SQL> insert into test_b values('Blue');
    1 row created.
    SQL> commit ;
    Commit complete.
    SQL> select col_a from test_a ;
    COL_A
    Red
    SQL> select col_b from test_b ;
    COL_B
    Blue
    begin
      sys.dbms_advanced_rewrite.declare_rewrite_equivalence(
           name => 'Mikes SQL override',
           source_stmt => 'SELECT col_a FROM test_a',
           destination_stmt => 'SELECT col_b FROM test_b',
           validate => FALSE);
    end;
      8  /
    begin
    ERROR at line 1:
    ORA-00905: missing keyword
    ORA-06512: at "SYS.DBMS_ADVANCED_REWRITE", line 29
    ORA-06512: at "SYS.DBMS_ADVANCED_REWRITE", line 185
    ORA-06512: at line 2
    begin
      sys.dbms_advanced_rewrite.declare_rewrite_equivalence(
           name => 'myrule',
           source_stmt => 'SELECT col_a FROM test_a',
           destination_stmt => 'SELECT col_b FROM test_b',
           validate => FALSE);
    end;
      8  /
    PL/SQL procedure successfully completed.
    SQL> show parameter rewrite
    NAME                                 TYPE        VALUE
    query_rewrite_enabled                string      TRUE
    query_rewrite_integrity              string      enforced
    SQL> alter session set query_rewrite_integrity=trusted ;
    Session altered.
    SQL> show parameter rewrite
    NAME                                 TYPE        VALUE
    query_rewrite_enabled                string      TRUE
    query_rewrite_integrity              string      TRUSTED
    SQL> select col_a from test_a ;
    COL_A
    Blue

  • ORA-00905: missing keyword

    CREATE TABLE STG
      X  NUMBER
    )INSERT INTO STG(X) VALUES (1);
    COMMIT;
    this table will be created dynamically in my program, somewhere I want to get the count
    so i tried this
    declare
    l_cnt number := 0;
      begin
      execute immediate 'select count(x)
    into l_cnt
    from stg';
    dbms_output.put_line('l_cnt: '||l_cnt);
      end;
    /it gives me the error
    ORA-00905: missing keyword
    how do i get the count dynamically for a table created dynamically ?

    Hi,
    user650888 wrote:
    CREATE TABLE STG
    X  NUMBER
    )INSERT INTO STG(X) VALUES (1);
    COMMIT;
    this table will be created dynamically in my program, Why are you creating a table in your program? That's almost never needed in Oracle.
    somewhere I want to get the count
    so i tried this
    declare
    l_cnt number := 0;
    begin
    execute immediate 'select count(x)
    into l_cnt
    from stg';
    dbms_output.put_line('l_cnt: '||l_cnt);
    end;
    /it gives me the error
    ORA-00905: missing keyword
    how do i get the count dynamically for a table created dynamically ?
    EXECUTE IMMEDIATE 'SELECT COUNT (x) FROM stg' INTO l_cnt;

  • ORA-00905: missing keyword  against APEX

    Hi,
    can someone explain my what is wrong with this query :
    drop table emp_by_dept;
    SELECT b.EMPLOYEE_ID, b.DEPARTMENT_ID INTO emp_by_dept
    FROM
    (SELECT EMPLOYEE_ID, DEPARTMENT_ID
    FROM oehr_employees
    WHERE department_id = 30) b;
    The results gived by subqyery
    SELECT EMPLOYEE_ID, DEPARTMENT_ID
    FROM oehr_employees
    WHERE department_id = 30
    are:
    EMPLOYEE_ID DEPARTMENT_ID
    114 30
    115 30
    116 30
    117 30
    118 30
    119 30
    6 rows returned in 0.02 seconds Download

    As Blushadow said, the select .. into syntax is used to select a single value into a variable, you cannot use it to create a table. That is SQL Server syntax. If you really want to drop and re-create the table every time, then the correct syntax is:
    drop table emp_by_dept;
    create table emp_by_dept as
    SELECT EMPLOYEE_ID, DEPARTMENT_ID
    FROM oehr_employees
    WHERE department_id = 30;However, again as Blushadow pointed out, this is unnecessary, and generally considered bad practice in Oracle. You should either create the emp_by_dept once as a regular table, then truncate it and insert new data, or create the emp_by_dept table once as a Global Temporary Table, then use the GTT in whatever it is you are doing.
    Having sais that, my feeling is that it is extremely unlikely that you actually need the emp_by_dept at all. In Oracle, readers do not block writers, so, in most cases, you can just use the select from oehr_employees directly wherever you are using emp_by_dept.
    John

  • Ora-00905 missing keyword error

    Hi ,
    Whats wrong with the below query?
    Pls help
    select state_id ,
           TO_CHAR(state_eff_date, 'dd-mon-yyyy hh24:mi:ss am'),
         case
              when station_id = null then state_id = lag(state_id) over (order by ash.station_id)
         end "previous_state"    
       from vppstation.avi_state_history
    where state_eff_date >= to_date('01/02/2010', 'dd/mm/yyyy')
        and state_eff_date <= to_date('16/03/2010', 'dd/mm/yyyy')
        and station_id = 61 ;Thanks.

    Consider this example:
      1* SELECT * FROM emp ORDER BY hiredate
    SQL> /
         EMPNO ENAME      JOB            MGR HIREDATE         SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-80         800              20
          7499 ALLEN      SALESMAN           7698 20-FEB-81        1600        300        30
          7521 WARD       SALESMAN           7698 22-FEB-81        1250        500        30
          7566 JONES      MANAGER           7839 02-APR-81        2975              20
          7698 BLAKE      MANAGER           7839 01-MAY-81        2850              30
          7782 CLARK      MANAGER           7839 09-JUN-81        2450              10
          7844 TURNER     SALESMAN           7698 08-SEP-81        1500       0        30
          7654 MARTIN     SALESMAN           7698 28-SEP-81        1250       1400        30
          7839 KING       PRESIDENT         17-NOV-81        5000              10
          7900 JAMES      CLERK           7698 03-DEC-81         950              30
          7902 FORD       ANALYST           7566 03-DEC-81        3000              20
         EMPNO ENAME      JOB            MGR HIREDATE         SAL       COMM     DEPTNO
          7934 MILLER     CLERK           7782 23-JAN-82        1300              10
          7788 SCOTT      ANALYST           7566 19-APR-87        3000              20
          7876 ADAMS      CLERK           7788 23-MAY-87        1100              20
    14 rows selected.
      1  WITH c_set AS
      2   (SELECT deptno, hiredate FROM emp WHERE hiredate BETWEEN DATE '1981-03-01' AND DATE '1981-03-30' AND deptno = 30)
      3  SELECT * FROM c_set
      4  UNION ALL
      5  SELECT deptno, MAX(hiredate)
      6   FROM  emp
      7   WHERE hiredate <= DATE '1981-03-30'
      8   AND   deptno = 30
      9   AND   0 = (SELECT COUNT(*) FROM c_set WHERE hiredate BETWEEN DATE '1981-03-01' AND DATE '1981-03-30' AND deptno = 30)
    10*  GROUP BY deptno
    SQL> /
        DEPTNO HIREDATE
         30 22-FEB-81
    SQL> ed
    Wrote file afiedt.buf
      1  WITH c_set AS
      2   (SELECT deptno, hiredate FROM emp WHERE hiredate BETWEEN DATE '1981-03-01' AND DATE '1981-05-30' AND deptno = 30)
      3  SELECT * FROM c_set
      4  UNION ALL
      5  SELECT deptno, MAX(hiredate)
      6   FROM  emp
      7   WHERE hiredate <= DATE '1981-05-30'
      8   AND   deptno = 30
      9   AND   0 = (SELECT COUNT(*) FROM c_set WHERE hiredate BETWEEN DATE '1981-03-01' AND DATE '1981-05-30' AND deptno = 30)
    10*  GROUP BY deptno
    SQL> /
        DEPTNO HIREDATE
         30 01-MAY-81

  • PL/SQL ORA-00936 missing expression

    Hello all,
    I'm having an issues and need help with this script... Please help, thanks.
    error:
    ====
    31 32 /
    AST_UPDATED_BY,LAST_UPDATE_LOGIN) values(i,'ERROR_LOG_ID'||i, 'PROCEDURE_NAME'||i||, 'REQUEST_ID' |i||, 'PROCESS_NAME' ||i||, 'ERROR_TYPE'|i|, 'MESSAGE_DETAILS' ||i||, 'ERROR_TIMESTAMP' |i|, 'STATUS' ||i||, 'CREATED_BY' ||i||, 'CREATION_DATE' ||i||, "to_char(last_update_date, 'dd-Mon-yyyy hh:mi:ss')" |i|, 'LAST_UPDATED_BY' ||i||, 'LAST_UPDATE_LOGIN');
    ERROR at line 28:
    ORA-06550: line 28, column 84:
    PL/SQL: ORA-00936: missing expression
    ORA-06550: line 27, column 1:
    PL/SQL: SQL Statement ignored
    script.
    ====
    declare
    CURSOR c_iostats IS
    SELECT * from XXFRO.XXFRO_ERRORS;
    ERROR_LOG_ID NUMBER;
    PROCESS_NAME VARCHAR2(50);
    ERROR_TYPE VARCHAR2(20);
    STATUS VARCHAR2(20);
    MESSAGE_DETAILS VARCHAR2(2000);
    ERROR_LOG_ID NUMBER;
    PROCEDURE_NAME VARCHAR2(50);
    REQUEST_ID NUMBER;
    PROCESS_NAME VARCHAR2(50);
    ERROR_TYPE VARCHAR2(20);
    MESSAGE_DETAILS VARCHAR2(2000);
    ERROR_TIMESTAMP DATE;
    STATUS VARCHAR2(20);
    CREATED_BY NUMBER;
    CREATION_DATE DATE;
    LAST_UPDATE_DATE DATE;
    LAST_UPDATED_BY NUMBER;
    LAST_UPDATE_LOGIN NUMBER;
    Begin
    for i in 1..1000000 LOOP
    insert into IO_TEST(ERROR_LOG_ID
    ,PROCEDURE_NAME
    ,REQUEST_ID
    ,PROCESS_NAME
    ,ERROR_TYPE
    ,MESSAGE_DETAILS
    ,ERROR_TIMESTAMP
    ,STATUS,CREATED_BY
    ,CREATION_DATE
    ,LAST_UPDATE_DATE
    ,LAST_UPDATED_BY
    ,LAST_UPDATE_LOGIN)
    values(i,'ERROR_LOG_ID'||i, 'PROCEDURE_NAME'||i||, 'REQUEST_ID' |i||, 'PROCESS_NAME' ||i||, 'ERROR_TYPE'|i|, 'MESSAGE_DETAILS' ||i||, 'ERROR_TIMESTAMP' |i|, 'STATUS' ||i||, 'CREATED_BY' ||i||, 'CREATION_DATE' ||i||,'LAST_UPDATE_DATE' ||i||, 'LAST_UPDATED_BY' ||i||, 'LAST_UPDATE_LOGIN');
    END LOOP;
    end;
    Thanks,
    HCDBA

    Hi,
    Why are you using the concat(||) Symbol after i in the expression String 'CREATED_BY' ||i||. When you are padding between
    two text we use so.
    Ex: If you want to concat 'i' between String we use
    DBMS_OUTPUT.PUT_LINE('Five is between '|| i || 'and Six');The Insert Statement should be re-written as
    INSERT INTO io_test
                (error_log_id, procedure_name, request_id,
                 process_name, ERROR_TYPE, message_details,
                 error_timestamp, status, created_by,
                 creation_date, last_update_date,
                 last_updated_by, last_update_login
         VALUES (i, 'ERROR_LOG_ID' || i, 'PROCEDURE_NAME' || i,
                  'REQUEST_ID' || i, 'PROCESS_NAME' || i, 'ERROR_TYPE' || i,
                  'MESSAGE_DETAILS'
                  || i, 'ERROR_TIMESTAMP' || i, 'STATUS' || i,
                  'CREATED_BY' || i, 'CREATION_DATE' || i,
                  'LAST_UPDATE_DATE' || i, 'LAST_UPDATED_BY' || i,
                 'LAST_UPDATE_LOGIN'
                );Thanks,
    Shankar

  • Issue in Database trigger for HZ_CUSTOMER_PROFILES PL/SQL: ORA-00936: miss

    Hi
    We are trying to create database trigger on update of table HZ_CUSTOMER_PROFILES when CREDIT_HOLD='Y'
    If this update is done from certain operating unit we are inserting into another custom table when compiling trigger we are getting error as given below
    LINE/COL ERROR
    5/2 PL/SQL: SQL Statement ignored
    17/2 PL/SQL: ORA-00936: missing expression
    SQL> l 5
    5*
    SQL> l 17
    17* COUNTRY,
    Copying code used for creating trigger
    CREATE OR REPLACE TRIGGER "APPS"."SDS_CREDIT_HOLD_ROW"
    BEFORE UPDATE ON HZ_CUSTOMER_PROFILES
    FOR EACH ROW
    WHEN ( new.CREDIT_HOLD='Y')
    BEGIN
    IF FND_PROFILE.VALUE('ORG_ID')=3217 THEN
    INSERT INTO SDS.SDS_CREDIT_HOLD
    (CUSTOMER_NAME,
    CUSTOMER_NUMBER,
    ADDRESS,
    CITY,
    COUNTRY,
    HOLD_BY,
    MAIL_LIST1,
    RESP_VALUE,
    ORG_ID,
    MAIL_LIST2)
    VALUES
    (select rc.customer_name,
    rc.customer_number,
    ra.address1,
    ra.city,
    ra.country,
    fu.user_name,
    fu.email_address,
    TO_NUMBER(FND_GLOBAL.RESP_ID),
    TO_NUMBER(fnd_profile.value('ORG_ID')),
    SDS_EMAIL_ADD_FNC('KAMALAKAR.GUDAPAREDDI,BRIAN.MILLER')
    from HZ_CUSTOMER_PROFILES hcp, ra_site_uses rsa,
    ra_addresses ra, ra_customers rc, fnd_user fu,
    (select distinct site_use_id from HZ_CUST_SITE_USES where site_use_code='BILL_TO'
    and status='A') site_acct
    where hcp.status='A'
    and cust_account_id in (select distinct cust_account_id from HZ_CUSTOMER_PROFILES
    where credit_hold='Y'
    and status='A')
    and hcp.site_use_id=rsa.site_use_id (+)
    and rsa.address_id=ra.address_id (+)
    and rsa.site_use_id= site_acct.site_use_id (+)
    and hcp.cust_Account_id=rc.customer_id
    and hcp.credit_hold='Y'
    and hcp.last_updated_by=fu.user_id
    and hcp.CUST_ACCOUNT_PROFILE_ID=:new.CUST_ACCOUNT_PROFILE_ID
    and hcp.ROWID=:new.ROWID);
    END IF;
    -- commit;
    END SDS_CREDIT_HOLD_ROW;
    tried to search for fix in forums checked all columns in select clause and insert they appear to be fine attaching table structure also for reference
    CREATE TABLE SDS_CREDIT_HOLD
    (CUSTOMER_NAME VARCHAR(50),
    CUSTOMER_NUMBER VARCHAR2(30),
    ADDRESS VARCHAR2(240),
    CITY VARCHAR2(60),
    COUNTRY VARCHAR2(60),
    HOLD_BY VARCHAR2(100),
    MAIL_LIST1 VARCHAR2(240),
    RESP_VALUE NUMBER,
    ORG_ID NUMBER,
    MAIL_LIST2 VARCHAR2(240))
    if any hint for fixing this issue it will be highly appreciated
    Thanks
    Kamalakar.G

    Problem is here:
    WHEN ( new.CREDIT_HOLD='Y')
    Should be using a colon in front of any new or old columns in your PL/SQL and SQL, thus try this:
    WHEN ( :new.CREDIT_HOLD='Y')
    FYI: when using triggers (unless you specify otherwise in the trigger definition itself):
    old values are referenced via :old.column and new values via :new.column

  • ORA-06550: line 1, column 17: PL/SQL: ORA-00936: missing expression ORA-06550: line 1, column 9: PL/SQL: SQL Statement ignored

    Here is tthe code:
    begin
    declare
      p varchar2(32767) := null;
      l_clob clob;
      l_length number := 1;
    begin
    p:=p||'F|#OWNER#:QS_SPECIFICHHNO:P2_HHNO:HHNO';
    wwv_flow_api.create_page_process(
      p_id     => 1223125545905315 + wwv_flow_api.g_id_offset,
      p_flow_id=> wwv_flow.g_flow_id,
      p_flow_step_id => 2,
      p_process_sequence=> 1,
      p_process_point=> 'AFTER_SUBMIT',
      p_process_type=> 'DML_FETCH_ROW',
      p_process_name=> 'Fetch Row from QS_SPECIFICHHNO',
      p_process_sql_clob => p,
      p_process_error_message=> 'Unable to fetch row.',
      p_process_success_message=> '',
      p_process_is_stateful_y_n=>'N',
      p_runtime_where_clause=>'WHERE ( ( (HHNO) = P2_HHNO ) )',
      p_process_comment=>'');
    end;
    null;
    end;
    I execute it as follows in SQL Developer:
    select * from QS_SPECIFICHHNO
    WHERE ( ( (HHNO) = &P2_HHNO ) )
    No problem:  I receive exactyl one row in my result set which is what I expect.
    I think (definitely correct me if I am wrong)  Apex is complaining about the following line of code:
    p:=p||'F|#OWNER#:QS_SPECIFICHHNO:P2_HHNO:HHNO';
    It is complaining about a missing expession line 1 ccolumn 9  -   |#OWNER#:
    This is an Automatic Fetch query.  P2_HHNO is a simple text field where the user enters a primary key value (Household Number)
    The household number is used in the where clause of the QS_SPECIFICHHNO view.
    Here is the view:
    CREATE OR REPLACE FORCE VIEW "CASETRANS"."QS_SPECIFICHHNO" ("HHNO","CNAME","PDATE","TDATE","AGE","INWORKNO","ONWORKNO","ONCPS","ONYTHSRV","CPA","TMSUCCESS","VOL","D_N","DLQ","TRU","VPA","PA5","PA46","CPC","COOHPA4","COOHPA5","KINPA5","KINPA4","COOH","CKIN") AS
      SELECT HHNO,
             CNAME,
             PDate,
             TDate,
             msaccess_utilities.datediff('d', PDate, TDate, 0) Age,
             InWorkNo,
             OnWorkNo,
             OnCPS,
             OnYthSrv,
             CPA,
             TmSuccess,
             Vol,
             D_N,
             DLQ,
             TRU,
             VPA,
             PA5,
             PA46,
             CPC,
             COOHPA4,
             COOHPA5,
             KINPA5,
             KINPA4,
             COOH,
             CKIN
        FROM CaseTransfers
        ORDER BY CaseTransfers.HHNo,
                 CaseTransfers.PDate DESC

    'F|#OWNER#:QS_SPECIFICHHNO:P2_HHNO:HHNO'
    Is perfectly valid, it is an APEX DML string
    F = Fetch
    #OWNER# = the schema from the workspace
    QS_SPECIFICHHNO = the table/view
    P2_HHNO = The APEX item to match with the key
    HHNO = The key in the table/view
    The p_runtime_where_clause appears to be invalid;
    a) The "WHERE" keyword is not necessary, also it should be '&P2_HHNO.' not '&P2_HHNO'
    b) The record should have already matched using the DML string
    Try deleting the runtime_where_clause, it should then work.
    regards,

  • Unix Shell Script -- ORA-00905 error in pl/sql

    Below is my unix shell script .... in which i am trying to caluclate difference between time stamps ..... i am getting a severe error when i run --- ORA-00905: missing keyword ( included it bottom of this post )
    please look into this and let me know where to correct ....
    much appreciated in adv
    ~~~~~~~~~~~~~~~~~~~~~START of Script~~~~~~~~~~~~~~~~~~~~
    #!/bin/ksh
    export readTime checkTime timeDiff
    # Get initial Time
    readTime=`sqlplus -s scott/tiger@database <<EOF
    whenever sqlerror exit 1
    set escape off
    set head off
    set verify off
    select SYSTIMESTAMP from dual;
    EOF
    `
    echo "readTime value is : $readTime"
    # Get end of time
    checkTime=`sqlplus -s scott/tiger@database <<EOF
    whenever sqlerror exit 1
    set escape off
    set head off
    set verify off
    select SYSTIMESTAMP from dual;
    EOF
    `
    echo "value of checkTime : $checkTime"
    # calculate time diff
    timeDiff=`sqlplus -s scott/tiger@database <<EOF
    whenever sqlerror exit 1
    set escape off
    set head off
    set verify off
    select CAST(TO_DATE('$time2','''YYYY\/MM\/DD:HH24:MI:SS'''))-CAST(TO_DATE('$VAR1','YYYY-MM-DD:HH24:MI:SS')) from dual;
    EOF
    `
    echo "value of timeDiff : $timeDiff"
    ~~~~~~~~~~~~~~~~~OUTPUT here ~~~~~~~~~~~~~~~~~~~~~~~
    readTime value is :
    02-DEC-05 12.07.53.779328 AM -06:00
    value of checkTime :
    02-DEC-05 12.07.54.013613 AM -06:00
    value of timeDiff : 02-DEC-05 12.07.54.013613 AM -06:00','''YYYY\/MM\/DD:HH24:MI:SS'''))-CAST(TO_DATE('
    ERROR at line 2:
    ORA-00905: missing keyword

    You didn't specify if you want a total time for a portion of a shell script, or the whole script in general. If you only want to know the time of the whole shell script, just reference the linux/unix built-in variable ${SECONDS}. This variable is reset for each PID.
    I usually add these lines to the bottom of long running shell scripts (just before an exit code):
    ~~~~~~~~~~~~~~~~~~~~~~~~~
    ((TIME = ${SECONDS} / 60))
    echo "Script ran for ${TIME} minutes. (${SECONDS} seconds total.)
    ~~~~~~~~~~~~~~~~~~~~~~~~~
    Like I said, ${SECONDS} starts ticking from 0 when you start the script, so no need to export the variable, just reference it. The nice part is that you don't have to bother getting into sqlplus and hit the database.

Maybe you are looking for

  • More Questions on Rules in General

    Okay so here is my situation.  I have a user that is wanting to use either Public folders or a shared mailbox to automate a series of manual processes.  For example: A customer service rep(CSR) takes a call asking for x to be completed. CSR than send

  • White screen after a command line IPA creation

    Hello, I am working on an iPad application. I use several swc files as library assets for my visual elements. I compile my swf with Flex SDK using FlashDevelop and then with command line PFI to generate the final IPA. My IPA application is generated

  • HT2479 My Macbook Pro is not letting me import videos from my camera or usb to work on iMovie. How can I fix this?

    I recently bought a Macbook Pro because I like working with imovie. The first day that I started working on imovie, I imported some videos from my camera to the computer with no problem. But after I closed imovie and started working on that same proj

  • Decode in an insert statement

    Is it possible to use decode base on a pl/sql variable in field declaration of an insert statement? For example: INSERT INTO emp_schedule (employee_id, schedule_date, destination, start_time, absent, late, entry_date_time, decode(v_bucket_id, 1, buck

  • How to make header background image scaleable on all devices

    I have a image that is 1920 by 700 px (1920 being the width of my laptops screen full size) that I want to use as a background for a header that is 1920 by 700 px. When I preview the full screen in chrome browers it scales great but when I check the