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

Similar Messages

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

  • Can someone see what is wrong with this?  Im stumped

       public class Card {
         int suit;
         int value;
         static int isStraight = 0;
         static int isFlush = 0;
         static int handCounter = 0;
         static int cardCounter = 0;
         boolean inUse = false;
         public int getSuit() {
              return suit;
         public void setSuit(int suit) {
              this.suit = suit;
         public int getValue() {
              return value;
         public void setValue(int value) {
              this.value = value;
         public boolean isInUse() {
              return inUse;
         public void setInUse(boolean inUse) {
              this.inUse = inUse;
        public static int checkPairs(int[] handValues){
             for (int x = 0; x<5; x++ ){
                  for (int y = 0; y<5; y++ ){
                       if(handValues[x]==handValues[y]){
                            cardCounter ++;
                  handCounter = handCounter + (cardCounter - 1);
                   cardCounter = 0;
             System.out.println(handCounter);
             return handCounter;
        public static int checkStraight(int[] handValues){
                  if(handValues[0] == (handValues[1]-1)){
                       if (handValues[1] == (handValues[2]-1)){
                            if (handValues[2] == (handValues[3]-1)){
                                 if (handValues[3] == (handValues[4]-1)){
                                      ///System.out.println("straight");
                                          isStraight = 1;
                                      if (handValues[4] == 12){
                                            isStraight = 2;
                  return isStraight;
        public static int checkFlush(Card[]inputHand){
             if (inputHand[0].suit == inputHand[1].suit){
                  if (inputHand[1].suit == inputHand[2].suit){
                       if (inputHand[2].suit == inputHand[3].suit){
                            if (inputHand[3].suit == inputHand[4].suit){
                                 isFlush = 1;
             return isFlush;
    //handCheckerApp ,
    import tcdIO.*;
    public class handCheckerApp {
         ///these string arrays just hold the names of the values
         static String[] suitsArray = {"hearts" , "spades" , "diamonds" , "clubs" };
         static String[] valuesArray = {"two" , "three" , "four" , "five" , "six" , "seven" , "eight" , "nine" , "ten" , "jack" , "queen" , "king" ,"ace" };
         public static void main (String arguments []) {
              Terminal terminal = new Terminal();
              Card[] inputHand = new Card[5];
              Card[] deck = new Card[52];
              Card currentCard = new Card();
              for(int number = 0 ; number <= 12 ; number++){
                   deck[number]= new Card();
                   deck[number].suit = 0;
                   deck[number].value = number;
              for(int number = 13 ; number <= 25 ; number++){
                   deck[number]= new Card();
                   deck[number].suit = 1;
                   deck[number].value = (number - 13);
              for(int number = 26 ; number <= 38 ; number++){
                   deck[number]= new Card();
                   deck[number].suit = 2;
                   deck[number].value = (number - 26);
              for(int number = 39 ; number <= 51 ; number++){
                   deck[number]= new Card();
                   deck[number].suit = 3;
                   deck[number].value = (number - 39);
              terminal.println("Poker Hand Checker");
              terminal.println("~~~~~~~~~~~~~~~~~~");
              terminal.println("Suits key:..Hearts = 1");
              terminal.println("...................Spades = 2");
              terminal.println("...................Diamonds = 3");
              terminal.println("...................Clubs = 4");
              terminal.println(".............................");
              terminal.println("Values key:.Twos = 2");
              terminal.println("......................Threes = 3");
              terminal.println("......................Fours = 4");
              terminal.println("......................Fives = 5");
              terminal.println("......................Sixes = 6");
              terminal.println("......................Sevens = 7");
              terminal.println("......................Eights = 8");
              terminal.println("......................Nines = 9");
              terminal.println("......................Tens = 10");
              terminal.println("......................Jacks = 11");
              terminal.println("......................Queens = 12");
              terminal.println("......................Kings = 13");
              terminal.println("......................Aces = 14");
          ///this block of code marks cards in the deck as in use and adds them to the hand 
          for(int i = 0; i < 5; i++){///for1
              currentCard.value = (terminal.readInt("please enter card " + (i+1) + " value: " )-2);
              currentCard.suit = (terminal.readInt("please enter card " + (i+1) + " suit: " )-1);
              for (int x = 0; x< 52; x++){///for2
                   if (deck[x].value == currentCard.value){///if1
                        if (deck[x].suit == currentCard.suit){///if2
                            if (deck[x].inUse == true){///elseif1
                                 terminal.println("you chose that card already");
                                 i--;
                            }///if3
                            else if(deck[x].inUse == false){///if3
                                 deck[x].inUse = true;
                                 inputHand[i] = deck[x];
                                 terminal.println("this card is the " + valuesArray[(inputHand.value)] + " of " + suitsArray[(inputHand[i].suit )]);
                        }///elseif1
                   }///if2
              }///if1
         }///for2
         }///for1     
         int handValues[] = {inputHand[0].value, inputHand[1].value, inputHand[2].value, inputHand[3].value, inputHand[4].value};
         java.util.Arrays.sort(handValues);     
         ///this method checks for pairs, two pairs, three of a kind, full house & four of a kind
         Card.checkPairs(handValues);
         if (Card.handCounter == 2) {
                   terminal.println("You have a pair");
              if (Card.handCounter == 4) {
                   terminal.println("You have two pair");
              if (Card.handCounter == 6) {
                   terminal.println("You three of a kind");
              if (Card.handCounter == 8) {
                   terminal.println("You have a full house");
              if (Card.handCounter == 12) {
                   terminal.println("You have four of a kind");
              } else {
                   terminal.println("");
              Card.checkStraight(handValues);
              Card.checkFlush(inputHand);
                   if (Card.isStraight == 1 && Card.isFlush == 0){
                        terminal.println("You have a straight");
                   if (Card.isStraight == 1 && Card.isFlush == 1){
                        terminal.println("You have a straight flush");
                   if (Card.isStraight == 2 && Card.isFlush == 0){
                        terminal.println("You have a royal straight");
                   if (Card.isStraight == 2 && Card.isFlush == 1){
                        terminal.println("You have a royal straight flush");
                   if (Card.isStraight == 0 && Card.isFlush == 1){
                        terminal.println("You have a flush");
                   if (Card.isStraight == 0 && Card.isFlush == 0){
                        terminal.println("");
    Okay it's not recognising deck.inUse....i can't see why.
    Can someone possibly point out some suggestions. Thanks, much appreciated.

    > if (deck[x].inUse == true){///elseif1
    >
    it's giving me an error on this If else statement...
    sorry ....
    How about going the extra mile and actually posting the error message you receive rather than expecting everyone to guess? The more pertinent information you can provide, the easier it is to answer your question. And you want your question answered easily and quickly, right?
    ~

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

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

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

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

  • What's wrong with my SQL statement?

    Guys,
    Please help me with this one.
    I am using Oracle JDBC Driver 9.2.0. When I did "select column1, column2 from tableName where rownum<1000", it was really fast. But when I do "select column1, column2 from tableName where rownum between 100 and 200", it won't return. The whole program just sit there, like there is some kind of infinite loop going on or something. I don't know Oracle database at all. Is there anything wrong with my SQL statements or there is some special Oracle SQL statement requirement/syntax?
    Thanks.

    Guys,
    Please help me with this one.
    I am using Oracle JDBC Driver 9.2.0. When I did
    "select column1, column2 from tableName where
    rownum<1000", it was really fast. But when I do
    "select column1, column2 from tableName where rownum
    between 100 and 200", it won't return. The whole
    program just sit there, like there is some kind of
    infinite loop going on or something. I don't know
    Oracle database at all. Is there anything wrong with
    my SQL statements or there is some special Oracle SQL
    statement requirement/syntax?
    Thanks.
    why don't you just try a standard WHERE
    "select column1, column2 from tableName where rownum > 100 and rownum < 200"

  • Any see what is wrong with this query?

    Logs Record Set - query - Top 4 of 4 Rows
    ATTRIBUTES DATELASTMODIFIED DIRECTORY MODE NAME SIZE TYPE
    1 [empty string] 06/06/2007 10:59:17 AM
    G:\Tracker\wwwRoot\Data
    [empty string] ChargedOut_06Jun2007_ILS_105634322.txt 828
    File
    2 [empty string] 06/06/2007 10:57:00 AM
    G:\Tracker\wwwRoot\Data
    [empty string] Error_06Jun2007_ ILS_105634322.txt 88 File
    3 [empty string] 06/06/2007 10:58:46 AM
    G:\Tracker\wwwRoot\Data
    [empty string] Final_06Jun2007_ ILS_105634322.txt 27841 File
    4 [empty string] 06/06/2007 10:56:07 AM
    G:\Tracker\wwwRoot\Data
    [empty string] Upload_06Jun2007_ ILS_105634322.txt 94768 File
    ChargeOut Stats - struct
    CACHED false
    COLUMNLIST NAME
    EXECUTIONTIME 0
    RECORDCOUNT 0
    SQL SELECT Name FROM Logs WHERE Name = 'ChargedOut_06Jun2007_
    ILS_105634322.txt'
    chargeOut Record Set - query - Top 0 of 0 Rows
    NAME
    CODE
    <cfdirectory directory="#ExpandPath('data')#"
    action="list" name="Logs"
    sort="Name">
    <cfquery dbtype="query" name="ChargedOut"
    result="stats">
    SELECT Name
    FROM Logs
    WHERE Name = 'ChargedOut#Set#.txt'
    </cfquery>
    I can not see why SELECT Name FROM Logs WHERE Name =
    'ChargedOut_06Jun2007_ ILS_105634322.txt' is not returning
    the
    corresponding record from the logs record set.

    Thanks, I finally saw the errant white space character!

  • What is wrong with this INSERT statement?

    I know this has been covered many times but I cannot figure out why I am getting a syntax error for this prepared Statement INSERT...any help is greatly appreciated:
    PreparedStatement pstmt = con.prepareStatement("insert into hold (idnum, date_field) values (?,?)");
    pstmt.setString(1, idnum);
    pstmt.setString(2, date_field);
    pstmt.executeUpdate();
    thanks,
    Chuck

    still have trouble, cannot find an answer that works in the forum anywhere. Using Access 2000 trying to INSERT into a memo field I am getting an error, "SQLException caught: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement. ". I have the following code:
    first I am getting the parameter (using a servlet) from the form submit:
    String desc = req.getParameter("desc");
    then, I am using a prepared Statement:
    PreparedStatement pstmt = con.prepareStatement("insert into hold (idnum, date_field, time_field, author, title, desc) values (?,?,?,?,?,?)");
    pstmt.setString(1, idnum);
    pstmt.setString(2, date_field);
    pstmt.setString(3, time_field);
    pstmt.setString(4, author);
    pstmt.setString(5, title);
    pstmt.setObject(6, desc, java.sql.Types.LONGVARCHAR);
    pstmt.executeUpdate();
    incidentally, the text string is only 20 characters in my tests.
    Any help is greatly appreciated (or working code examples)
    thanks in advance,
    Chuck

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

  • What is wrong with my SQL Statement

    I am getting errors when trying to apply an SQL statement to a report, and I can't figure it out. The error reads: "Syntax error (missing operator) in the query expression 'Title = "Sales Representative"'. Could someone please tell
    me where it is I have gone wrong? The statement is suppose to show records of employees that have Sales Representative as their Title. This is what I came up with:
    SELECT * FROM Employees WHERE Title = “Sales Representative” 

    Try putting brackets around table and field names.  
    I found wrong kind of double quote also ---
    SELECT [Employees].* FROM [Employees] WHERE
    [Employees].[Title] = "Sales Representative"; 
    Build a little, test a little

  • Pictrivia 6 - Can you identify what's wrong with this setup?

    What's Pictrivia?
    It's a trivia presented as a picture - more picture, less words. If you love  solving puzzles, racking your brains on brain teasers,you would love this one.
    Who can participate?
    It's open to all. You can participate on Facebook, Twitter or here. If you are subscribed to our Facebook or Twitter channels, you'll see the message posted on early Saturday mornings  pacific time.
    How often will you post a trivia?
    Once a week on Fridays.
    How do I answer?
    You  can answer by replying to this discussion. If you saw the post on our  Facebook page or Twitter, simply comment on the post or reply to our  tweet.
    What do I get?
    Intellectual stimulation, thrill and pleasure of solving a puzzle!
    What's the skill level required?
    Beginners
    When will I know the right answer?
    On the following Wednesday.

    Access layer switch will became bridge root。(default priority,lowest MAC address 1111.1111.1111)。And this L2 network will working at low efficiency。

  • 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

  • What is wrong with this update statement

    Hi all,
    I am trying to create a simple update program that allows user to enter table name, key fields and one field to update and its value.
    But report goes into dump at update statement?
    Here is the code:
    REPORT  ZTABLE_UPDATE.
    parameters: tabname(18).
    PARAMETERS: key1(15),"use at where condition
                key1val(20),
                key2(15),"use at where condition
                key2val(20),
                field2(15)."field to be updated
    PARAMETERS: yenideg1(20),
                yenideg2(20).
    CONDENSE: tabname, field2,
              yenideg1, yenideg2,
              key1val, key2val,
              key1, key2.
    data: wa like tabname.
    *update (tabname) SET field2 = yenideg1*
                     *WHERE key1 like key1val and key2 like key2val.*if sy-subrc eq 0.
      SELECT SINGLE * FROM (tabname) INTO wa
                      WHERE key1 like key1val
                        and key2 like key2val.
        WRITE / wa. "to test whether replacement is ok.
    endif.
    Thanks in advance.
    Deniz

    Hi:
    follows is ok:
    DATA: dy_table TYPE REF TO data,
          dy_line  TYPE REF TO data,
          ifc TYPE lvc_t_fcat,
          xfc TYPE lvc_s_fcat.
    DATA: it_clrs_fields LIKE TABLE OF dfies WITH HEADER LINE.
    DATA: cond(72) TYPE c,
          itab LIKE TABLE OF cond,
          itab2 LIKE TABLE OF cond.
    FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
                 <dyn_wa>,
                 <dyn_field>,
                 <fs>.
    PARAMETERS: tabname TYPE ddobjname OBLIGATORY.
    PARAMETERS: key1(15) OBLIGATORY,"use at where condition
                key1val(20) OBLIGATORY,
                key2(15),"use at where condition
                key2val(20),
                field2(15)."field to be updated
    PARAMETERS: yenideg1(20),
                yenideg2(20).
    ***START
    CONDENSE: tabname, field2,
              yenideg1, yenideg2,
              key1val, key2val,
              key1, key2.
    CALL FUNCTION 'DDIF_FIELDINFO_GET'
      EXPORTING
        tabname              = tabname
    TABLES
       dfies_tab            = it_clrs_fields[]
      FIXED_VALUES         =
    EXCEPTIONS
       not_found            = 1
       internal_error       = 2
       OTHERS               = 3
    LOOP AT  it_clrs_fields .
      MOVE-CORRESPONDING it_clrs_fields TO xfc.
      APPEND xfc TO ifc.
      CLEAR: xfc.
    ENDLOOP.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
      EXPORTING
        it_fieldcatalog = ifc
      IMPORTING
        ep_table        = dy_table.
    ASSIGN dy_table->* TO <dyn_table>.
    CREATE DATA dy_line LIKE LINE OF <dyn_table>.
    ASSIGN dy_line->* TO <dyn_wa>.
    CLEAR COND.
    CONCATENATE key1 ' = ''' key1val '''' 'AND' INTO cond.
    APPEND cond TO itab.
    CLEAR COND.
    CONCATENATE key2 ' = ''' key2val '''' INTO cond.
    APPEND cond TO itab.
    SELECT  *
      INTO <dyn_wa>
      FROM (tabname)
       WHERE (itab).
    ENDSELECT.
    IF sy-subrc <> 0.
      WRITE / 'no this data in dbtab'.
      EXIT.
    ENDIF.
    CLEAR COND.
    CONCATENATE field2 ' = ''' yenideg1 '''' INTO cond.
    UPDATE (tabname) SET (cond)
                    WHERE (itab).
    IF sy-subrc EQ 0.
      SELECT SINGLE * FROM (tabname) INTO <dyn_wa>
                      WHERE (itab).
    WRITE / <dyn_wa>. "to test whether replacement is ok.
    ENDIF.
    you alse can use:
    FM: VIEW_MAINTENANCE_CALL can used to do table maintenance.
    note:
    1.to do Table Maintenance Generator.
    2.be authorized to to use tansaction sm30.
    好运,
    启明星

Maybe you are looking for

  • Windows Defender Beta 2 Stops iTunes 6.03 From Installing Completely

    Hey, There is a bug with Windows Defender Beta 2 and iTunes. I thought I would tell apple and Microsoft about it. Check microsoft beta newsgroups. When you install iTunes 6.03 and have Windows Defender Beta 2 running it will cause iTunes setup to err

  • Just locked my Macbook Pro and now it goes straight to recovery.

    I just tried if the lock Mac works on the find my iPhone. My laptop froze and restarted. Now every time I boot, my laptop goes straight to recovery HD. I tried holding option when rebooting and when I chose macintosh HD, it still goes to recovery. It

  • My iPod camera is very blurry after dropping it. What do I do???

    I dropped my iPod touch 5 and the camera became very blurry , and after a few seconds it freezes. What should I do??? iPod touch 5th gen, iOS 8.3, 32GB

  • LR 1.1 updates XMP/metadata apparently for no reason

    I have checked both "Write develop settings to XMP..." and "Autmatically write changes to XMP" and I find that just by browsing through images DNG files and XMP files are updated even though I haven't done any changes. If I have a library full of RAW

  • Workflow BRANCH Step issues...

    Hi Guru's For Branch step as per Dataref guide we can have "n"  no of validations.. But when i add more that 4 validations and try to connect this to next step..system gives me an error ... Step " Notify is not connected properly"...What is this ..I