SQL code not working inside Java

Below is my code from java. here, i'm trying to execute below sql code inside my java coding. its preety straight -
ResultSet rs = null;
PreparedStatement prepStmt = null;
String statement="select * from TIMINGTABLE WHERE COUNTRY = 'USA' AND RE_DATE >= TO_DATE('04/11/2012','MM/DD/YYYY') order by COUNTRY";
prepStmt = con.prepareStatement(statement);
rs = prepStmt.executeQuery();
dats it. but, its giving this error ---- SQL syntax error: the token "(" was not expected here
now, here, when i simply remove this part from the above sql line ----- AND RE_DATE >= TO_DATE('04/11/2012','MM/DD/YYYY') -----the code works perfectly.
RE_DATE is a date field in the sql table.
I even tried this option too - TO_DATE(RE_DATE, 'MM/DD/YYYY') >= TO_DATE('04/11/2012','MM/DD/YYYY')
which is giving same error
please help
-prodyut

927428 wrote:
Below is my code from java. here, i'm trying to execute below sql code inside my java coding. its preety straight -
ResultSet rs = null;
PreparedStatement prepStmt = null;
String statement="select * from TIMINGTABLE WHERE COUNTRY = 'USA' AND RE_DATE >= TO_DATE('04/11/2012','MM/DD/YYYY') order by COUNTRY";
prepStmt = con.prepareStatement(statement);
rs = prepStmt.executeQuery();
dats it. but, its giving this error ---- SQL syntax error: the token "(" was not expected here
now, here, when i simply remove this part from the above sql line ----- AND RE_DATE >= TO_DATE('04/11/2012','MM/DD/YYYY') -----the code works perfectly.
RE_DATE is a date field in the sql table.
I even tried this option too - TO_DATE(RE_DATE, 'MM/DD/YYYY') >= TO_DATE('04/11/2012','MM/DD/YYYY')
which is giving same error
please help
-prodyutWhat kind of DB you use?
How do you connect to it?
(If you use ODBC for example, that won't work)

Similar Messages

  • SQL Code not working in Forms Developer?

    Hi all,
    I'm using Oracle 10g and I have th following code running on iSQL+ but not working on Forms and I got the following erro
    The SQL code:
         select returningreason
            from (
                     select returningreason,
                     dense_rank() over (partition by 1 order by count(*) desc) as drnk
                     from returned_goods
                     group by returningreason)
           where drnk = 1;And the error happens near the word over to the right and the error statement is:
    Error 103 at line 18, column 19
       Encountered the symbol "(" when expecting one of the following:
             , formThanks in advance :)

    Triggers are compiled in forms so need to use only the features available to forms, which doesn't include all the new stuff in the database.
    select over partition
    NVL2They don't work in forms and reports too.
    Also if you use them in record Group
    Forms/SQL Compiler was not lined up to the database(10G).
    Meanwhile,for example. Pipelined TABLE and relative Select work in Reports AND Forms.

  • Bug: Validate PL/SQL code not working?

    Hallo,
    in the newer versions of Apex there seems to be an issue with Process code validation.
    It doesn't make any difference if i check the
    "Do not validate PL/SQL code (parse PL/SQL code at runtime only)" option or if i don't.
    There is no parsing of the code and i can write the worst syntax without any problem resulting in bad runtime errors. However the parsing of Region SQL and PL/SQL is working well.
    Anybody knows what this is ?
    Thanks,
    Jochen
    Message was edited by:
    Jochen.Zehe

    I think I know what is happening.
    On the Create Process wizard, when you enter your PL/SQL code in
    http://i14.tinypic.com/4qxai38.jpg
    and click the Next button, the code is parsed and throws an error if it has syntax errors. But if you click on the Create Process button, the process is created, regardless of whether it has syntax errors or not!
    Similarly, the Edit Page Process page also doesn't appear to validate the code, it happily saves the process with any nonsense in the Process Source box, even when the "Do not parse code" checkbox is unchecked (default)
    Definitely a bug (not sure if it is regression from 2.x or not)

  • PL/SQL Code not working without debug statements

    Hi Guys,
    I have a pl/sql code in a procedure, logic iterates through almost 40K records, conditional delete and update.
    When I execute this code, I dont see the deletes and updates happening, though procedure executes for 8 minutes and exits wihtout any error, execption.
    In same procedure when I write some debug statements like dbms_output, then everything seems to be working fine.
    I know this scenario happens in Oracle Forms, wehre we use SYNCHRONIZE.
    But this is plain pl/sql procedure.
    any thoughts on this?
    Av.

    COMMIT ?
    Aside from that, no idea what your procedure looks like, what it does, what version of Oracle you are using, how you are determining "I dont see the deletes and updates happening". etc...
    You'd need to provide a slew of information for anyone to give you any meaningful help.
    I can only assure you that DBMS_OUTPUT doesn't do magic :)

  • SQL Code not working in Forms Developer without Functions?

    Hi all,
    I've write this code into Forms at it's work correctly in SQL and the following error occurened
    The PL-SQL Code:
    DECLARE
         Product_Name Products.Name%TYPE;
         Most_Occurence NUMBER(10);
    BEGIN
         SELECT *
         INTO Most_Occurence, Product_Name
      FROM (SELECT   COUNT (returned_goods.ID) AS "Max Occurence", products.Name
      FROM Returned_Goods
      JOIN Products
      ON returned_goods.productId = products.Id
             GROUP BY returned_goods.productId, products.Name
             ORDER BY COUNT (returned_goods.ID) DESC)
    WHERE ROWNUM = 1;
    END;The error message (appears near JOIN Products) :
       Encountered symbol "PRODUCTS" when expecting one of the following:
          ), with group having intersect minus order start union where connectThanks in advance
    Edited by: ZiKaS on Dec 30, 2008 8:57 AM

    Now...obviously you can't use ansi join syntax in that forms module. So rewrite your query with
    FROM returned_goods, products
    WHERE returned_goods.productId = products.id
    hth

  • PL/SQL code not working

    why is this code giving me error?
    declare
    type dept_tab_type is table of departments%rowtype;
    index by binary_integer;
    dept_tab dept_tab_type;
    v_counter number(3):= 270;
    begin
    for i in 10..v_count
    loop
    select * into dept_tab(i)
    from departments
    end loop;
    for i in dept_tab.first..dept_tab.last
    loop
    DBMS_OUTPUT.PUT_LINE(dept_tab(i).department_name);
    end loop;
    end;
    i got this error
    ORA-06550: line 3, column 5:
    PLS-00103: Encountered the symbol "INDEX" when expecting one of the following:
    begin function package pragma procedure subtype type use
    <an identifier> <a double-quoted delimited-identifier> form
    current cursor

    I think its you DEPT_TAB_TYPE deceleration which was incorrect.
    I think this might do it;
    set serveroutput on
    declare
      type dept_tab_type is table of departments%rowtype index by binary_integer;
      dept_tab dept_tab_type;
      v_counter number(3):= 270;
    begin
      for i in 10..v_counter loop
        select *
        into dept_tab(i)
        from departments
      end loop;
      for i in dept_tab.first..dept_tab.last loop
        DBMS_OUTPUT.PUT_LINE(dept_tab(i).department_name);
      end loop;
    end;
    /BUT
    UNTESTED!

  • Applets not working with Java 1.7.0_51 in MII 14.0 SP4 Patch 5

    Hi,
    I'm currently evaluating the migration of our MII 12.0 developments to MII 14.
    But I'm running in several issues just trying to use simple things like a SQL query template with an iGrid Display template in test mode.
    Used versions are: MII 14.0 SP4 Patch 5 and on client side the latest Mozilla Firefox with Java 1.7.0_51
    At first I always get a java security warning when the applet is being loaded about unsigned applications.
    At second the applet itself is not running. It always shows "No data available" and the java console shows the following errors (iResult is the id of the applet):
    iResult [ERROR] - Couldn't set query template: No Query Defined
    iResult [ERROR] - Couldn't set display template: null
    iResult [ERROR] - Couldn't set display template: null
    Is this perhaps a general problem, that the MII applets are not working with Java 1.7.x versions?
    If I call the same MII page from a client with Java 1.6.x it is working without errors.
    Do you have some suggestions for me?
    Regards Timo

    please clear your JAVA Cache. that should solve the JRE issue. thanks

  • BAPI not working in Java Webdynpro

    Hi,
    My BAPI from SAP is working in Netweaver perfectly, but when I call the same with the equal parameters in Java webdynpro, no results.
    I'm using following function: 'CVAPI_DOC_VIEW'.
    Any idea why the BAPI is not working in Java Webdynpro?
    Regards,
    Tim

    Hi Tim,
    AFAIK 'CVAPI_DOC_VIEW'  will work only in standard SAP Dynpro. Inside Webdynpro it is forbidden to save files in the background and using GUI class with execute, so you cannot use that Standard FM.
    Check this thread .
    Thanks
    Katrice

  • What will you do if any SQL is not working.in oracle 10g...apps 11.5.10.2

    What will you do if any SQL is not working. in oracle 10g....apps 11.5.10.2

    928714 wrote:
    yes sir.If you help me in answering my questions i wll be very thankful to you sir.
    tnx,I haven't a clue.
    As you have been advised in many of your posts, go study the documentation for whichever specific topic you are interested in.
    For me to answer your questions, I would need to go get that documentation.
    Then I would need to read that documentation.
    Then I would need to write a forum post that interprets what I think I learned from that documentation.
    It is so very much faster if YOU go do that instead of posting to a forum and expecting others to do it. You will remember what you study for a lot longer time if you teach yourself.

  • Force encryption on SQL Server not working?

    Hello Everyone,
    I'm running SQL Server 2008 64-bit. I've installed a self-signed cert on the box and set  "Force Encryption"  and restarted SQL server. 
    I setup a client machine to trust the authority of the cert installed on the server. When I connect to that SQL server from SSMS from a client machine and select the "encrypt connection" option in the client Connection properties, SSMS correctly complains
    that the cert on the server does not match the computer name I asked to log into . This is because, although the cert is trusted, the dns name dos not match the CN in the cert <- Perfect, exactly what I am expecting.
    When I connect to the same SQL server from the same client but  UNCHECK "encrypt connection" on the client, I'm able to login. Considering I've checked the "Force Encryption" on the server, the server should have rejected the connection. Why not?
    Ameer Deen

    Hi all,
    We are implementing a Merge Synchronization solution which involves three SQL Servers located on three Azure locations worldwide and one on-premises location. We need to secure communications between all servers. We are evaluating the encryption of all server
    communications through SSL:
    http://technet.microsoft.com/en-us/library/ms191192.aspx
    When we configure one server (let’s call it server A) to accept only encrypted connections (with Force Encryption=Yes) we still can connect from other server (let’s call it server B) that do not have the certificate installed. We would expect the server
    B to fail in the attempt of connect as server A should only accept encrypted communications and those should need the certificated to encrypt/decrypt everything (commands and data).
    We have also review the following forum post that is very similar to this one:
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/bde679d9-ff83-4fa7-b402-42e336a97106/force-encryption-on-sql-server-not-working
    In all cases the Microsoft answer is:
    “When the
    Force Encryption option for the Database Engine is set to YES, all communications between client and server is encrypted no matter whether the “Encrypt
    connection” option (such as from SSMS) is checked or not. You can check it using the following DMV statement”
    When we run the provided DMV statement to check if encryption is enabled:
    -- To check whether connections are encrypted between server and clients
    SELECT encrypt_option
    FROM sys.dm_exec_connections
    We get “TRUE”. So theoretically encryption is enabled.
    Then:
    Why can we run SQL statements against server A from server B (with SSMS) without any certificate?
    Are we wrong when we expect server A to refuse any client that do not have the right certificate?
    How can server B, without any certificate, decrypt the data encrypted by server A?
    Our intention is to encrypt all server in the same way so all of them will accept only encrypted communications. We are assuming that the Merge Agent will be able to communicate with the Publisher and the Subscriber through this encrypted environment. May
    anyone please confirm ti?
    Thanks for your help.
    Best Regards
    Benjamin Moles

  • I updated my mac's OS to Yosemite and now my eye drop tool will NOT work inside premiere pro. Can anyone help me fix this issue?

    The eyedropper tool for selecting colors to key out or to fill text will not work inside premiere pro, this error started when I updated my mac os to yosemite.

    Hi Transportation,
    Does the error occur in OS X 10.9? If not, why not remain at OS X 10.9? Is it necessary to run OS X 10.10?
    The general rule of thumb is that when you are running software that is no longer tested or supported on a new operating system, you have to prepare for anomalies like this. You may want to install a separate bootable hard drive with OS X 10.9 on it so you can continue running that software more reliably.
    Hope that helps,
    Kevin

  • PS4 Game Voucher Code not working

    my PS4 Game Voucher Code not working and says: "The code you entered may not be correct or may no longer be valid" "Please check your entry (e-820000134)  

    Voucher codes are region-specific. For instance a US voucher won't work with a UK account. First thing to check is whether the voucher's region matches your account's region.

  • Sql is not working after changing from MsAccess into sql server

    Following Sql  is not working after changing from MsAccess into sql server. 
    sum(trn.sales) as sales,
    sum(trn.cost) as cost,
    sales - cost as profit // Here is not working . can we not use sales a column. Please advise
    from trn
    Kind Regards
    pol
    polachan

    It will not work if use two different column from the table or column  from two  different table
    Example
    sum(trn.sales * trn.rate) as salesAmount,
    sum(trn.cost) as cost,
    sum(trn.salesAmount)-sum(trn.cost) as profit ----- Here is not working . can we not use sales a column. Please advise
    from trn
    Regards
    polachan

  • Java Script Code not working properly for visios in sharepoint 2013

    Hi all ,
                 I have few visios and I am using the visio web part to display and to redirect from one visio to other visio I am using the java script code through content editor web part . 
    In share point 2010 it's working fine , I was able to redirect to all the visios and code is working fine .
    In share point 2013 its not the same , Its not working properly . only for the first time the code is working fine . once it goes to next visio the code stops working . 
    For example if i click in visio A it gets redirect to Visio B and its stops working , it wont allow to do any other steps . 
    I have checked with the URL its correct , I am not able to find any error also .
    Indresh

    This will be likely caused by the Minimal Download Strategy not registering the Javascript on the page reload. You can turn off the MDS feature to test this.
    You can either turn off MDS in your site, or register your Javascript functions with MDS to ensure they are called. To do this, you'll need all of your code to be wrapped in a javascript file (Embed this on the page using a <script> tag and
    inside that file in a function, which you then register with MDS as follows (I usually do this in the first line of the javascript file):-
    RegisterModuleInit("/SiteAssets/YourJavaScriptFile.js", NameOfYourFunction);
    Regards
    Paul.
    Please ensure that you mark a question as Answered once you receive a satisfactory response. This helps people in future when searching and helps prevent the same questions being asked multiple times.

  • Pl/sql Clob code not works for database table but works for collection!

    Dear friends
    I modified pl/sql code to insert large data for clob column ın ORACLE APEX , It works for collection (I modified it to work for both)
    the modified code is blod
    declare
    aClob1 clob := empty_clob;
    aClob2 clob ;
    begin
    dbms_lob.createtemporary( aClob1, false, dbms_lob.SESSION );
    for i in 1..wwv_flow.g_f01.count loop
    dbms_lob.writeappend(aClob1,length(wwv_flow.g_f01(i)),wwv_flow.g_f01(i));
    end loop;
         apex_collection.create_or_truncate_collection(p_collection_name => 'CLOB_CONTENT');
         apex_collection.add_member(p_collection_name => 'CLOB_CONTENT',p_clob001 => aClob1);
         htmldb_application.g_unrecoverable_error := TRUE;
    select cc into aClob2 from tt where id = 21 for update ;
    dbms_lob.write(aClob2,Length(aClob1),1,aClob1); commit;
    end;
    but the charcters more than 8100 not be saved to database clob column !
    regards
    Edited by: Siyavus on Jan 30, 2009 5:26 PM
    Edited by: Siyavus on Jan 30, 2009 5:29 PM

    Dear Thomas
    dbms_lob.write(aClob2,*dbms_lob.getlength*(aClob1),1,aClob1); commit;
    I tried it ( dbms_lob.getlength(aClob1) ) but the result is the same
    regards

Maybe you are looking for

  • "Smart Quotes" not consistent with imported text

    I have a very long Pages document (400 pages). I wrote the text in an app called "Copy Write," exported the text to RTF, and pasted it into Pages for formatting and polish. In Pages, some of the quotation marks and apostrophes are "smart" (curvy), wh

  • While  updating my apps on my iPhone and it keeps showing  one apple id & ask me to enter pwd.

    While  updating my apps on my iphone and it keeps showing  one apple id & ask me to enter pwd. (I think the apple id belongs to the Shopkeeper , he helped to download the apps while am purchasing the phone). I have already updated my apple id from th

  • Move PSE 8 catalog and all related file to external drive.

    All my photos are on an external drive.  I would like to be able to move back and forth from desktop to laptop and have all my catalogs, tags, etc in order.  I am running Windows XP and PSE 8 (when it does not crash).  thanks for this forum and your

  • How do you navigate dialogue boxes using the tab key in Photoshop CS6 on Mac OS X Mavericks?

    I know that seems really 101 and obvious, but I worked in Photoshop on a PC for many years, and using the tab key to navigate through every field/radial button/dropdown menu/etc. was never an issue. On the Mac OS X however, it only navigates through

  • File save as command

    Hi is there a way to get acrobat to retrieve data from the first form input field and then use it in the file naming convention when using the "file save as" command. is there a javascript or something to do this? In other words, I have a savable for