What's wrong with this sql? ORA-00936: Missing Expression?

SQL> insert into CHECK_LIST(
2 CHK_LST_ID,
3 CHK_LST_NAME,
4 CHK_LST_DESCR,
5 CHK_LST_REC,
6 CHK_LST_FIRST_RUN_DATE,
7 CHK_LST_START_TIME,
8 CHK_LST_DSTOP_TIME,
9 CHK_LST_DWEEK_DAYS_ONLY,
10 CHK_LST_DEVERY,
11 CHK_LST_RESP_TYPE,
12 CHK_LST_RESP_ID,
13 CHK_LST_WEVERY,
14 CHK_LST_WMON,
15 CHK_LST_WTUE,
16 CHK_LST_WWED,
17 CHK_LST_WTHU,
18 CHK_LST_WFRI,
19 CHK_LST_WSAT,
20 CHK_LST_WSUN,
21 CHK_LST_WLOCK_DAYS,
22 CHK_LST_MCHK_DAY_NUMBER,
23 CHK_LST_MDAY_NUMBER,
24 CHK_LST_MDAY_NUMBER_EVERY,
25 CHK_LST_MTHE,
26 CHK_LST_MTHE_DAY,
27 CHK_LST_MTHE_EVERY,
28 CHK_LST_MLOCK_DAYS,
29 CHK_LST_YCHK_EVERY,
30 CHK_LST_YEVERY,
31 CHK_LST_YMONTH_NUMBER,
32 CHK_LST_YTHE,
33 CHK_LST_YTHE_DAY,
34 CHK_LST_YTHE_DAY_MONTH_NUMBER,
35 CHK_LST_YLOCK_DAYS,CHK_LST_MANUAL_INIT
36 )
37 values(
38 1,
39 'Some name here',
40 'Some description here',
41 'd',
42 to_date('2004/01/01 00:00:00','yyyy/mm/dd hh24:mi:ss'),
43 to_date('1999/12/30 07:00:00','yyyy/mm/dd hh24:mi:ss'),
44 to_date('1999/12/30 18:00:00','yyyy/mm/dd hh24:mi:ss'),
45 'Y',
46 ,
47 2,
48 2,
49 ,
50 'N',
51 'N',
52 'N',
53 'N',
54 'N',
55 'N',
56 'N',
57 ,
58 'N',
59 ,
60 ,
61 ,
62 ,
63 ,
64 ,
65 'N',
66 ,
67 ,
68 ,
69 ,
70 ,
71 ,
72 'N'
73 );
to_date('1999/12/30 18:00:00','yyyy/mm/dd hh24:mi:ss'),
ERROR at line 44:
ORA-00936: missing expression

SQL> descr check_list
Name Null? Type
CHK_LST_ID NUMBER
CHK_LST_NAME VARCHAR2(255)
CHK_LST_DESCR CLOB
CHK_LST_REC VARCHAR2(255)
CHK_LST_FIRST_RUN_DATE DATE
CHK_LST_START_TIME DATE
CHK_LST_DSTOP_TIME DATE
CHK_LST_DWEEK_DAYS_ONLY VARCHAR2(1)
CHK_LST_DEVERY NUMBER
CHK_LST_RESP_TYPE NUMBER
CHK_LST_RESP_ID NUMBER
CHK_LST_WEVERY NUMBER
CHK_LST_WMON VARCHAR2(1)
CHK_LST_WTUE VARCHAR2(1)
CHK_LST_WWED VARCHAR2(1)
CHK_LST_WTHU VARCHAR2(1)
CHK_LST_WFRI VARCHAR2(1)
CHK_LST_WSAT VARCHAR2(1)
CHK_LST_WSUN VARCHAR2(1)
CHK_LST_WLOCK_DAYS NUMBER
CHK_LST_MCHK_DAY_NUMBER VARCHAR2(1)
CHK_LST_MDAY_NUMBER NUMBER
CHK_LST_MDAY_NUMBER_EVERY NUMBER
CHK_LST_MTHE NUMBER
CHK_LST_MTHE_DAY NUMBER
CHK_LST_MTHE_EVERY NUMBER
CHK_LST_MLOCK_DAYS NUMBER
CHK_LST_YCHK_EVERY VARCHAR2(1)
CHK_LST_YEVERY NUMBER
CHK_LST_YMONTH_NUMBER NUMBER
CHK_LST_YTHE NUMBER
CHK_LST_YTHE_DAY NUMBER
CHK_LST_YTHE_DAY_MONTH_NUMBER NUMBER
CHK_LST_YLOCK_DAYS NUMBER
CHK_LST_MANUAL_INIT VARCHAR2(1)

