Results 1 to 4 of 4
  1. #1
    satyaram is offline Member
    Join Date
    Jan 2009
    Posts
    4
    Rep Power
    0

    Default Iam getiing problem while running this this query in java

    ltSet rs=stmt.executeQuery("SELECT * FROM record WHERE (timings BETWEEN"+ t1 +"AND t2 ) and (source="+"'"+from+"' and destination="+"'"+to+"'"+")");


    I am getting below error

    java.sql.SQLException: ORA-00904: "T2": invalid identifier

  2. #2
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    8

    Default Fyi...

    satyaram... there is no need to open a new post to update a post. There is an "Edit" button at the bottom that will let you edit your posts that have already posted.

    Luck,
    CJSL
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

  3. #3
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Aren't you missing spaces here

    Java Code:
    BETWEEN"+ t1 +"AND
    And should not this have a similar construct (i.e. is "t2" not a variable?)

    Java Code:
    AND t2 ) and
    You should be using a PreparedStatement though. Don't cobble together statements like this unless it absolutely cannot be avoided. It is just begging for problems.

  4. #4
    neeraj.singh is offline Member
    Join Date
    Feb 2009
    Location
    Delhi
    Posts
    63
    Rep Power
    0

    Default

    t2 should be a variable
    check your code..
    its a silly mistake

Similar Threads

  1. Replies: 0
    Last Post: 02-09-2009, 03:15 PM
  2. Problem running a java desktop application
    By chris@gaiag.net in forum AWT / Swing
    Replies: 2
    Last Post: 08-24-2008, 05:24 AM
  3. problem in select query
    By herfnai in forum JDBC
    Replies: 0
    Last Post: 08-17-2008, 12:47 PM
  4. Problem in running java programs
    By aravind in forum New To Java
    Replies: 0
    Last Post: 07-14-2008, 12:19 PM
  5. problem while running java code..
    By Jjava in forum New To Java
    Replies: 0
    Last Post: 02-08-2008, 07:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •