Can't create dynamic query that runs!

Hi all,
I am attempting to create a dynamic query to go against my Oracle Db with preparedstatement. I tried many other ways also and have exhausted everything I can think of or find. My query works when I put it together with a text editor after it has been output by my program, but won't work as is. It seems like it is splitting it up somehow.
Here is the code...Is there any way to get this query together?
Object objectName1 = (String) rapArray.get(0);
StringBuffer query = new StringBuffer("SELECT end_phrase FROM rap_lines WHERE start_phrase IN ");
String teststring = objectName1.toString();
query.append("('" + teststring + "'");
for (int i=1; i < initArraySize; i++){
objectName1 = (String) rapArray.get(i);
teststring = objectName1.toString();
********the problem somehow seems to lie HERE where the file is separating just after "teststring" is added********
query.append(", '" + teststring + "'");
query.append(")");
System.out.println(query);
ResultSet rs = stmt.executeQuery(new String(query));
returnArray = new ArrayList();
while (rs.next()) {
s = rs.getString("end_phrase");
System.out.println(s);
Here is the query it outpus and how it seems to be separated...when put together, it works fine.
SELECT end_phrase FROM rap_lines WHERE start_phrase IN ('Your Pops caught you smoking and he said NO WAY!
', 'Its getting hot in here.
', 'Im the cream of the crop. I rise to the top.', 'WHA?
', 'Youz a big fine woman.
', 'That car dont come out till next year!
', '$80,000 plus CHROME!
', 'Sippin on gin and juice. Laid Back
', 'All I wanna do is a zoom zoom zoom and a boom boom!
', 'Rollin in my six-fo...')

Hi.
The only possibility that I can see here is that the Strings in rapArray have return characters at the end.
Once you've solved that, here are two miscellaneous pieces of advice:
1. The value of objectName1 is always a reference to a String. So, declare objectName1 a String. Also, don't do objectName1.toString() - this has no effect except for making the code a little more difficult to read. When you've done these things, you'll probably find the need for testString disappears.
2. There is a special markuo to put around code when submitting it to the forums. See the 'code' markup at http://forum.java.sun.com/faq.jsp#messageformat
Regards,
Lance
Lance Walton - [email protected]
Team In A Box - Software without Tragedy
http://www.teaminabox.co.uk

Similar Messages

  • How can we create dynamic query

    can any one please tell me how can we cretae a dynamic query in android by join two tables

    Hi Mousumi,
    Can you please be more brief on the question.
    cretae a dynamic query in android by join two tables
    What do you mean by this ?

  • Creating a job that runs a Tcl script

    Hi,
    We currently have a scheduled job running a Tcl script on a 8.1.7 DB. My question is, can I still use the same setup in 10g DB (i.e. creating a job that runs Tcl script)? If I can, how am I gonna do it?
    Thanks,
    howie

    It depends on how you scheduled the job in 8.1.7 DB.
    By Cronjob? Yes you can do the same to connect to 10g
    By DBMS_JOB?. Yes you can do it in 10g and in addition, can improve it with DBMS_SCHEDULER
    Via OEM? Yes in can use Enterprise Manager to create a Job that runs the Script.

  • How can I create a query

    Hi BWers,
    How can I create a query, when the Customer run the report today he should see this month data.when the customer run the report for previous month he should see previous months data.How can I do this without going for Select options.

    Hi,
    If your customer run this report when he input a day in previous month, they want the whole previous month total data, you can use Replacement Path variable to get the previous month. If your customer run this report when he input a day in previous month, they want the data from 1st day to input day in the month, you can use customer exit variable to calculate 1st day in the previous month.
    When the Customer run the report today he can see this month data, those two type variables can do.

  • Can I create a form that doesn't trigger Acrobat's JavaScript disabled / security issues warning?

    Hello,
    Can I create a pdf that doesn't trigger Acrobat's JavaScript is currently disabled and this document uses it for some features.  Enabling JavaScript can lead to potential security issues.
    I even get this error when I create a blank pdf.
    I'm not using any JavaScript in the form and the nature of the message might tend to be a bit scary to some people since it mentions enabling JS can lead to potential security issues.  I basically want to disable the messaging of a feature I'm not even using.
    Anyone know if this is possible and if so, how I go about it?
    Thank you.

    Hi,
    I too share your frustration!!
    Unfortunately I do not have a complete answer for you.
    From the start I must say that Stefan Cameron has been very helpful (http://forms.stefcameron.com/2010/01/14/acrobatreader-9-3-now-available/), however I have not had sufficient time available to deal with the issue (or find a satisfactory resolution).
    The original post that Srini shared with you related to an XFA form that had FormCalc and Javascript in it. I will now share with you another situation that is closer to your experiences.
    Sometimes where we have a complex solution/form, we often give our users a PDF with instructions and demonstrations. We generate these using Adobe products:
    LiveCycle Designer ES to generate the solution/form;
    Captivate to record the demonstration (.swf);
    Acrobat to package it up in a static PDF.
    The screen shots below are from a PDF that includes written instructions and six Flash (.swf) files. The PDF does NOT include fields/form objects and does NOT include any FormCalc or Javascript.
    One of the big sells in Acrobat 9 was that Adobe had fully integrated Flash (Adobe product, ex. Macromedia) into Acrobat 9. This mean that .swf files could run natively inside a PDF. Brilliant!!!  The website today is still pushing this message, for example:
    Now bear in mind that the following screenshots are from a PDF that does not contain any scripting - its sole purpose is to "inform" the user, "look as good as the work I put into it", incorporate instruction and "multimedia" in a "single polished file" and I should be "confident that my audience will be able to view my work exactly as intended".
    Not so!!
    When the user now opens the form, all looks OK. No warning. They can read the instructions and scroll down to the multimedia (.swf files).
    However when the user clicks on the multimedia, the yellow bar appears:
    I go through the "trust" process:
    And the PDF looks like it is OK, no yellow bar. When I click on the multimedia, it begins to play - yes!! BUT ONLY FOR A SECOND OR TWO AND THEN IT STOPS AND GOES BACK TO THE START - AGGGGHHHHHHH!!!!!. I would apologise for shouting, but this is beyond frustration. The work in capturing six screencasts in Captivate, annotating them, publishing to .swf and packaging up in Acrobat has been a complete waste of time. Worse than that I now have several PDFs out there, that do not work. Good advertisement for my business? I don't think so!!
    The document that Stefan provided (Managing JavaScript Execution in the Acrobat Family of Products) does not mention Flash/.swf as being a problem. However I would recommend that you go through this document, as it may help you.
    So, where to now? I don't know. The previous posts and Stefan's responses have several urls that may help. You should maybe consider logging your experiences as a bug (log at Adobe).
    In the meantime good luck,
    Niall
    UPDATE:
    This behaviour (.swf playing for only a few seconds) happens in PDFs where the .swf is inserted as legacy media to run in earlier versions of Acrobat/Reader. In this case Acrobat/Reader is making an external call to Flash Player. Hence the yellow bar. However it does not explain why the Flash video still does not play when trusted.
    If the .swf is added into the PDF as Flash media to run on Acrobat 9 and above, then it works without displaying the yellow warning bar.
    So maybe any feature of your PDF that calls an external resource is likely to show the yellow warning bar.

  • Create a validation that runs when a button is pressed

    Hi good people from this forum, I was wondering if it's possible to create a validation that runs when a button is pressed.
    I'm using Oracle Apex 4.2.2 with Oracle Apex Listener 2.0 and Oracle Database XE 11g
    Thank you so much for your time
    P.S. On another note, How can I change my display picture =P?

    You can create a validation and give it's condition like 'When Button Pressed' and select a button name or select the Condition Type as 'Request=Expression1' and give request(button name) in Expression1.
    Thanks
    Lakshmi

  • Can I create a JAR that is an Applet and Desktop app at the same time?

    Hi mates.
    Can I create a JAR that is an Applet and Desktop app at the same time?
    Thanks.

    Ricardo_Ruiz_Lopez wrote:
    ..I have one problem, I want a JMenuBar but I can't add it inside a jPanel.
    Any idea?
    SSCCE
    It can be compiled/run as an applet or application something like this (e.g. for a Win command prompt).
    C:\Users\Andrew\Hybrid> javac Hybrid.java
    C:\Users\Andrew\Hybrid> java Hybrid
    C:\Users\Andrew\Hybrid> appletviewer Hybrid.java
    C:\Users\Andrew\Hybrid> // YES the previous line requires a '.java'  suffix - trust me.  ;-)Code
    // <applet code='Hybrid' width='600' height='400'></applet>
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    public class Hybrid extends JApplet {
        public void init() {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    GUI gui = new GUI();
                    getContentPane().add( gui.getMainPanel() );
                    setJMenuBar( gui.getMenuBar(false) );
                    validate();
        public static void main(String[] args) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    JFrame f = new JFrame("Test Hybrid");
                    f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
                    GUI gui = new GUI();
                    f.setContentPane(gui.getMainPanel());
                    f.setJMenuBar(gui.getMenuBar(true));
                    f.pack();
                    f.setLocationRelativeTo(null);
                    f.setVisible(true);
    class GUI {
        private JPanel mainGui = null;
        private JMenuBar menuBar = null;
        public JPanel getMainPanel(){
            if (mainGui==null) {
                mainGui = new JPanel( new BorderLayout(3,3) );
                mainGui.setBorder( new EmptyBorder(5,5,5,5) );
                JToolBar tb = new JToolBar();
                for (int ii=1; ii<6; ii++) {
                    tb.add( new JButton( "Btn " + ii) );
                    if (ii%2==0) {
                        tb.addSeparator();
                mainGui.add(tb, BorderLayout.NORTH);
                mainGui.add( new JSplitPane(
                    JSplitPane.HORIZONTAL_SPLIT,
                    new JScrollPane(new JTree()),
                    new JTextArea(20,20)
                    ), BorderLayout.CENTER );
                mainGui.add(new JLabel("Main user interface.."), BorderLayout.SOUTH);
            return mainGui;
        public JMenuBar getMenuBar(boolean isFloating) {
            if (menuBar == null) {
                menuBar = new JMenuBar();
                if (isFloating) {
                    JMenu fileMenu = new JMenu("File");
                    fileMenu.add( new JMenuItem("Exit") );
                    menuBar.add( fileMenu );
                JMenu helpMenu = new JMenu("Help");
                helpMenu.add( new JMenuItem("About") );
                helpMenu.add( new JMenuItem("Help") );
                menuBar.add( helpMenu );
            return menuBar;
    The code is not intended to be well designed. It is just written to be brief and demonstrate a few points.
    Edit 1:
    Added some access keywords in a passing gesture that the sample aimed at encapsulation.
    Edited by: AndrewThompson64 on Sep 2, 2010 1:34 PM

  • Help: How to create a query that transpose the column content?

    Here, suppose that I have two tables
    TAB_A:
    ID     TYPE
    1     AA
    1     AB
    1     AC
    2     BA
    2     BB
    2     BC
    2     BD
    I'd like to create a query that gives result as:
    ID     TYPE
    1     AA AB AC
    2     BA BB BC BD Any suggestions?
    Thank you in advance.
    Jimmy

    Hi
    Try this:
    SELECT id,
    replace(LTRIM(MAX(SYS_CONNECT_BY_PATH(type,'*'))
    KEEP (DENSE_RANK LAST ORDER BY curr),'*'),'*', ', ') AS type
    FROM (SELECT id, type,
    ROW_NUMBER() OVER (PARTITION BY id ORDER BY type) AS curr,
    ROW_NUMBER() OVER (PARTITION BY id ORDER BY type) -1 AS prev
    FROM tab_a)
    GROUP BY id
    CONNECT BY prev = PRIOR curr AND id = PRIOR id
    START WITH curr = 1;
    Ott Karesz
    http://www.trendo-kft.hu

  • How can I create a query with tables in INFOSET?

    Dear Gurus,
    How can I create a query with tables in INFOSET?
    Just tables and fields INFOSET?
    Kind Regards,

    Hello
    Check following SCN Article for your understanding/reference:
    - [Using Infoset Query ,SAP Query and Quick Viewer|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/10eab7af-0e54-2c10-28a5-87b47adbe1a5]
    Regards
    JP

  • How can I create a query with web service data control?

    I need to create a query with web service data control, in WSDL, it's query operation, there is a parameter message with the possible query criteria and a return message contains the results. I googled, but cannot find anything on the query with web service. I cannot find a "Named Criteria" in web service data control like normal data control. In Shay's blog, I saw the topics on update with web service data control. How can I create a query with web service data control? Thanks.

    Hi,
    This might help
    *054.     Search form using ADF WS Data Control and Complex input types*
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html

  • How can I create a slideshow that depicts only a version of a photo rather than the original? Since the original and new versions are saved together, the aperture slideshow often choices the original rather than the desired version to display/

    How can I create a slideshow that depicts only a version of a photo rather than the original?   Since the original and new versions are saved together, the aperture slideshow often choices the original rather than the desired version to display.

    There are two things we use the name "Slideshow" for in Aperture:  a Slideshow Album, used for making Slideshows, and the Slideshow that is made.  (Imho, it is a design mistake to not call the containers used to create Slideshows, Books, etc., "Albums".)
    The Slideshow will use the Album Pick from any Stack.  A good way to use Aperture is to promote the Image you want to regularly use (such as, for example, a Version with adjustments) to the top of the Stack.  This makes it the Stack Pick, and will be the default Album Pick.  If you haven't done that, you can still change the Album Pick for any Stack in a Slideshow Album.  Expand your Stack(s), select the Image in each Stack that you want to be the Album Pick (and thus shown in the Slideshow), and "Stacks➞Set Album Pick".  (Note the keyboard shortcut; there is also a Toolbar icon for this.)  The change is immediate.  The Slideshow will always show the Album Pick (or, if there is not one, the Stack Pick) for every Stack in your Slideshow Album.

  • HT4410 If I install Windows 7 on my MacBook Pro using Bootcamp, now having 2 start up drives, do I select the Windows drive, then I can install a software program that runs only on a PC?

    If I install Windows 7 on my MacBook Pro using Bootcamp, now having 2 start up drives, do I select the Windows drive, then I can install a software program that runs only on a PC?

    Thank you

  • No data media can be created for the proposal run - Bacs Payment

    Hi,
    When i schedule program RFFOGB_T for bacs payment and select proposal run only i get the following error "No data media can be created for the proposal run". But when i execute the program with out selecting the check box " Proposal run only...a file was getting generated...Could any onle pls help me resolve this problem.
    With Best Regards,
    M.Naveen Kumar

    The post has been answered

  • Creating a query that provides a default transaction type for those transactions not categorized?

    How could I create a query that provides a default transaction type for those transactions not categorized?
    So assuming I have:
    * Transactions table (with transactions)
    * Categories table
    * transactions_categories table - allows to allocate multiple categories (with a percentage)
     - tranactionID
     - categoryID
     - percentageAllocation
    * Usage is such that only non-personal categories have been applied through out data.  So there is a lot of transactions with no categories applied
    Aim:
    * Want to create a query that creates a list of all the allocated amounts, so would include as columns:  transaction.tDate, transaction.tTitle, categories.name, allocatedAmount(calculated from percentage * transaction amount)
    BUT:
    * How could I include in the query, the entries that cover all transaction that haven't been allocated, to a default category "personal", where the allocated Amount would be 100% of the transaction value
    * And also (if it were possible), for transactions that have been categorized but not for the complete transaction value (say only 50% was allocated to a category), how to to cover this off to.  

    To default the value of the category:
    select IIf(IsNull(Category),"Personal",Category) as Category,IIf(IsNull(Category),"100%",PercentageAllocation
    ) as PercentageAllocation from [yourtable]
    What do you want to put the values of these ones:
    And also (if it were possible), for transactions that have been categorized but not for the complete transaction
    value (say only 50% was allocated to a category), how to to cover this off to.  
    Fouad Roumieh

  • How can we create dynamic pie chart in jsp

    hi im a new jsp programmer and i just want to know how can i create dynamic pie chart in jsp

    http://sourceforge.net/projects/jfreechart
    - Saish

Maybe you are looking for

  • Solaris 10 new features

    Solaris 10 introduces project-based roles within the OS-- we have configured a project for oracle but weren't able to find definitive instructions as to what should be set and, more importantly, what each parameter being set is actually doing for Ora

  • MacBookPro: HD formatted with same type computer - impossible to put OSX 10.5 on it. Any help???

    Hi there, I'm fully new with Mac. I'm aware of PC but Mac is of course a different story. Mac 1 is the bad one. Mac 2 is fully functioning. I did twice the hardware tests on Mac 1: both tests didn't mention any problem. I formatted the HD from Mac 1

  • Should I be disappointed?

    My G3 just went to the kids and I was blessed with the new iMac 24" Intel. I have been so excited, yet after one month I have to admit, my former G3 "wonder" works better and faster. Could there be something wrong this, should I call the Mac Life sto

  • BT ID web app or page issues

    For the last month, I cannot access my BT account online due to a "Web App" or page requiring me to setup / link to a new BT ID. I have tried on numerous occasions to setup / link with BT ID automatic app process however at "Step 3" where you put a n

  • Lync2013 and Skype integration

    The following steps are done: 1. provisioning with Microsoft - done 2. All the steps in TechNet dn440170 are done But, Lync2013 clients are still not able to see Skype users and viceversa Question 1. Is there anything else I need to do 2. Is reverse