Similar Messages

  • What's wrong with this SQL?

    what's wrong with this SQL?
    Posted: Jan 16, 2007 9:35 AM Reply
    Hi, everyone:
    when I insert into table, i use the fellowing SQL:
    INSERT INTO xhealthcall_script_data
    (XHC_CALL_ENDED, XHC_SWITCH_PORT, XHC_SCRIPT_ID, XHC_FAX_SPECIFIED)
    VALUES (SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS'), HH_SWITCHPORT, HH_SCRIPT,'N'
    FROM tmp_healthhit_load WHERE HH_SCRIPT !='BROCHURE' UNION
    SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS'), HH_SWITCHPORT, HH_SCRIPT,'N' FROM tmp_healthhit_load WHERE HH_SCRIPT !='BROCHURE');
    I always got an error like;
    VALUES (SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS'), HH_SWITCHPORT,
    ERROR at line 3:
    ORA-00936: missing expression
    but I can't find anything wrong, who can tell me why?
    thank you so much in advance
    mpowel01
    Posts: 1,516
    Registered: 12/7/98
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 9:38 AM in response to: jerrygreat Reply
    For starters, an insert select does not have a values clause.
    HTH -- Mark D Powell --
    PP
    Posts: 41
    From: q
    Registered: 8/10/06
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 9:48 AM in response to: mpowel01 Reply
    Even I see "missing VALUES" as the only error
    Eric H
    Posts: 2,822
    Registered: 10/15/98
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 9:54 AM in response to: jerrygreat Reply
    ...and why are you doing a UNION on the exact same two queries?
    (SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS') ,HH_SWITCHPORT ,HH_SCRIPT ,'N' FROM tmp_healthhit_load WHERE HH_SCRIPT !='BROCHURE' UNION SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS') ,HH_SWITCHPORT ,HH_SCRIPT ,'N' FROM tmp_healthhit_load WHERE HH_SCRIPT !='BROCHURE');
    jerrygreat
    Posts: 8
    Registered: 1/3/07
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 9:55 AM in response to: mpowel01 Reply
    Hi,
    thank you for your answer, but the problem is, if I deleted "values" as you pointed out, and then execute it again, I got error like "ERROR at line 3:
    ORA-03113: end-of-file on communication channel", and I was then disconnected with server, I have to relogin SQLplus, and do everything from beganing.
    so what 's wrong caused disconnection, I can't find any triggers related. it is so wired?
    I wonder if anyone can help me about this.
    thank you very much
    jerry
    yingkuan
    Posts: 1,801
    From: San Jose, CA
    Registered: 10/8/98
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 9:59 AM in response to: jerrygreat Reply
    Dup Post
    jerrygreat
    Posts: 8
    Registered: 1/3/07
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 10:00 AM in response to: Eric H Reply
    Hi,
    acturlly what I do is debugging a previous developer's scipt for data loading, this script was called by Cron work, but it never can be successfully executed.
    I think he use union for eliminating duplications of rows, I just guess.
    thank you
    jerry
    mpowel01
    Posts: 1,516
    Registered: 12/7/98
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 10:03 AM in response to: yingkuan Reply
    Scratch the VALUES keyword then make sure that the select list matches the column list in number and type.
    1 insert into marktest
    2 (fld1, fld2, fld3, fld4, fld5)
    3* select * from marktest
    UT1 > /
    16 rows created.
    HTH -- Mark D Powell --
    Jagan
    Posts: 41
    From: Hyderabad
    Registered: 7/21/06
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 10:07 AM in response to: jerrygreat Reply
    try this - just paste the code and give me the error- i mean past the entire error as it is if error occurs
    INSERT INTO xhealthcall_script_data
    (xhc_call_ended, xhc_switch_port, xhc_script_id,
    xhc_fax_specified)
    SELECT TO_DATE (hh_end_date || ' ' || hh_end_time, 'MM/DD/YY HH24:MI:SS'),
    hh_switchport, hh_script, 'N'
    FROM tmp_healthhit_load
    WHERE hh_script != 'BROCHURE'
    UNION
    SELECT TO_DATE (hh_end_date || ' ' || hh_end_time, 'MM/DD/YY HH24:MI:SS'),
    hh_switchport, hh_script, 'N'
    FROM tmp_healthhit_load
    WHERE hh_script != 'BROCHURE';
    Regards
    Jagan
    jerrygreat
    Posts: 8
    Registered: 1/3/07
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 11:31 AM in response to: Jagan Reply
    Hi, Jagan:
    thank you very much for your answer.
    but when I execute it, I still can get error like:
    ERROR at line 1:
    ORA-03113: end-of-file on communication channel
    so wired, do you have any ideas?
    thank you very much

    And this one,
    Aother question about SQL?
    I thought I already told him to deal with
    ORA-03113: end-of-file on communication channel
    problem first.
    There's nothing wrong (syntax wise) with the query. (of course when no "value" in the insert)

  • 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

  • Can anybody see what is wrong with this SQL statement?

    Hey guys, just a quick question. Can anybody tell me what is wrong with this line of SQL? I keep getting a syntax error message. I've been trying for ages and I can't see any problem at all!"
    {code}prepStat = connection.prepareStatement("INSERT INTO WeatherHistory (Date, Location, Overview, Temperature, WindDirection, WindSpeed, Pressure) VALUES ('"+date+"','"+location+"','"+temp+"','"+windDir+"','"+windSpd+"','"+pressure+"')");{code}
    All the field names and variables definitely exist so I can't see what the problem is!

    DHD wrote:
    Thanks for the replies.
    I've matched the correct number of column names and variables, but still no luck.
    And how exactly am I misusing Prepared Statements here?As noted above, not according to the code you posted. I didn't just pluck something out of my @ss and throw it out there. There was a reason behind what I said. And, if you mean you changed it, and you still got an exception, then post that exception (completely), and your new code, which is, hopefully, using PreparedStatement, (properly).

  • What's wrong with this SQL Statement?

    I hope somebody can help explain to me what is wrong wiht the
    following SQL statement in my Recordest. It does not return an
    error, but it will only filter records from the first variable
    listed, 'varFirstName%'. If I try to use any other variables on my
    search form,for example LastName, it returns all records. Why is it
    doing this?
    Here is the SQL statement:
    SELECT *
    FROM [Sysco Food Show Contacts]
    WHERE FirstName LIKE 'varFirstName%' AND LastName LIKE
    'varLastName%' AND OrganizationName LIKE 'varOrganizationName%' AND
    Address LIKE 'varAddress%' AND City LIKE 'varCity%' AND State LIKE
    'varState' AND PostalCode LIKE 'varPostalCode%'
    The variables are defined as below:
    Name Default Value Run-Time Value
    varFirstName % Request.Form("FirstName")
    varLastName % Request.Form("LastName")
    ...and such with all variables defined the same way.
    Any help would be much appreciated. I am pulling my hair out
    trying to make this Search Form work.
    Thanks, mparsons2000

    PLEASE IGONRE THIS QUESTION!
    There was nothing wrong with the statement. I had made
    another STUDIP mistake!

  • What's wrong with this sql query?  Help

    hi
    i am having difficulty executing this query
    ResultSet s=st.executeQuery("select * from employee where iden = ?"+id);
    here in my program st is statement obg
    iden is attribute name in table
    id i am getting at run time from user
    please help...it says wrong number of parameters
    thank you

    That's correct, get rid of the Question mark. Questions marks are used in PreparedStatements, but they are also used in pattern matching. I am assuming the iden is the table identity. Therefore, I am assuming it is numeric. If so, you can't use the question mark because pattern matching is only done with strings. If you are treating your statement as a PreparedStatement, then you have done it wrong. (See the API) Here is a code snippet from the API:PreparedStatement pstmt =     
       con.prepareStatement("UPDATE EMPLOYEES SET SALARY = ? WHERE ID = ?");
    pstmt.setBigDecimal(1, 153833.00)
    pstmt.setInt(2, 110592)It seems you are using a Statement object, so, you need to get rid of that question mark.
    tajenkins

  • Help requested: WHAT IS WRONG WITH THIS sql?

    I have two tables
    TABLE1
    ORG VARCHAR2(1)
    EMPNO VARCHAR2(10)
    UNION_DUES NUMBER(7,2)
    UNION_CODE VARCHAR2(5)
    TABLE2
    ORG VARCHAR2(1)
    EMPNO VARCHAR2(10)
    YEAR NUMBER(4)
    CODE2 VARCHAR2(5)
    EMPLOYEE_FIXED_AMOUNT NUMBER (7,2)
    ****** WHAT DO I WANT TO DO *****
    there is one entry for each employee in TABLE1. There are multiple entries for each employee in TABLE2. I want to update TABLE2 for all the employees in TABLE1.
    But only update those entries in TABLE2 where CODE2 = UNION_CODE and YEAR = 2002.
    ***** MY SQL ******
    update TABLE2
    set employee_fixed_amount =
    (select union_dues from TABLE1
    WHERE TABLE2.EMPNO = TABLE1.empno
    and TABLE2.org = TABLE1.org
    and TABLE2.code2 = TABLE1.union_code)
    where year = 2002;
    **** ORACLE ERROR PRODUCED ****
    ora-01407cannot update (table2.employee_fixed_amount) to null

    Either you have a NULL value for table1.union_dues or there is no match in table1 based on your criteria. So, you can check for these by:
    update TABLE2
       set employee_fixed_amount =
             (select union_dues
                from TABLE1
               where TABLE2.EMPNO = TABLE1.empno
                 and TABLE2.org = TABLE1.org
                 and TABLE2.code2 = TABLE1.union_code)
    where year = 2002
       and exists (select null
                     from table1
                    where table1.empno = table2.empno
                      and table1.org = table2.org
                      and table1.union_code = table2.code2
                      and table1.union_dues is not null);or, if it is alright that the employee_fixed_amount be set to 0 when there is no match or the union_dues is NULL, then:
    update TABLE2
       set employee_fixed_amount =
             nvl((select union_dues
                    from TABLE1
                   where TABLE2.EMPNO = TABLE1.empno
                     and TABLE2.org = TABLE1.org
                     and TABLE2.code2 = TABLE1.union_code), 0)
    where year = 2002;

  • Can i know what is wrong with this sql?

    i have an error of invalid character.
    SELECT SUM(counter),TO_DATE(logdatetime)
    FROM NYP_LIBPORTAL.PORTAL_HOME_NON_LOGIN_LOG
    WHERE logdatetime = logdatetime
    AND (TO_DATE(logdatetime, 'DD-MON-YYYY') BETWEEN
    TO_DATE('01-JAN-2007', 'DD-MON-YYYY') AND TO_DATE('31-JAN-2007', 'DD-MON-YYYY'))
    GROUP BY TO_DATE (logdatetime);
    May i know is there any way that i need to make the changes?

    your problem is likely to be the TO_DATE(logdatetime) - if logdatetime is a DATE datatype, then you should never, ever use TO_DATE on it.
    But I suspect this has been sorted in a later post of yours?

  • What's wrong with this SQL Syntax?

    Hello:
    I am using SQL Navigator. The following SQL statement does not get executed:
    SELECT * from CODE A
    LEFT OUTER JOIN CODELIST B
    on A.codelist_ID = B.Codelist_ID
    It says that the statement is not properly ended. Can somebody educate me?
    Thanks.
    Venki

    SELECT * from CODE A LEFT OUTER JOIN CODELIST B
       ON A.codelist_ID = B.Codelist_IDother than the above query do you have any other SELECT statements in the same editor window?

  • 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,

  • Whats wrong with this sql statement ??

    Hello all, I am trying to run the below query out of persheet(tanel poder) performance excel chart...but i get below error...db is on 9.2
    what is wrong with this sql statement ?
    http://blog.tanelpoder.com/2008/12/28/performance-visualization-made-easy-perfsheet-20-beta/
    select * from (
    with fsq as (
      select /*+ materialize */
       i.dbid
        , i.instance_name
        , i.instance_number
    --    , trunc(s.snap_time, 'DD')     DAY
    --    , to_number(to_char(s.snap_time, 'HH24'))  HOUR
    --   -- , to_char(s.snap_time, 'MI')    MINUTE
    --    , 0           MINUTE
        , trunc(
          lag(s.snap_time, 1)
          over(
           partition by
          v.dbid
           , i.instance_name
           , v.instance_number
           , v.event
         order by
          s.snap_time
          , 'HH24'
         )           SNAP_TIME
        , v.event_type        EVENT_TYPE
        , v.event          EVENT_NAME
        , nvl(
        decode(
         greatest(
          time_waited_micro,
          nvl(
           lag(time_waited_micro,1,0)
           over(
            partition by
             v.dbid
              , i.instance_name
              , v.instance_number
              , v.event
            order by v.snap_id
           , time_waited_micro
         time_waited_micro,
         time_waited_micro - lag(time_waited_micro,1,0)
         over (
          partition by
           v.dbid
            , i.instance_name
            , v.instance_number
            , v.event
          order by v.snap_id
         time_waited_micro
           , time_waited_micro
         ) / 1000000         SECONDS_SPENT
        , total_waits         WAIT_COUNT
      from
       (select distinct dbid, instance_name, instance_number from stats$database_instance) i
        , stats$snapshot s
        , ( select
         snap_id, dbid, instance_number, 'WAIT' event_type, event, time_waited_micro, total_waits
        from
         stats$system_event
        where
         event not in (select event from stats$idle_event)
        union all
        select
         snap_id, dbid, instance_number,
         case
          when name in ('CPU used by this session', 'parse time cpu', 'recursive cpu usage') then 'CPU'
          when name like 'OS % time' then 'OS'
          else 'STAT'
         end,
         name , value, 1
        from
         stats$sysstat
    --    where      name in ('CPU used by this session', 'parse time cpu', 'recursive cpu usage')
    --    or  name like('OS % time')
    --    or 1 = 2 -- this will be a bind variable controlling whether all stats need to be returned
       ) v
      where
       i.dbid = s.dbid
      and i.dbid = v.dbid
      and s.dbid = v.dbid
      and s.snap_id = v.snap_id
      and s.snap_time between '%FROM_DATE%' and '%TO_DATE%'
      and i.instance_name = '%INSTANCE%'
    select * from (
      select
       instance_name
        , instance_number
        , snap_time
        , trunc(snap_time, 'DD')  DAY
        , to_char(snap_time, 'HH24') HOUR
        , to_char(snap_time, 'MI') MINUTE      
        , event_type  
        , event_name  
        , seconds_spent
        , wait_count  
        , ratio_to_report(seconds_spent) over (
    --      partition by (to_char(day, 'YYYYMMDD')||to_char(hour,'09')||to_char(minute, '09'))
          partition by (snap_time)
          ) ratio
      from fsq
      where
       snap_time is not null -- lag(s.snap_time, 1) function above will leave time NULL for first snapshot
      -- to_char(day, 'YYYYMMDD')||to_char(hour,'09')||to_char(minute, '09')
      -- > ( select min(to_char(day, 'YYYYMMDD')||to_char(hour,'09')||to_char(minute, '09')) from fsq)
    where ratio > 0
    order by
        instance_name
      , instance_number
      , day
      , hour
      , minute
      , event_type
      , seconds_spent desc
      , wait_count desc
    Error at line 6
    ORA-00604: error occurred at recursive SQL level 1
    ORA-00972: identifier is too long

    Hi Alex,
    Subquery factoring a.k.a. the with-clause should be possible on 9.2:
    http://download.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_103a.htm#2075888
    (used it myself as well on 9.2)
    @OP
    I recall having problems myself using PL/SQL Developer and trying to get the with clause to work on 9.2 some years ago.
    A workaround might be to create a view based on the query.
    Also, your error message is "ORA-00972: identifier is too long"...
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14219/e900.htm#sthref419
    Can't test things currently, no 9.2 available at the moment, but perhaps tomorrow I'll have a chance.

  • Can you see what's wrong with my sql clause?

    Select afkogltri sum( afpowemng ) as yqty
        from   ( afpo inner join afko on afpoaufnr = afkoaufnr )
        into   ( d_gltri , d_wemng )
        where  afpo~matnr = wa_pir-matnr
               and year( afko~gltri ) = year( sy-datum )
        group by afko~gltri. 
    The above is my sql clause, when I do a syntax check, it said:"Comma without preceding colon (after SELECT ?)"
    Can you tell me what's wrong with this sql clause?
    Thank you very much!

    Hi,
    Select Bgltri sum( Awemng ) <b>as yqty</b> (????)
    into ( d_gltri , d_wemng )
    from afpo as A inner join afko as B
    on Aaufnr = Baufnr 
    where A~matnr = wa_pir-matnr
    and year( B~gltri ) = year( sy-datum )
    group by B~gltri.
    ENDSELECT.
    eg<b>:... INTO (f1, ..., fn</b>)
    Places the result set in the target area (f1, ..., fn). The fields of the result set are transported to the target fields fi from left to right. INTO (f1, ..., fn) is allowed only if a list with n elements is also specified in the SELECT clause.
    <b>If the result of a selection is a table, the data is retrieved in a processing loop introduced by SELECT and concluded by ENDSELECT. The processing passes through the loop once for each line read. If the result is a single record, the closing ENDSELECT is omitted.</b>
    Example
    Output a list of all airlines (with short description and name):
    TABLES SCARR.
    DATA:  CARRID   LIKE SCARR-CARRID,
           CARRNAME LIKE SCARR-CARRNAME,
    SELECT CARRID CARRNAME
           INTO (CARRID, CARRNAME)
           FROM SCARR.
      WRITE: / CARRID, CARRNAME.
    ENDSELECT
    Thanks & Regards,
    Judith.

  • 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-00936: missing expression , in a stored procedure..

    PL/SQL: ORA-00936: missing expression is the error i get when i compile my following procedure .
    create or replace procedure "UPDATE_LOG"
    (sub IN NUMBER,
    recv IN NUMBER,
    transIN VARCHAR2,
    type IN VARCHAR2,
    date IN TIMESTAMP,
    delivery IN VARCHAR2,
    amt IN NUMBER,
    grp IN VARCHAR2)
    is
    BEGIN
    INSERT INTO detail_log values(sub,recv,trans,type,date,delivery,amt,grp) ;
    END UPDATE_LOG;
    I tried many alternatives, what is wrong with it ..
    The select procedures are working fine..

    Since you have not posted the output from "show errors;", my initial guess about the error would be for the "date" variable that you have declared. Try renaming that column to say date1.

  • Automatic Row Processing fetch error (ORA-00936: missing expression)

    Hi there,
    I have a bit of a problem setting up automatic row processing. The Apex processing is causing an error, but I'm not sure what PL/SQL code is being run (obviously, I don't have access to the Apex code) and all I get is the error following:
    0.13: Processing point: AFTER_HEADER
    0.13: ...Process "Notes load": DML_FETCH_ROW (AFTER_HEADER) F|#OWNER#:PUPIL_NOTE:P29_PUPIL_ID:PUPIL_ID:P29_ACHIEVEMENT_SET_ID:ACHIEVEMENT_SET_ID
    0.16: Show ERROR page...
    and then the following exception report on the page:
    ORA-06550: line 1, column 17: PL/SQL: ORA-00936: missing expression ORA-06550: line 1, column 9: PL/SQL: SQL Statement ignored
    Can anyone tell me how I can diagnose the problem?
    Many thanks,
    Robert
    Message was edited to change subject

    I am having a very similiar problem
    0.02: Fetch session state from database
    0.03: Branch point: BEFORE_HEADER
    0.03: Fetch application meta data
    0.03: Computation point: BEFORE_HEADER
    0.03: Processing point: BEFORE_HEADER
    0.04: ...DML_FETCH_ROW (BEFORE_HEADER) F|#OWNER#:JOH:P66_JOH_ID:JOH_ID
    0.49: Show ERROR page...
    0.50: Processing point: AFTER_ERROR_HEADER
    ORA-06550: line 1, column 17: PL/SQL: ORA-00936: missing expression ORA-06550: line 1, column 9: PL/SQL: SQL Statement ignored
    JOH was a synonym (allowing other shemas to access the table) but @I delted those
    P66_JOH_ID is a DB column (which it wasnt)
    but I still get the error
    ORA-06550: line 1, column 17: PL/SQL: ORA-00936: missing expression ORA-06550: line 1, column 9: PL/SQL: SQL Statement ignored
    Any ideas how I can track this down?

Maybe you are looking for

  • Changing Work Center in PM Order Operations

    Hi PM Experts, We got two companies operating in the same SAP client. But user are properly restricted with Authorizations in terms of company codes, maintenance panning plant, maintenance plants etc, etc, But I noticed that in IW32, in  work order o

  • Safari Randomly Quitting

    Process:         WebProcess [214] Path:            /System/Library/StagedFrameworks/Safari/WebKit2.framework/WebProcess.app/Conten ts/MacOS/WebProcess Identifier:      com.apple.WebProcess Version:         8536 (8536.26.17) Build Info:      WebKit2-7

  • Unsupported video format ?! ( iphone 4 )

    I read on the official Apple website that the iphone 4 supports H264, Mpeg4 and M-jpeg video formats.. But when i converted a video into H264 format, the video couldnt be synced as it is incompatible ? This is the details of the video from itunes >>

  • Curious about this From clause in Oracle XE

    SQL view of query Builder gives the following: select     "EMPLOYEES"."EMPLOYEE_ID" as "EMPLOYEE_ID",      "EMPLOYEES"."FIRST_NAME" as "FIRST_NAME",      "EMPLOYEES"."LAST_NAME" as "LAST_NAME" from     "EMPLOYEES" "EMPLOYEES" Why does the from clause

  • Nested Repeat Region

    Dreamweaver CS3 ASP / VBScript Hi, I'm trying to create a nested repeat region to display a list of categories and, in brackets afterwards, a count of the number of sub-categories contained in it E.g. Cats (12) Dogs (43) Fish (92) Etc I have managed