String str = " Select ? , ...

Hi ,
I have a query for which I need to use PreparedStatement .The query runs likes this :-
String str = " Select ? , ename from emp where deptno ? ";
The values of ? need to be assigned dynamically.
But I cannot create Prepared Statement from this query .
If you have got answer to your questions can you inform me at
Thanks in advance

No, and you can't use a PreparedStatement where you have ? for the table name either. The database can't prepare it because it doesn't know what fields you will be asking for. So you will have to use a Statement and generate the SQL with string calculations. Sorry.

Similar Messages

  • Finding strings in "Selected Files in Site" not working

    When searching files for a string, and selecting "Selected Files in Site", Dreamweaver (starting today) will only search the root directory, NOT the selected subdirectory.  This is uselss.  I've been using Dreamweaver for years.  Today I switched to mapping the site with an IP address instead of a server/domain name, could this be the culprit?

    I encountered exactly the same problem.
    I'm trying to solve this problem...

  • Concatination of string to select statement

    hi all,
    pl help me out.
    i want to concatenate string to select statement like
    create or replace procedure my_proc(p_sal number)
    as
    v_name varchar2(20);
    ssql varchar2(4000);
    begin
    ssql := ' ';
    select ssql || ' '|| select emp_name
    into v_name
    from employees
    where sal =p_sal;
    end;
    but it is giving error .
    pl correct it.
    thanks
    pavani

    Pavani,
    Still not clear.
    "Multiple conditions" sounds like you are trying to build predicates in the where clause, but in your example it looks like you are trying to build a select clause. Also your parameter is p_sal so the where clause "sal = p_sal" is fixed.
    The real question is WHY you want to "write multipul conditions"? WHY you want to "store it in a string .and then concatenate the string to next condition so on"?
    Regards,
    Rob.

  • "String str=new String("My String")" v.s. "String str="My String";

    -- what's the difference bet String str="My String"; to this
    String str=new String("My String");

    Its a subtle one. Its also been asked a hundred times before :-)
    When a java class is compiled it "interns" all the Strings it can find.
    Anywhere that you use that string, gets replaced with a reference to that string.
    So the first gets a reference to the interned String.
    The second creates a new String, using the interned String as an argument - results in reserving new memory.
    Take this code:
    String str1 = "My String";
    String str2 = "My String";
    String str3=  new String("My String");In effect the compiler turns it into something like this:
    String internedString = "My String"
    String str1 = internedString;
    String str2 = internedString;
    String str3 = new String(internedString);So initially, it only stores "MyString" once, and all your String variables point at that same memory space. As Strings are immutable in java (the contents never change) this is safe to do. str3 creates a NEW String, which reserves new memory, and copies the contents of internedString into it.
    So
    str1 == str2 (they point to the same bit of memory)
    str1 != str3 (str3 created a new String, so is in new memory)
    str1.equals(str3) (the contents of the strings are the same)
    Hope this helps,
    evnafets

  • Strinig.indexOf(String str, Int fromIndex)

    Hello.
    In the API reference manual J2SE 5.0 (and earlyer also),
    "public indexOf(String str, int fromIndex)"
    is discribed such as,
    | Returns the index within this string of the first occurrence of the specified substring,
    | starting at the specified index. The integer returned is the smallest value k for which:
    | k >= Math.min(fromIndex, str.length()) && this.startsWith(str, k)
    I can't understand why str.length() is needed here.
    For example,
    String string = "my beautiful dream";
    String str = "ea";
    int fromIndex = 10;
    in the case, str.ng.indexOf(str, fromIndex) returns 15, the value is what I what to get.
    But,I think the smallest value k for which
    | k >= Math.min(fromIndex, str.length()) && this.startsWith(str, k)
    is 4, isn't it?
    import junit.framework.TestCase;
    * @author phinloda
    * test String.indexOf
    public class IndexOfTest extends TestCase {
         public final void testIndexOf() {
              String targetString = "my beautiful dream";
              String str = "ea";
              int fromIndex = 10;
              int k1 = myIndexOf(targetString, str, fromIndex);
              assertTrue(k1 >= Math.min(fromIndex, str.length()) && targetString.startsWith(str, k1));
              int k2 = targetString.indexOf(str, fromIndex);
              assertTrue(k2 >= Math.min(fromIndex, str.length()) && targetString.startsWith(str, k2));
              assertEquals(k1, k2);
         private int myIndexOf(String targetStr, String str, int fromIndex) {
              for (int n = 0; n < targetStr.length(); n++) {
                   if (n >= Math.min(fromIndex, str.length()) && targetStr.startsWith(str, n)) {
                        return n;
              return -1;
         public static void main(String[] args) {
              junit.textui.TestRunner.run(IndexOfTest.class);
    }lastIndexOf(String str, int fromIndex) is more difficult for me.
    ("this.length()" is right?, but it's nonsense.)

    ("this.length()" is right?, but it's nonsense.)Yes, it should be this.length() and not str.length().
    I don't think it's nonsense because now the empty
    string always gives a non-negative index, e.g.
    "string".indexOf("", 1000) returns 6...perhaps this
    property is useful for some string algorithmsI think it only does this for an empty String, so it would be clearer if the docs said something about returning this.length() if str.length()==0.

  • Open cursor for string and select from partition (cannot bind)

    Hi,
    i don't manage to use a bind variable for a select ... from ... PARTITION(...).
    It doesn't work to use something like
    open cur for 'select ... from ... PARTITION(:1) where ...' using 'NDAY_20120301';So i have to create the cursor string with string functions each time i change the partition.
    But that means, that the string changes each time.
    Doesn't that prevent from re-use in library_cache?
    best regards,
    Frank

    >
    So i have to create the cursor string with string functions each time i change the partition.
    But that means, that the string changes each time.
    >
    Yes it does.
    Doesn't that prevent from re-use in library_cache?
    >
    Yes it does.
    So why do you care? Unless you have large numbers of partitions what difference does it make? Bind variables are useful to keep Oracle from doing hard parses of queries that are basically the same but use different filter values. Such as an INSERT statement that uses different values FOR EACH ROW rather
    You are just constructing the main (non-filter) part of the query one time and need a single value for the entire query regardless of how many rows - that isn't really a use case for bind variables and isn't going to provide any real benefit.
    So the real question is why do you even care about something that wouldn't provide any benefit to you even if you could do it?
    Looks like you just want to 'roll your own' parallel processing rather that use, and pay for, Oracle's parallel functionality.
    If each partition uses its own tablespace you could filter on the FILE Id of the ROWIDs since the file number will be different for each tablespace and datafile.
    1. Determine the list of file numbers for each partitions tablespace.
    2. Use a WHERE DBMS_ROWID.ROWID_RELATIVE_FNO (ROWID) = :n filter (or use IN (:n1, :n2))to filter rows based on file number(s) for the partition you want
    See DBMS_ROWID.ROWID_RELATIVE_FNO in the PL/SQL Packages and Types doc
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_rowid.htm#i1004259

  • Comparing string in select query

    Hi,
    select single *
           from mara
           where <b>matnr = wa-matnr</b>.
    Here matnr is char18. Can we compare string like this?
    When <b>wa-matnr</b> is in <b>lower case</b> it is setting sy-subrc = 4, even though the matnr exists in mara. When converted to upper case and used it is setting sy-subrc = 0.
    Is there any other solution for the problem? I have checked out with matnr's conversion routine. It is also not working.

    just try  dat way...
    <b>ex...</b>
    data:wa_matnr like mara-matnr.
    data:wa_matnr1 like mara-matnr.
    data: gv_matnr like mara-matnr.
    wa_matnr = 'comptest'.
    CALL FUNCTION 'TERM_TRANSLATE_TO_UPPER_CASE'
      EXPORTING
       LANGU                     = SY-LANGU
        TEXT                     = wa_matnr
    IMPORTING
       TEXT_UC                   = wa_matnr1
    EXCEPTIONS
      NO_LOCALE_AVAILABLE       = 1
      OTHERS                    = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    select single matnr
    from mara into gv_matnr
    where matnr = wa_matnr or matnr = wa_matnr1.
    write : gv_matnr.

  • Execute an string as select statement

    Hi,
    I have a problem:
    I'm working with an older oracle verion (7.x??). I want to create a dynamic select statement. I create a string, e.g. v_sql_string, and want the database to execute it. What possibilities do I have to do this?
    Thanks in advance
    Mathias

    Yes,
    I went through the documentation, but it's only working with cursors.
    For better comprehension:
    This is the string:
    'select count(*) from invoice where sup_no ' || op_sup_no || ' v_sup_no and trpt_code ' || op_trpt_code || ' v_trpt_code and ship_no ' || op_ship_no || ' v_ship_no'
    I want to set the operators (op_xxx) dynamiclly. Isn't there something like RUN or EXECUTE, where I only have to pass a string, and the statement is executed ...
    But I don't know how ...
    Mathias

  • String Character Selection

    I just want to know if anyone knows the code so I can select the first character in a string and the last character in the string so that I can do the following function :
    First("ABC") ^ Last("ABC") = Answer
    Tks for any help

    You can use the charAt() method of the String class to help you find out the values. To find the first character use charAt(0) and to find the last character you can use charAt(String.lenght() - 1).
    Example:
    String word = "ABC";
    char firstLetter = word.charAt(0);
    char lastLetter = word.charAt(word.length() - 1);
    I hope this helps.

  • String in Select option

    Hi experts,
    I want to get a string length of greather than 100 through select options / Parameter .  Is it possible...? then how..?
    Pls give me a solution.
    Regards,
    Murugan arumugam.

    Hi..
    PARAMETERS : p1 type string.
    SSTRING 1-255 Character string string
    STRING 256-... Character string string
    The type SSTRING is available as of release 6.10 and it has a variable length. Its maximum length must be specified and is limited to 255. The advantage of this type compared with CHAR, is that it is assigned to the ABAP type string.
    <b>Reward points for useful ans..</b>
    Thanks & Regards
    ilesh 24x7

  • Question on JTextArea.append(String str)

    Hi All,
    When i provide JTextArea.append("FMTL") it is showing me on the JTextArea but when i give it as
    String item="Viswanadh";
    JTextArea.append(item).this particular statement is remaming blank on the TextArea.
    Any idea why this is happening and is there any other method to be used instead of append.???
    Thanks in advance..
    regards,
    Viswanadh

    class OnApplyFormat implements ActionListener{
         public void actionPerformed(ActionEvent formatevent){
              JComboBox source = (JComboBox) formatevent.getSource();
                   String item =  source.getSelectedItem().toString();
                     System.out.println("Selected Format is:"+item);
                     try
                       if ( item!=null )
                              System.out.println("Format is:"+item);
                     infoarea.append("FMTL");
                   infoarea.append(item);
                     infoarea.append("\r\n");
                   infoarea.append("FMTU");
                   infoarea.append("\r\n");
                   infoarea.append("wait 5");
                   infoarea.append("\r\n");
              else
                   throw new Exception("FormatNotFoundException");
                          }catch(Exception e){
                          e.printStackTrace();
    }That is my code and still i am facing the same FMTL is not getting appended with the item variable.
    Help me in solving this issue.
    Thanks in advance.
    regards,
    Viswanadh

  • Will this work: String str = oldString?

    String bob = "bob";
    String billy = bob;
    bob = "bobby";Will billy = "bob" or will billy = "bobby"?
    I know 'C' has a str copy function...I cant find one in Java. Does Java do string differently?

    Will billy = "bob" or will billy = "bobby"?billy = "bob".
    Strings are Objects in Java, and the variables don't contain the data for the object, only a reference to it, and the reference is that only thing that changes in assignment.
    I know 'C' has a str copy function...I cant
    find one in Java.String copy = new String(oldString);
    Since String is immutable (its value can't change after creation, except when you perform "heavy wizardry") you wont find that very useful though. It does have its uses in a certain type of memory use optimizations though.
    Does Java do string differently?
    Very.

  • Quoted string in select

    When doing a select statement, is it possible to get sqlplus to automatically put quotes around data in varchar columns?

    Rick,
    Yes, this is possible. I'm guessing that you want to generate output that can be imported into another system or application? Regardless, this is how you'd do it.
    Lets say you have a table called EMP, with columns LAST_NAME VARCHAR2(40) and FIRST_NAME VARCHAR2(40), and you want your output to look like this:
    LAST_NAME FIRST_NAME
    'Smith' 'John'
    your SELECT statement should be:
    SELECT ''''||last_name||'''' last_name, ''''||first_name||'''' first_name FROM emp;
    Now if you're creating a comma-delimited file, and want your output to be:
    'Smith','John'
    your SELECT statement would be something like this:
    SELECT ''''||last_name||''','''||first_name||'''' FROM emp;
    Enjoy!
    Armand

  • String should select multiple tag's

    Dear All
    my issue is , This is a form tag enquiry form query whcih should retrieve multiple tag number's, but it is showing only one tag number for the below query.
    :tag_no      := x.tag_number; on this para meter is should select all the tag number's from the request number.
    :description := x.item_desc
    :current_location := x.move_location ;
    :last_location := x.tag_location ;
    :mcr_no      := x.request_number;
    :technical_data := x.technical_data;
    my concern is that it should select as many as tag's assosciated with the request number's
    :tag_no      := x.tag_number; it is showing only one tag, how should i change so that it display all the tag number's.
    regards
    arifuddin
    Edited by: user11309801 on Feb 12, 2011 11:37 AM
    Edited by: user11309801 on Feb 12, 2011 12:05 PM

    It is always helpful to provide the following:
    1. Oracle version (SELECT * FROM V$VERSION)
    2. Sample data in the form of CREATE / INSERT statements.
    3. Expected output
    4. Explanation of expected output (A.K.A. "business logic")
    5. Use \ tags for #2 and #3. See FAQ (Link on top right side) for details.
    Also see the third post in this thread:
    {thread:id=2174552}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Boolean.getBoolean(String str) always return false

    I'm on macOSX (Tiger), using JSDK 1.5.
    The function Boolean.getBoolean() return always false.
    I try Boolean.getBoolean("true");
    Boolean.getBoolean(Boolean.toString(Boolean.TRUE));
    always false.
    Is it a bug only on macOS, or does I do something wrong?
    so i just made mybooleanVar.equals("true"); done the right result, but it's just strange that the Boolean.getBoolean(...) function did not return the right value... And I can't send this bug to sun, because they don't assure support for macOSX platform... :s

    Yeah, some of the the least intuitive methods in the
    API are this one and its equivalents from the other
    basic type wrapper classes. Confusingly named methods
    in the wrong classes (they should have placed those
    methods in System, if anywhere at all).My vote goes to not anywhere at all.
    Boolean.getBoolean("property");is equivalent to
    Boolean.parseBoolean(System.getProperty("property"));Not worth a method for the saved keystrokes vs the problem in readability. Especially a misnamed method.

Maybe you are looking for

  • I cannot launch itunes.

    Can someone assist me, with an itunes issue.  I am using Windows XP on my PC and now all of a sudden during an upgrade, I got an error and now I cannot launch or locate it on my pc.   I've tried to reinstalling in manually and it will not work. Pleas

  • 6.2 MBP External drives video editing  - no express slot? ;(

    Hey all, is there no recourse for me, wanting to use the faster easta? I feel very sad about it... Or something. Will FW do fine for HD recording? I avoided the 17" because I have to be mobile.

  • OIM-AD connector Issues

    Hi, I am using a VMware image already configured with OIM-AD. But the AD connector is having some issues. When I test the ADITResource connectivity, the test is failed. It says the input parameters are correct. I have cross-checked may times...but al

  • Sales order number on the AR Invoice PLD

    I know I've seen a formatted search that enters the sales order number in a UDF so I can use it in the AR invoice PLD?  Could someone direct me in the right direction of give me the query to do this? Thanks, Jeff

  • Last run date & time & multiple files handling

    Hi frnds, i am working on an outbound interface in which i am retrieving data from custom db table,processing it with other db tables and writing  the final output into a file into the application server and updating the custom db table. Now i have a