00900 invalid SQL statement error

I am myself to write stored procedures, teacher in TOAD 10.5 with Oracle 10 g. I get the error ORA-00900: invalid SQL statement. Here's the code, cut to the minimum sample size strip. I don't see where I'm doing something wrong.

If I cut out the slider (take it down to just "Begin" and "End"), it runs, but I don't see anything wrong with the cursor.

Any ideas?

CREATE OR REPLACE PROCEDURE IN_PROCESS_CASES_BOS
IS
V_HELLO VARCHAR2 (10);

CURSOR C_MAIN IS
SELECT 'HELLO' FROM DUAL;

BEGIN

C_MAIN OPEN;

LOOP
EXTRACT THE C_MAIN IN V_HELLO;

WHEN THE OUTPUT C_MAIN % NOTFOUND;

END LOOP;

CLOSE C_MAIN;
END;
END IN_PROCESS_CASES_BOS;
/
select * from user_errors;

NAME                           TYPE           SEQUENCE       LINE   POSITION
------------------------------ ------------ ---------- ---------- ----------
TEXT
--------------------------------------------------------------------------------
ATTRIBUTE MESSAGE_NUMBER
--------- --------------
IN_PROCESS_CASES_BOS           PROCEDURE             1         21          1
PLS-00103: Encountered the symbol "END"
ERROR                103

You have an extra END; Remove it and the procedure compiles and runs.

Tags: Database

