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

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)

  • Can someone tell me what's wrong with this LOV query please?

    This query works fine..
    select FILTER_NAME display_value, FILTER_ID return_value
    from OTMGUI_FILTER where username = 'ADAM'
    But this one..
    select FILTER_NAME display_value, FILTER_ID return_value
    from OTMGUI_FILTER where username = apex_application.g_user
    Gives the following error.
    1 error has occurred
    * LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query.
    Thanks very much,
    -Adam vonNieda

    Ya know, I still don't know what's wrong with this.
    declare
    l_val varchar2(100) := nvl(apex_application.g_user,'ADAM');
    begin
    return 'select filter_name display_value, filter_id return_value
    from otmgui_filter where username = '''|| l_val || '''';
    end;
    Gets the same error as above. All I'm trying to do is create a dropdown LOV which selects based on the apex_application.g_user.
    What am I missing here?
    Thanks,
    -Adam

  • 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 ejb-query?

    Hi people,
    may be i worked too much, may be i've just missed something, but guys, can enyone tell me what the hell is wrong with this GOD DAMNED query?
    <ejb-ql>Select Object(adt) From AddrDataTable AS adt, IN (adt.addresseeQualities) AS aq WHERE adt.season.id = ?1 And aq.aQTemplate.id=?2</ejb-ql>
    That JBoss throws following exception:
    org.jboss.deployment.DeploymentException: Error compiling EJB-QL statement 'Select Object(adt) From AddrDataTable AS adt, IN (adt.addresseeQualities) AS aq WHERE adt.season.id = ?1 And aq.aQTemplate.id=?2'; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "1" at line 1, column 103.
    Was expecting one of:
    "ABS" ...
    "LENGTH" ...
    "LOCATE" ...
    "SQRT" ...
    "+" ...
    <INTEGER_LITERAL> ...
    <FLOATING_POINT_LITERAL> ...
    <NUMERIC_VALUED_PARAMETER> ...
    <NUMERIC_VALUED_PATH> ...
    at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.<init>(JDBCEJBQLQuery.java:50)
    The worst thing is that when i remove WHERE clause JBoss keeps silence like a fish - it works fine!
    So, any ideas about this?
    Thank you

    Are you sure the ?1 and ?2 parameters exist in the method for which the query is addressed.
    In the statement adt.season.id I guess season is a CMR field and then season has a CMP field called id
    and the same for aq.aQTemplate.id, aQTemplate being the CMR field and the is being a CMP field in the CMR.
    and in adt.addresseeQualities is a CMR field?
    Looks like a complex query
    SELECT OBJECT(adt) from BEAN AS adt,
    IN(adt.CMR_FIELD) AS aq
    WHERE
    adt.ANOTHER_CMR.ANOTHER_AMR_CMP_FIELD=?1
    AND
    aq.2_CMR_FIELD.2_CMP_FIELD =?2

  • 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 is wrong with this? pls help!

    I have this as a listener for a JButton:
         public void actionPerformed(ActionEvent e){
              try{
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   String url = "jdbc:odbc:RezSystem";
                   Connection con = DriverManager.getConnection(url, "user10", "");
                   PreparedStatement stmt = con.prepareStatement("select cPassword from RezShopper where cShopperID = ?");
                   stmt.setString(1, textSignInName.getText());
                   ResultSet res = stmt.executeQuery();
                   if(res.next()){
                        String tp = String.valueOf(passPassword.getPassword());
                        String dp = res.getString(1);
                        System.out.println("text field = " + tp);
                        System.out.println("database = " + dp);
                        if (dp.equals((String)dp)){
                             System.out.println("Password accepted");
                        else{
                             System.out.println("Invalid password");
                   else{
                        System.out.println("Invalid sign in name");
              catch(Exception ex){
                   System.out.println(ex);
         }this is used to compare the value in a password field and a value in a column in an sql data base with a char data type and should check if they are the same. The problem is that even if they are the same it still prints out "Invalid password". What went wrong???
    thanks

    dp.equals(dp) should give you true, but I guess you meant dp.equals(tp). To debug it, I would print the character values of both strings. You don't need to cast the String to a String before you call equals..
    for (int x = 0; x < dp.length(); x++)
      System.out.println("dp("+x+")="+(int)dp.charAt(x));
    for (int x = 0; x < tp.length(); x++)
      System.out.println("tp("+x+")="+(int)tp.charAt(x));I assume that getPassword returns a char array and not a byte array. If it returns a byte array, it is possible that the charset encoding gives you a different string than you expected.

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

  • Anything obviously wrong with this SQL query?

    Hey guys
    I can insert single data into my SQL DB, but multi line is throwing an error:
    This works:
    "INSERT INTO tester3 (Genre, DiscID) VALUES ('yeah', 'SF001');"
    This doesn't:
    "INSERT INTO tester3 (Genre, DiscID) VALUES ('X', 'none'),('X', 'none'),('X', 'none');"
    Throws the error:
    Error message: Error #3115: SQL Error.
    Details: near ',': syntax error
    I'm guessing there's something simple I'm overlooking?
    Thank you

    Nevermind - you do it like this:
    INSERT INTO "testerTable" (rowID, Column1, Column2)
    SELECT NULL,  "testData1", "moreData1"
    UNION SELECT NULL, "testData2", "moreData2"
    UNION SELECT NULL, "testData3", "moreData3"
    Also, I found a REALLY good article at http://stackoverflow.com/questions/1711631/how-do-i-improve-the-performance-of-sqlite that compares different ways of inserting over 800 000 rows of data, that results in insert speeds anywhere from 85 inserts per second all the way up to 96 700!!!
    It's written for C, and I'm unsure how much of the SQLLite syntax they have in the article will work in AIR, but I'll see how far I get with it.

  • What is wrong with this simple query

    Hi,
    I am writting a simple code just to get the maximum no values from a database table
    The query is
    ResultSet = stm.executeQuery("SELECT MAX(column_name) FROM Database_table ");
    it seems to be a simple one but i am getting the message
    column not found
    Please answer soon

    Well, it depends on how your resultset is retrieving the results. If you retrieve by column name, then that's your problem. You need to do something like this:
    ResultSet = stm.executeQuery("SELECT MAX(column_name) AS myColumnName FROM Database_table ");
    String myResult = ResultSet.getString(myColumnName);Using MAX, COUNT, etc, will return your result with a mangled or no actual column name to retrieve from. Optionally, you can solve your problem by:
    ResultSet.getString(1);Michael Bishop

  • What is wrong with this api Pls help

    I am creating api to migrate jobs from an extenal table to hr but when executing the script it only inserts the first record and gives this message
    "-20001 ORA-20001: The job you have entered already exists in this Business Group. Please enter a unique name for your job."
    as I mentioned the job which he means already created is the first row of the table
    here is the code
    DECLARE
    l_count Number :=0;
    v_business_group_id Number :=101;
    v_date_from date := TO_DATE('01-01-1900','DD-MM-YYYY');
    v_job_group_id number := 21;
    v_object_version_number number :=1;
    v_segment1 varchar2(10);
    v_segment2 varchar2(150);
    v_attribute2 varchar2(150);
    v_attribute3 varchar2(100);
    v_attribute4 varchar2(50);
    v_attribute5 varchar2(50);
    v_attribute6 varchar2(50);
    cursor job is select DESGN_CODE,
         DESGN_DESP_M_A,
         DESGN_DESP_F_A,
         DESGN_DESP_E ,
         DESGN_TYPE ,
         DESGN_CAT_CODE,
         GRP_CODE
    from aa_tdesignation
    Where rownum < 10
    and desgn_desp_e is not null;
    v_segment5 varchar2(100) := NULL;
    v_segment6 varchar2(100) := NULL;
    v_job_id number;
    v_job_definition_id number;
    v_name varchar2(100);
    begin
    dbms_output.put_line('##########################################################');
    dbms_output.put_line('Data Migration Of Jobs:');
    dbms_output.put_line('##########################################################');
    dbms_output.put_line('Start Time : ' || TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS'));
    for my_cur in job
    LOOP
    BEGIN
    v_segment1 := my_cur.DESGN_CODE;
    v_segment2 := my_cur.DESGN_DESP_M_A;
    v_attribute2 := my_cur.DESGN_DESP_F_A;
    v_attribute3 := my_cur.DESGN_DESP_E;
    v_attribute4 := my_cur.DESGN_TYPE;
    v_attribute5 := my_cur.DESGN_CAT_CODE;
    v_attribute6 := my_cur.GRP_CODE;
    HR_JOB_API.CREATE_JOB
    (p_business_group_id => v_business_group_id
    ,p_date_from => v_date_from
    ,p_job_group_id => v_job_group_id
    ,p_object_version_number => v_object_version_number
    ,p_segment1 => v_segment1
    ,p_segment2 => v_segment2
    ,p_segment5 => v_segment5
    ,p_segment6 => v_segment6
    ,p_attribute2 => v_attribute2
    ,p_attribute3 => v_attribute3
    ,p_attribute4 => v_attribute4
    ,p_attribute5 => v_attribute5
    ,p_attribute6 => v_attribute6
    ,p_job_id => v_job_id
    ,p_job_definition_id => v_job_definition_id
    ,p_name => v_name);
    Dbms_output.put_line('Sucess'||' '||my_cur.DESGN_CODE||' '||my_cur.DESGN_DESP_M_A);
    L_COUNT:=L_COUNT+1;
    END;
    END LOOP;
    DBMS_OUTPUT.PUT_LINE ('Total Nubmer of record'||L_COUNT);
    Exception
    When others then
    dbms_output.put_line(sqlcode||' '||sqlerrm);
    DBMS_OUTPUT.PUT_LINE ('Total Nubmer of record'||L_COUNT);
    end;
    Thanks

    You've got to remove either the semicolon or the slash at the end of the script as both will execute it, so the second time with the same info it fails.

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

  • 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? 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)

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

Maybe you are looking for

  • Numbers-Auto Generating a numbered list in a column of cells

    Having trouble creating an auto-generating numbered list in a single column. In text inspector I choose bullets>numbers>start at 1. The first cell is filled in with a "1", but when I hit return or down arrow the 1 disappears. If I go back and type a

  • PLS help: animate gif decoding problem

    i am making a gif animation decoders using http://www.fmsware.com/stuff/gif.html after i decoded the gif, i could only view the animation by ACD See, but cant view by web browser(it only show the last frame of the gif) !! Thanks all you guy ~~~

  • Error with the view of a form

    Hi, I have a problem with the view of a form before start a workflow: This is the aspect that it has (it shows the colums of the form): and this is the aspect of the same action in other sites (the correct way): How can I change the aspect of the fir

  • Email: content-type html

    Is it possible to send an email with html content from ALSB ? If I set the content-type to 'text/html' in the transport header, the ALSB is overriding it to 'text/plain'. Any ideas are appreciated. Thanks.

  • Can i use wot on the iPad 2 web browser

    can i use web of trust on the i pad 2 browser