Similar Questions

  • I'm getting "ORA-00900: invalid SQL statement" error. ?

    I installed oracle 11 GR 2. and 'DBMS_METADATA_DIFF.COMPARE_ALTER ('TABLE', 'TBL_A', 'TBL_A','USER1 ','USER2 ')"to see the result as below, but I'm" ORA-00900: invalid SQL statement "error.   Any idea?



    I use:


    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

    AMT for 32-bit Windows: Version 11.2.0.1.0 - Production

    NLSRTL Version 11.2.0.1.0 - Production




    SQL > desc user1.tbl_a
    Name                                      Null?    Type
    ----------------------------------------- -------- ----------------------------
    FIELD_A1 NOT NULL NUMBER
    FIELD_A2 VARCHAR2 (20)
    FIELD_A4 NOT NULL NUMBER (5.2)
    FIELD_A5 VARCHAR2 (10)
    FIELD_A6 NOT NULL NUMBER (2)

    SQL > desc user2.tbl_a
    Name                                      Null?    Type
    ----------------------------------------- -------- ----------------------------
    FIELD_A1 NOT NULL NUMBER
    FIELD_A2 VARCHAR2 (50)
    FIELD_A3                                           DATE
    FIELD_A4 NUMBER (5.2)
    FIELD_A5 NOT NULL VARCHAR2 (10)




    SQL > select dbms_metadata_diff.compare_alter ('TABLE', 'TBL_A', 'TBL_A', 'USER1', 'USER2') of double

    expected result:

    DBMS_METADATA_DIFF.COMPARE_ALTER ('TABLE', 'TBL_A', 'TBL_A', 'U1', 'U2')
    --------------------------------------------------------------------------------
    ALTER TABLE 'U1 '. "" ADD TBL_A "(DATE OF THE"FIELD_A3")
    ALTER TABLE 'U1 '. "" TBL_A "DROP ("FIELD_A6")
    ALTER TABLE 'U1 '. "" CHANGE TBL_A ' ("FIELD_A2' VARCHAR2 (50))
    ALTER TABLE 'U1 '. "" TBL_A ' CHANGE ("FIELD_A4" NUMBER (5.2) DEFAULT 0)
    ALTER TABLE 'U1 '. "" CHANGE TBL_A ' ('FIELD_A4' NULL)
    ALTER TABLE 'U1 '. "" CHANGE TBL_A ' ('FIELD_A5' ACTIVATE NOT NULL)

    Thanks for the reply rp,

    I got the result using "select dbms_metadata_diff.compare_alter ('TABLE', 'TBL_A', 'TBL_A', 'USER1', 'USER2') from dual"

  • error SQL ORA-00900: invalid SQL statement

    Hi all

    I'm new to sql and I'm trying to solve this problem, I have here.

    When I run this query (1) I get this message: ORA-00900: invalid SQL statement

    Query: 1


    WITH t1
    AS (SELECT CID,
    TYPE,
    TO_CHAR)
    TO_DATE (' 00:00:00 ', 'HH24:MI:SS')
    + (lg_end_time - lg_start_time).
    Call_time 'HH24:MI:SS'),
    ROW_NUMBER)
    COURSES (SORTING CID CID NULLS FIRST PARTITION)
    AS call_id1
    OF test_1
    )
    SELECT SUM (call_time)
    FROM t1;
    output:
    I get the error: ORA-01722: invalid number




    table structure:

    Select * form test_1;

    CID TYPE LG_END_TIME LG_START_TIME
    1508643 expedition 2012/12/03 14:05 2012/12/03 14:02
    1508643 treatment 2012/12/03 14:00 03/12/2012 14:00
    1508643 initiation 2012/12/03 14:00 03/12/2012 14:00
    1508662 expedition 2012/12/03 14:18 2012/12/03 14:16
    1508662 initiation 2012/12/03 14:01 03/12/2012 14:01
    1508662 treatment 2012/12/03 14:02 03/12/2012 14:01
    1508643 expedition 2012/12/03 14:02 03/12/2012 14:00
    1508662 expedition 2012/12/03 14:16 2012/12/03 14:02

    Thanks for your help

    I think this example might help.

    SQL> select decode(call_id1,99,null,cid)        cid,
      2         decode(call_id1,99,null,type)       type,
      3         decode(call_id1,99,null,to_char(call_time,'hh24:mi:ss'))  call_time,
      4         decode(call_id1,99,null,substr(call_id1,1,5))   call_id1,
      5         total_time
      6    from (select cid,
      7                 type,
      8                 call_time,
      9                 call_id1,
     10                 total_time
     11            from (select cid,
     12                         type,
     13                         call_time,
     14                         call_id1,
     15                         null total_time
     16                    from (SELECT CID ,
     17                                 TYPE,
     18                                 to_date(TO_CHAR (TO_DATE ('00:00:00', 'HH24:MI:SS') +
     19                                        (lg_end_time - lg_start_time),'HH24:MI:SS'),'HH24:MI:SS') call_time,
     20                                 ROW_NUMBER () OVER (PARTITION BY CID ORDER BY CID NULLS FIRST) AS call_id1
     21                            FROM test_1 ) t1
     22                  union all
     23                  select cid,
     24                         null type,
     25                         null call_time,
     26                         99   call_id1,
     27                         lpad(hours,2,'0')||':'||lpad(minutes,2,'0')||':'||lpad(seconds,2,'0') total_time
     28                    from (select cid,
     29                                 sum(to_number(to_char(call_time,'hh24'))) +
     30                                     trunc((sum(to_number(to_char(call_time,'mi'))) +
     31                                     (trunc(sum(to_number(to_char(call_time,'ss')))/60)))/24) hours,
     32                                 sum(to_number(to_char(call_time,'mi'))) +
     33                                    (trunc(sum(to_number(to_char(call_time,'ss')))/60)) minutes,
     34                                 (sum(to_number(to_char(call_time,'ss'))) -
     35                                     ((trunc(sum(to_number(to_char(call_time,'ss')))/60)) * 60)) seconds
     36                            from (SELECT CID ,
     37                                         TYPE,
     38                                         to_date(TO_CHAR (TO_DATE ('00:00:00', 'HH24:MI:SS') +
     39                                                (lg_end_time - lg_start_time),'HH24:MI:SS'),'HH24:MI:SS') call_time,
     40                                         ROW_NUMBER () OVER (PARTITION BY CID ORDER BY CID NULLS FIRST) AS call_id1
     41                                    FROM test_1 ) t1
     42                          group by cid) )
     43          order by cid, call_id1 );
    
    CID                                      TYPE                 CALL_TIME CALL_ID1 TOTAL_TIME
    ---------------------------------------- -------------------- --------- -------- ----------
    1508643                                  Dispatching          00:02:06  1
    1508643                                  Initiation           00:00:00  2
    1508643                                  Treatment            00:00:39  3
    1508643                                  Dispatching          00:02:50  4
                                                                                     00:05:35
    1508662                                  Treatment            00:01:03  1
    1508662                                  Initiation           00:00:00  2
    1508662                                  Dispatching          00:13:17  3
    1508662                                  Dispatching          00:02:43  4
                                                                                     00:17:03
    
    10 rows selected
    
    SQL> 
    
  • to DECLARE * ERROR at line 1: ORA-00900: invalid SQL statement

    This works fine when I use the System user to create a schema and then run this script.
    When I create another user with grant connect, resources, create view permissions I get this error:

    DECLARE
    *

    ERROR on line 1:
    ORA-00900: invalid SQL statement
    ORA-06512: at...


    DECLARE
    ID MY_TABLE.ID%TYPE;
    tNom my_table. % TABLENAME TYPE;
    PName MY_TABLE_TWO. PROPERTYNAME % TYPE;
    CURSOR c1 IS
    SELECT distinct evt.id, evt. TABLENAME, vid.propertyname
    FROM my_table evt, vid MY_TABLE_TWO
    WHERE the evt. COL_1 = 1
    AND evt. COL_2 = vid. COL_2
    and not exists (select facts FROM MY_TABLE_THREE 1)
    where evt.id = facts.eventid and facts.displayname = vid.propertyname);
    BEGIN
    OPEN c1;
    LOOP
    FETCH c1 INTO id, tNom, pname;
    OUTPUT WHEN c1% NOTFOUND;
    INSERT INTO MY_TABLE_THREE (ID, COLUMNLENGTH)
    VALUES (S_ANALYTICS_SEQUENCE.nextval, 255);
    RUN IMMEDIATELY 'ALTER TABLE ' | tNom | 'Add ' | PName | ' _ NVARCHAR2 (255);
    END LOOP;
    CLOSE c1;
    END;

    Hello

    Maybe missing a privilege. If I were you, I'll try this first:

    DECLARE
       id    MY_TABLE.ID%TYPE;
       tname MY_TABLE.TABLENAME%TYPE;
       pname MY_TABLE_TWO.PROPERTYNAME%TYPE;
       CURSOR c1 IS
          SELECT DISTINCT evt.id,
                          evt.TABLENAME,
                          vid.propertyname
            FROM MY_TABLE     evt,
                 MY_TABLE_TWO vid
           WHERE evt.COL_1 = 1
             AND evt.COL_2 = vid.COL_2
             AND NOT EXISTS (SELECT 1
                    FROM MY_TABLE_THREE facts
                   WHERE evt.id = facts.eventid
                     AND facts.displayname = vid.propertyname);
    BEGIN
       OPEN c1;
       LOOP
          FETCH c1
             INTO id, tname, pname;
          EXIT WHEN c1%NOTFOUND;
          INSERT INTO MY_TABLE_THREE
             (ID,
              COLUMNLENGTH)
          VALUES
             (S_ANALYTICS_SEQUENCE.NEXTVAL,
              255);
          DBMS_OUTPUT.put_line('ALTER TABLE ' || tname || ' add ' || pname ||
                               '_ NVARCHAR2(255)');
          --EXECUTE IMMEDIATE 'ALTER TABLE ' || tname || ' add ' || pname || '_ NVARCHAR2(255)';
       END LOOP;
       CLOSE c1;
    EXCEPTION
       WHEN OTHERS THEN
          DBMS_OUTPUT.put_line(SQLERRM);
    END;
    /
    

    Using this approach, you can see the sentences to run without run, I also added an exception block.

    Kind regards

  • ORA-00900 invalid SQL statement

    Hello

    I'm under code below

    Start

    for c_masteraccntfirmcustid in (select regexp_substr (substr (substr ("AND WB0. MASTERACCNTFIRMCUSTID (742254777, 2531215, 2568091)', instr ("AND WB0. MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091) ',' (()) + 1), length 0, (substr ("AND WB0. MASTERACCNTFIRMCUSTID (742254777, 2531215, 2568091)', instr ("AND WB0. MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091) ',' (()) + 1))-1), "[^,] (+', 1, level) col_val of the double connection by regexp_substr (substr (substr ("AND WB0. " MASTERACCNTFIRMCUSTID (742254777, 2531215, 2568091)', instr ("AND WB0. MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091) ',' (()) + 1), length 0, (substr ("AND WB0. MASTERACCNTFIRMCUSTID (742254777, 2531215, 2568091)', instr ("AND WB0. MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091) ',' (()) + 1))-1), "[^,] (+', 1, level) is not null)"

    loop
    dbms_output.put_line (c_masteraccntfirmcustid.col_val);
    -dbms_output.put_line ('Hi');
    end loop;
    end;

    This gives me the Ora-900

    but under work

    Select regexp_substr (substr (substr ("AND WB0. MASTERACCNTFIRMCUSTID (742254777, 2531215, 2568091)', instr ("AND WB0. MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091) ',' (()) + 1), length 0, (substr ("AND WB0. MASTERACCNTFIRMCUSTID (742254777, 2531215, 2568091)', instr ("AND WB0. MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091) ',' (()) + 1))-1), "[^,] (+', 1, level) col_val of the double connection by regexp_substr (substr (substr ("AND WB0. " MASTERACCNTFIRMCUSTID (742254777, 2531215, 2568091)', instr ("AND WB0. MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091) ',' (()) + 1), length 0, (substr ("AND WB0. MASTERACCNTFIRMCUSTID (742254777, 2531215, 2568091)', instr ("AND WB0. MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091) ',' (()) + 1))-1), "[^,] (+', 1, level) is not null"

    The requirement is AND WB0. MASTERACCNTFIRMCUSTID (742254777, 2531215, 2568091), this string I need

    742254777

    2531215

    2568091

    one by one and then I'll create a dynamic SQL for each of these values.

    Could you please help?

    Thank you

    Patricia

    I have run your PL/SQL block, but do not make a mistake.

    What is your version of the database?

    BEGIN
      FOR c_masteraccntfirmcustid                                                                                                                                                    IN
      (SELECT regexp_substr(SUBSTR(SUBSTR('AND WB0.MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091)',
             instr('AND WB0.MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091)','(')+1), 0, LENGTH(SUBSTR('AND WB0.MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091)',
             instr('AND WB0.MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091)','(')+1))-1),'[^,]+', 1, level) col_val
      FROM dual
        CONNECT BY regexp_substr(SUBSTR(SUBSTR('AND WB0.MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091)',instr('AND WB0.MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091)','(')+1), 0,
        LENGTH(SUBSTR('AND WB0.MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091)',instr('AND WB0.MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091)','(')+1))-1), '[^,]+', 1, level) IS NOT NULL
      )
      LOOP
        dbms_output.put_line(c_masteraccntfirmcustid.col_val);
        --dbms_output.put_line('Hi');
      END LOOP;
    END;
    
  • ORA-00900: the SQL statement invalid when you run for immediate assistance.

    Hello
    I write code simple db is 9.2.0.8
    create or replace procedure gather_part_stats(p_schema in varchar2, p_table in varchar2)
    as
    l_quarter varchar2(8) := to_char(sysdate, '"Y"YYYY"_Q"q') ;
    l_sql varchar2(2000) := 'exec dbms_stats.gather_table_stats(:schema, :table, method_opt => ''for all columns size 1'' , cascade => true , estimate_percent => 1 , granularity => ''PARTITION'', partname=>:part);';
    begin
    dbms_output.put_line('l_quarter: ' || l_quarter);
    dbms_output.put_line(l_sql);
    execute immediate l_sql using in p_schema, in p_table, in l_quarter ;
    end;
    /
    Trying to collect statistics of the table with the selected partition but mess up something with... something :)
    I use use to avoid sql injection, please advice.

    Error is:
    SQL > gather_part_stats exec ('TEST', 'TEST');
    l_quarter: Y2012_Q2
    exec dbms_stats.gather_table_stats (: schema,: table, method_opt = > ' for all columns size 1', cascade = > true, estimate_percent = > 1, granularity = > 'PARTITION', partname = >: part);
    BEGIN gather_part_stats ('TEST', 'TEST'); END;

    *
    ERROR on line 1:
    ORA-00900: invalid SQL statement
    ORA-06512: at the 'INSTALL '. GATHER_PART_STATS', line 8
    ORA-06512: at line 1

    Concerning
    GregG

    You must use the dynamic PL/SQL

    create or replace procedure gather_part_stats(p_schema in varchar2, p_table in varchar2)
    as
    l_quarter varchar2(8) := to_char(sysdate, '"Y"YYYY"_Q"q') ;
    l_sql varchar2(2000) := 'begin dbms_stats.gather_table_stats(ownname=>:schema, tabname=>:table, method_opt => ''for all columns size 1'' , cascade => true , estimate_percent => 1 , granularity => ''PARTITION'', partname=>:part); end;';
    begin
    dbms_output.put_line('l_quarter: ' || l_quarter);
    dbms_output.put_line(l_sql);
    execute immediate l_sql using in p_schema, in p_table, in l_quarter ;
    end;
    / 
    
  • ORA-00900 - the SQL commands: invalid SQL statement

    Hello world
    I installed Oracle Xe on a Centos 5.5 host yesteday.
    Installation was Ok, I can connect to the web interface on "http://127.0.0.1:8080 / apex / '.
    But when I want to use sql commands, regardless of the input control, I have the "ORA-00900: invalid SQL statement" message.
    I can enter the command "Show all", for example, in a terminal after SQL > command prompt, it works... but not in the web interface...
    I tried to import the .sql, script trought the web interface, no much result, no display in the window.
    Can someone help me,
    Thank you

    Show all is NOT a SQL command is a command that I think, not a command from pl/sql, sql more... Why not try to do a select on a table is know YOU the schema...

    Thank you

    Tony Miller
    Webster, TX

  • Invalid SQl statement

    I am getting error - ORA-00900: invalid SQL statement when executing the following statement:
    SELECT * FROM CUSTOMER
    Sanjay

    Have you looked at the suggestions of fanny?
    You can try selecting ANY table in a DIFFERENT pattern?

    You have not provided your version of DB, try and throw more light on the issue, otherwise its going to be the exercise trail and error.

  • Get the SQL statement error programmatically

    Hello

    error SQL in the FORMS, you can display the erroneous SQL statement pressing (shift) (Ctrl) E on the screen. Is there a way to get the text of the SQL statement in a PL/SQL function for logging purposes?

    I get the error using SQLERRM, it's not a problem. But how can I get the SQL text of the statement?

    Thanks and regards,

    Sascha

    Sascha,

    You should be able to use the: SYSTEM. System LAST_QUERY variable forms.

    Craig...

  • ORA-00900: invalid SQL ORA-06512 statement: on line 57

    I Wast trying to execute this statement

    EXECUTE immediate ' host (mkdir'| direcotry |') ' ;
    My destination path directory. I can't run a host command in plsql

    assuming that your database is installed on the windows platform and you try to create the directory is on the same server. try to create a batch file that takes parameters and use the DBMS_SCHEDULER to run an external command.

    Batch file name make.bat

    @echo off
    mkdir %1
    

    your pl/sql script

    BEGIN
      dbms_scheduler.create_job(job_name   => 'AUTO_CREATE_DIRECTORY',
                                job_type   => 'EXECUTABLE',
                                job_action => 'c:\myscript\make.bat',
                                number_of_arguments => 1,
                                start_date => SYSTIMESTAMP,
                                enabled    => FALSE,
                                comments   => 'Auto Create Directory');
    
      dbms_scheduler.set_job_argument_value('AUTO_CREATE_DIRECTORY', 1, argument_value=> 'mydir');
      dbms_scheduler.enable('AUTO_CREATE_DIRECTORY');
    END;
    /
    

    Note: not tested

  • SQL statement error INSERT The conflicted with the FOREIGN KEY constraint

    I recently installed a reporting for vmware vsphere software, but I get a SQL error. I opened a request for assistance with vmware, but so far they have not come up with a solution. The error is caused by: com.microsoft.sqlserver.jdbc.SQLServerException: instruction INSERT The conflicted with the FOREIGN KEY constraint 'FK_CB_VSM_NETWORK_VC_ID '. The conflict occurred in database 'VCChargebackVCC02', table "dbo." " CB_VSM_SERVER', column 'VC_ID '. I don't know a lot about SQL, so I'm lost in the extent of troubleshooting is concerned. If anyone has any ideas I'd love to hear them.

    SQL questions are better posed on Technet.  They are better equipped to manage the

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

  • SQL statement error

    Hi all


    I have the bit next to the code:

    {if (isset($_GET['record']))}
    $recordEdit = TRUE;
    $sql = "SELECT * FROM titles WHERE the Index =?

    $stmt = $dblink-> stmt_init();
    If ($stmt-> {prepared ($sql))}
    $stmt-> bind_param('i',$_GET['record']);
    $stmt-> bind_result($index,$date,$headline,$description,$newsType,$link);
    $stmt-> execute();
    $stmt-> fetch();

    }

    my code for the $stmt-> prepare ($sql) fails with the following error:

    You have an error in your SQL syntax; consult the manual for your version of the MySQL server for the right syntax to use near 'Index =?'

    How is it, my sql not initialize properly?  I want to bind to the parameter $_Get ['record'], that if I echo on the screen is correct.

    OMG, it has taken a long time for the penny to drop. There is nothing wrong with your basic syntax, but 'Index' should not be used in a column name, because it is a reserved word.

    The best solution is to rename the Index column to something like id or article_id. Otherwise, you must surround the reserved words in backticks:

     $sql = "SELECT * FROM headlines WHERE `Index` =?";
    

    You can find a complete list of words reserved MySQL here: http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html.

  • The SQL statement error - help nicely!

    Was scratchin my head, but cannot yet understand why it's a failure... Try to fill in the use of space for relevant tablespaces: get the below error. Kindly advice?


    9999999.999 free_space_mb column format
    column allocated_mb 9999999.999 format
    used_mb 9999999.999 column format
    column tablespace format a12
    filename format a20 column

    Select ts.name tablespace, file name trim (substr (df.name, 1 100));
    DF.bytes/1024/1024 allocated_mb,
    (((df.bytes/1024/1024) - nvl(sum(dfs.bytes)/1024/1024,0)) used_mb,.
    NVL(sum(DFS.bytes)/1024/1024,0) free_space_mb
    v $ datafile df left outer join dba_free_space dfs
    We df.file # = dfs.file_id join v$ tablespace ts
    We df.ts # = ts.ts #.
    We df.name # = ts.name #.
    and 'ts.name =' DATA_TS
    or 'ts.name =' INDEX_TS
    or 'ts.name =' LOB_TS
    Group of ts.name, df.name, dfs.file_id, df.file #, df.bytes
    order of file name;

    ERROR on line 8:
    ORA-00933: SQL not correctly completed command.

    Hello

    user568296 wrote:
    ...
    Select ts.name tablespace, file name trim (substr (df.name, 1 100));
    DF.bytes/1024/1024 allocated_mb,
    (((df.bytes/1024/1024) - nvl(sum(dfs.bytes)/1024/1024,0)) used_mb,.
    NVL(sum(DFS.bytes)/1024/1024,0) free_space_mb
    v $ datafile df left outer join dba_free_space dfs
    We df.file # = dfs.file_id join v$ tablespace ts
    We df.ts # = ts.ts #.
    We df.name # = ts.name #.
    and 'ts.name =' DATA_TS
    or 'ts.name =' INDEX_TS
    or 'ts.name =' LOB_TS
    Group of ts.name, df.name, dfs.file_id, df.file #, df.bytes
    order of file name;

    ERROR on line 8:
    ORA-00933: SQL not correctly completed command.

    There is a 2nd clause on line 8, WE join the same. 'AND' instead of 'ON', it would make sense to syntaic, but the names of files in v$ datafile are usually superstring of tablespace names in v$ ablespace. In other words, if ts.name (no # at the end) is "DATA_TS", then df.name could be ' D:\ORACLE\ORADATA\DEVELOPMENT\DATA_TS01. DBF'.
    I don't think that you need all of this condition. Try:

    select    ts.name                    tablespace,
           trim (substr (df.name, 1, 100))      filename,
           df.bytes/1024/1024                    allocated_mb,
           ( ( df.bytes / 1024 / 1024)
           - nvl ( sum (dfs.bytes) / 1024 / 1024
                  , 0
                 )
           )                         used_mb,
           nvl ( sum (dfs.bytes) / 1024 / 1024
               , 0
               )                         free_space_mb
    from                     v$datafile          df
    left outer join      dba_free_space          dfs     on     df.file#     = dfs.file_id
    join                   v$tablespace          ts     on     df.ts#          = ts.ts#
    --                                   AND     df.name          = ts.name     -- AND, not ON
                                       and     ts.name          IN ( 'DATA_TS'
                                                         , 'INDEX_TS'
                                                         , 'LOB_TS'
                                                         )
    group by  ts.name,
                 df.name,
           dfs.file_id,
           df.file#,
           df.bytes
    order by  filename;
    

    It's a bad idea to mix AND and gold at the same level in the same query. In this case, you can use the IN operator to avoid the need where. In other cases, use parentheses to isolate the ANDS of ORS.

  • End of SQL statement error

    Hello

    I am trying to use a command to update to store the values in the column number of days.

    Don't know why it keep saying there is syntax error

    It is in the Source region of a report.
    Select
    "ID."
    '' BANK. ''
    "FDATE."
    "FFICHIER,"
    "CLERK."
    "MORTGAGE_FILE_NUMBER,"
    "MORTGAGOR."
    "PROPERTY_ADDRESS,"
    "OCCUPATION."
    "INSURED."
    "COMMISSION."
    "READY."
    "PM_COST,"
    "NUMBER_OF_DAYS."
    "PROBLEMATIC."
    "DEGENERATE."
    "LIST_TERM,"
    "CLOSING".
    "registration".
    UPDATED "REGISTRATION".
    "Number_of_Days' = BOX SET
    WHEN 'FDATE' IS NULL NULL THEN
    Else (to_date ("READY", "MM/DD/YYYY '")-to_date ("FDATE","MM/DD/YYYY '))
    END

    Then just run it. Nothing else

    create or replace trigger "PDBL2_T1".
    FRONT
    Insert or update on 'PDBL2 '.
    for each line
    declare
    number of v_number_of_days;
    Start
    IF: NEW. END_DATE IS NULL THEN
    v_number_of_days: = NULL;
    ON THE OTHER
    v_number_of_days: = to_date(:NEW.) End_date, ' DD/MM/YYYY') - to_date(:NEW.) START_DATE, "DD/MM/YYYY");
    END IF;
    : NEW. NUMBER_OF_DAYS: = v_number_of_days;
    end;

    Published by: Sheikh Mehabub on August 8, 2012 07:20

  • Word key missing in to_number conversion in the SQL statement select error

    ORA-00905: lack keyword for the below SQL statement error. It should be of to_number (m.EQUIP_SUB_CLASS_ID, '9999')
    between 3800 and the 3699 where Clause. Is that what I miss in the SQL below?

    SELECT  M.EQUIP_NO,M.EQUIP_CLASS_ID, M.EQUIP_DESCR,M.ORG_ID
      from  MAMIS.EQUIP M
     where M.EQUIP_NO in  (  SELECT  M.EQUIP_NO  from  MAMIS.EQUIP M, MAMIS.ORG O 
    where upper(M.ORG_ID) like upper(O.ORG_ID) 
    and length(replace(translate(M.EQUIP_SUB_CLASS_ID, '0123456789', '000000000'), '0')) is null
    and upper(M.fleet_status) like 'ACTIVE'  
    and upper(M.ORG_ID) not like 'NA'  
    and to_number(m.EQUIP_SUB_CLASS_ID , '9999') 
    between 3699 and 3800  )

    Hello

    I don't see obvious errors.

    Whenever you have a problem, please post a full test script that people can run to recreate the problem and test their ideas. Include CREATE TABLE and INSERT statements for all of the tables involved and the results desired from these data. Format your code so people can read and understand.
    See the FAQ forum {message identifier: = 9360002}

    I saw a couple of things you need to know about Oracle, but none of them would cause an error "Missing key word".

    There is no point in using the LIKE operator if you do use wildcards. For example

    upper (M.fleet_status)      like 'ACTIVE'  
    

    is slower than, but otherwise equivalent to

    upper (M.fleet_status)      = 'ACTIVE'  
    

    What are you trying to do here?

    length ( replace ( translate ( M.EQUIP_SUB_CLASS_ID
                                , '0123456789'
                        , '000000000'
                        )
               , '0'
               )
           )               is null
    

    Want to see if m.equip_sub_class_id consists only of numbers, from ' 0 'to 9'?
    If so, you can simply say

    TRANSLATE ( m.equip_sub_class_id
           , 'X0123456789'
           , 'X'
           )          IS NULL
    

    Depending on your front end, you may need a sem, i-colon (;) the end of your query.

Maybe you are looking for