Quick String Question

A co-worker had a query he was running with a where clause something like this...
Where
Name='BLAH & BLAHBLAH'
How do I pervent sql developer from treating the & symbole as a request for a variable prompt?
It's would prompt for variable named BLAHBLAH...
Thanks
Obe
ps. So far the Java SDK 6_10 is working...

In SQL*Plus you can "SET DEFINE OFF" prior to the SQL statement to get it to ignore the ampersand, but as far as I know (and I may be wrong), you can't do that in SQL Developer Worksheet.
What I normally do in this situation is break the string up and use "||" and "CHR". To use your example:
WHERE name = 'BLAH ' || CHR(38) || ' BLAHBLAH'
Ed. H.

Similar Messages

  • Quick string question finding if a string contains a character

    hello peeps
    is there a quick way of checking if a string contains a specific character
    e.g.
    myString="test:test";
    myString.contains(":");
    would be true
    any ideas on a quick way of doing it

    is there a contains() method in 1.4.2? i couldnt see
    it in the docsNo there isn't. But the 1.5 has a contains(CharSequence s) method.

  • Hi all .hope all is well ..A quick trim question

    Hi all
    Hope all is well ......
    I have a quick trim question I want to remove part of a string and I am finding it difficult to achieve what I need
    I set the this.setTitle(); with this
    String TitleName = "Epod Order For:    " + dlg.ShortFileName() +"    " + "Read Only";
        dlg.ShortFileName();
        this.setTitle(TitleName);
        setFieldsEditable(false);
    [/code]
    Now I what to use a jbutton to remove the read only part of the string. This is what I have so far
    [code]
      void EditjButton_actionPerformed(ActionEvent e) {
        String trim = this.getTitle();
          int stn;
          if ((stn = trim.lastIndexOf(' ')) != -2)
            trim = trim.substring(stn);
        this.setTitle(trim);
    [/code]
    Please can some one show me or tell me what I need to do. I am at a lose                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

    there's several solutions:
    // 1 :
    //you do it twice because there's a space between "read" and "only"
    int stn;
    if ((stn = trim.lastIndexOf(' ')) != -1){
        trim = trim.substring(0,stn);
    if ((stn = trim.lastIndexOf(' ')) != -1){
          trim = trim.substring(0,stn);
    //2 :
    //if the string to remove is always "Read Only":
    if ((stn = trim.toUpperCase().lastIndexOf("READ ONLY")) != -1){
       trim = trim.substring(0,stn);
    //3: use StringTokenizer:
    StringTokenizer st=new StringTokenizer(trim," ");
        String result="";
        int count=st.countTokens();
        for(int i=0;i<count-2;i++){
          result+=st.nextToken()+" ";
        trim=result.trim();//remove the last spaceyou may find other solutions too...
    perhaps solution 2 is better, because you can put it in a separate method and remove the string you want to...
    somthing like:
    public String removeEnd(String str, String toRemove){
      int n;
      String result=str;
      if ((n = str.toUpperCase().lastIndexOf(toRemove.toUpperCase())) != -1){
       result= str.substring(0,stn);
      return result;
    }i haven't tried this method , but it may work...

  • Quick script question

    Hi all,
    Could anyone advise me if i can add anything within - header('Location: http://www.mysite.co.uk/thankyou.html'); in the script below so as the page
    re- directs back to the main index page after a few seconds ?
    Thankyou for any help.
    <?php
    $to = '[email protected]';
    $subject = 'Feedback form results';
    // prepare the message body
    $message = '' . $_POST['Name'] . "\n";
    $message .= '' . $_POST['E-mail'] . "\n";
    $message .= '' . $_POST['Phone'] . "\n";
    $message .= '' . $_POST['Message'];
    // send the email
    mail($to, $subject, $message, null, '');
    header('Location: http://www.mysite.co.uk/thankyou.html');
    ?>

    andy7719 wrote:
    Mr powers gave me that script so im rather confused at this point in time
    I don't think I "gave" you that script. I might have corrected a problem with it, but I certainly didn't write the original script.
    What you're using is far from perfect, but to suggest it would lay you open to MySQL injection attacks is ludicrous. For you to be prone to MySQL injection, you would need to be entering the data into a MySQL database, not sending it by email.
    There is a malicious attack known as email header injection, which is a serious problem with many PHP email processing scripts. However, to be prone to email header injection, you would need to use the fourth argument of mail() to insert form data into the email headers. Since your fourth argument is null, that danger doesn't exist.
    One thing that might be worth doing is checking that the email address doesn't contain a lot of illegal characters, because that's a common feature of header injection attacks. This is how I would tidy up your script:
    <?php
    $suspect = '/Content-Type:|Bcc:|Cc:/i';
    // send the message only if the E-mail field looks clean
    if (preg_match($suspect, $_POST['E-mail'])) {
      header('Location: http://www.example.com/sorry.html');
      exit;
    } else {
      $to = '[email protected]';
      $subject = 'Feedback form results';
      // prepare the message body
      $message = 'Name: ' . $_POST['Name'] . "\n";
      $message .= 'E-mail: ' . $_POST['E-mail'] . "\n";
      $message .= 'Phone: ' . $_POST['Phone'] . "\n";
      $message .= 'Message: ' . $_POST['Message'];
      // send the email
      mail($to, $subject, $message);
      header('Location: http://www.example.com/thankyou.html');
      exit;
    ?>
    Create a new page called sorry.html, with a message along the lines of "Sorry, there was an error sending your message". Don't put anything about illegal attacks. Just be neutral.
    By the way, when posting questions here, don't use meaningless subject lines, such as "Quick script question". If you're posting here, it's almost certain to be a question about a script. It doesn't matter whether it's quick. Use the subject line to tell people what it's about.

  • Quick String / char  question

    Hi, i have to write a encrytion method for a assignment, it must take a string, move the characters on by a set number given by the user and return the result.
    public class Encryption
        int key;
        public Encryption(int k)
            key = k;
    public String encrypt(String si)
    si = si.toUpperCase();
    int i = 0;
    for (int index = 0; index< si.length(); index++);
    char c = si.charAt(i);
    int n = c - 'A' + key;
    char a = (char)(n + 'A');
    return si ;
    }it compiles, but what i need to know is how to i get my new chars (that have been moved the set amout) back into a string that is returned to the user, as i cant seem to find the code i need to do this???

    String result = "";
    Each time through the loop, you will want to add it to the result
    result = result + a;This is poor adviceimport java.io.*;
    public class Encryption{
       public static void main(String[] args) {
          new Encryption();
       Encryption(){
          String toEncyrpt = "The quick brown fox jumps over the lazy dog";
          int key = 0;
          try{
             BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
             System.out.print("Enter a number for the encryption key ");
             key = Integer.parseInt(br.readLine());
          }catch(IOException e){}
          String encrypted = encrypt(toEncyrpt, key);
          System.out.println("Encrypted string : "+ encrypted);
          String decrypted = decrypt(encrypted, key);
          System.out.println("Decrypted string : "+ decrypted);
        public String encrypt(String s, int k){
           StringBuffer sb = new StringBuffer();
           for(int i=0; i<s.length(); i++) {
               int temp = (int) s.charAt(i)+k;
               sb.append((char)temp);
           return sb.toString();
        public String decrypt(String s, int k){
           StringBuffer sb = new StringBuffer();
           for(int i=0; i<s.length(); i++) {
               int temp = (int) s.charAt(i)-k;
               sb.append((char)temp);
           return sb.toString();
    }

  • Quick easy String question for u pros

    How can I add a string to a string. Each time I try the output is blank...:(

    How can I add a string to a string. Each time I try the output is blank...:(There are a variety of ways. Don't make us guess at what you're trying to do.
    Please post a short, concise, executable example of what you're trying to do. This does not have to be the actual code you are using. Write a small example that demonstrates your intent, and only that. Wrap the code in a class and give it a main method that runs it - if we can just copy and paste the code into a text file, compile it and run it without any changes, then we can be sure that we haven't made incorrect assumptions about how you are using it.
    Post your code between [code] and [/code] tags as described in Formatting Help on the message entry page. Cut and paste the code, rather than re-typing it (re-typing often introduces subtle errors that make your problem difficult to troubleshoot). Please preview your post when posting code.
    Please assume that we only have the core API. We have no idea what SomeCustomClass is, and neither does our collective compiler.

  • Very Quick Newb Question - Converting Float to String

    I created a small program that converts currency for the iPhone. Unfortauntely, I cannot get the UILabel to display my float value. Apparently, NS can though. I found a tutorial that told me simply to use this:
    [label setFloatValue:currency];
    label is the UILabel
    currency is the float value
    When I do that with the iPhone SDK, I get this error:
    warning: 'UILabel' may not respond to '-setFloatValue:'
    messages without a matching method signature will be assumed to return 'id' and accept '...' as arguments.
    Any quick advice would be appreciated!
    Message was edited by: hollafortwodollas

    Simple requirements:
    label.text = [NSString stringWithFormat:@"%f", floatValue];
    More complex example:
    NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
    [formatter setFormatWidth:2];
    [formatter setPaddingCharacter:@"0"];
    [formatter setPaddingPosition:NSNumberFormatterPadBeforePrefix];
    lable.text = [NSString stringWithFormat:@"%@:%@:%@",
    [formatter stringFromNumber:[NSNumber numberWithInt:hours]],
    [formatter stringFromNumber:[NSNumber numberWithInt:minutes]],
    [formatter stringFromNumber:[NSNumber numberWithInt:seconds]]];

  • Quick string tokenizer question

    HELP!
    I'm quite new to using string tokenizers in Java.
    I'm trying to use a string tokenizer to read some data into a multi dimensional int array and then print it to the screen.
    What I'm using so far is:
    FileReader file = new FileReader("test.txt");
    BufferedReader inputFile = new BufferedReader(file);
    StringTokenizer data;
    for(int i=0; i<LEARN; i++)
         data = new StringTokenizer(inputFile.readLine());
         for (int j=0; j<NEURONS; j++)
                                 examples[i][j] = new int(data.nextToken().intValue);
    for(int row=0; row<LEARN; row++)
         for (int collumn=0; collumn<NEURONS; collumn++)
                             screen.print(examples[row][collumn] + " ");
                             screen.flush();
    }However, I'm getting errors!!
    Could anyone help at all??
    Cheers
    Ross

    However, I'm getting errors!!The messages that come with errors usually play a significant role in resolving them. Would you mind posting those messages?
    Where do you define the variable "examples" ?
    new int(data.nextToken().intValue);This is definitely wrong.

  • Quick naming question

    Wasnt sure if its a naming issue or not but Ive never ran into the problem and Im not sure how to describe it....so here goes.
    Question: Is there a way to insert a string into the name of a component name and have java see it as the actual component name. (see that question still sounds incorrect)
    What I mean is......
    you have 10 buttons named oneB, twoB, threeB,......tenB
    I need to either change a whole lot of code and make what I want to be simple, very large and complex or, find a way to....
    "one"B.setLocation(whereverNotImportant);
    or
    (someObject.getString( ) ) + B.setLocation(whereverNotImportant);
    It looks really odd to me. If theres a way to do it, it just saved me a lot of annoyance.....if not well, Im gonna need more energy drinks.

    Paul5000 wrote:
    Fair enough. I kept adding features onto the code and it grew into needing something different. Was just hoping there was a quick workaround so I didnt have to go back and recode half of it.When you've got Franken-code, the answer is to recode it.

  • Quick string problem - takes 2 seconds lol

    hey guys, quick question...
    i am working on an email client, and through trial and error found out i need to use a strange string class, so i was wondering how do i declare this string in my constructor
    Parameters
    public void postMail( String recipients[ ], String subject, String message , String from) throws MessagingExceptionConstructor Line
    test.postMail([email protected], "test", "test2", "[email protected]");my problem is in that first [email protected]

    My first thought is to think that this isn't a string
    test.postMail([email protected], "test", "test2", "[email protected]");your method innvocation need to be the same as the declaration
    test.postMail([email protected], "test", "test2", "[email protected]"); // this is not the same
    public void postMail( String recipients[ ], String subject, String message , String from) // as thisSee how your first value you pass to the method isn't a string. Hope that helps!
    test.postMail("[email protected]", "test", "test2", "[email protected]"); // this is
    public void postMail( String recipients[ ], String subject, String message , String from) Edited by: didittoday on Mar 8, 2008 8:12 PM

  • Urgent help with quick translation questions

    Hello,
    I am somewhat new to Java. I have a translation to hand in in a few hours (French to English). Argh! I have questions on how I worded some parts of the translation (and also if I understood it right). Could you, great developers, please take a look and see if what I wrote makes sense? I've put *** around the words I wasn't sure about. If it sounds strange or is just plain wrong, please let know. I also separated two terms with a slash, when I was in doubt of which one was the best.
    Many thanks in advance.
    1) Tips- Always ***derive*** the exceptions java.lang.Exception and java.lang.RuntimeException.
    Since these exceptions have an excessively broad meaning, ***the calling layers will not know how to
    distinguish the message sent from the other exceptions that may also be passed to them.***
    2) The use of the finally block does not require a catch block. Therefore, exceptions may be passed back to the
    calling layers, while effectively freeing resources ***attributed*** locally
    3) TIPS- Declare the order for SQL ***statements/elements*** in the constant declaration section (private static final).
    Although this recommendation slightly hinders reading, it can have a significant impact on performance. In fact, since
    the layers of access to data are ***low level access***, their optimization may be readily felt from the user’s
    perspective.
    4) Use “inlining.”
    Inlining is a technique used by the Java compiler. Whenever possible, during compilation, the compiler
    copies the body of a method in place of its call, rather than executing a ***memory jump to the method***.
    In the example below, the "inline" code will run twice as fast as the ***method call***
    5)tips - ***Reset the references to large objects such as arrays to null.***
    Null in Java represents a reference which has not been ***set/established.*** After using a variable with a
    large size, it must be ***reassigned a null value.*** This allows the garbage collector to quickly ***recycle the
    memory allocated*** for the variable
    6) TIPS Limit the indexed access to arrays.
    Access to an array element is costly in terms of performance because it is necessary to invoke a verification
    that ***the index was not exceeded.***
    7) tips- Avoid the use of the “Double-Checked Locking” mechanism.
    This code does not always work in a multi-threaded environment. The run-time behavior ***even depends on
    compilers.*** Thus, use the following ***singleton implementation:***
    8) Presumably, this implementation is less efficient than the previous one, since it seems to perform ***a prior
    initialization (as opposed to an initialization on demand)***. In fact, at runtime, the initialization block of a
    (static) class is called when the keyword MonSingleton appears, whether there is a call to getInstance() or
    not. However, since ***this is a singleton***, any occurrence of the keyword will be immediately followed by a
    call to getInstance(). ***Prior or on demand initializations*** are therefore equivalent.
    If, however, a more complex initialization must take place during the actual call to getInstance, ***a standard
    synchronization mechanism may be implemented, subsequently:***
    9) Use the min and max values defined in the java.lang package classes that encapsulate the
    primitive numeric types.
    To compare an attribute or variable of primitive type integer or real (byte, short, int, long, float or double) to
    ***an extreme value of this type***, use the predefined constants and not the values themselves.
    Vera

    1) Tips- Always ***derive*** the exceptions java.lang.Exception and java.lang.RuntimeException.***inherit from***
    ***the calling layers will not know how to
    distinguish the message sent from the other exceptions that may also be passed to them.***That's OK.
    while effectively freeing resources ***attributed*** locally***allocated*** locally.
    3) TIPS- Declare the order for SQL ***statements/elements*** in the constant declaration section (private static final).***statements***, but go back to the author. There is no such thing as a 'constant declaration section' in Java.
    Although this recommendation slightly hinders reading, it can have a significant impact on performance. In fact, since
    the layers of access to data are ***low level access***, their optimization may be readily felt from the user’s
    perspective.Again refer to the author. This isn't true. It will make hardly any difference to the performance. It is more important from a style perspective.
    4) Use “inlining.”
    Inlining is a technique used by the Java compiler. Whenever possible, during compilation, the compiler
    copies the body of a method in place of its call, rather than executing a ***memory jump to the method***.
    In the example below, the "inline" code will run twice as fast as the ***method call***Refer to the author. This entire paragraph is completely untrue. There is no such thing as 'inlining' in Java, or rather there is no way to obey the instruction given to 'use it'. The compiler will or won't inline of its own accord, nothing you can do about it.
    5)tips - ***Reset the references to large objects such as arrays to null.***Correct, but refer to the author. This is generally considered bad practice, not good.
    Null in Java represents a reference which has not been ***set/established.******Initialized***
    After using a variable with a
    large size, it must be ***reassigned a null value.*** This allows the garbage collector to quickly ***recycle the
    memory allocated*** for the variableAgain refer author. Correct scoping of variables is a much better solution than this.
    ***the index was not exceeded.******the index was not out of range***
    The run-time behavior ***even depends on compilers.***Probably a correct translation but the statement is incorrect. Refer to the author. It does not depend on the compiler. It depends on the version of the JVM specification that is being adhered to by the implementation.
    Thus, use the following ***singleton implementation:***Correct.
    it seems to perform ***a prior initialization (as opposed to an initialization on demand)***.I would change 'prior' to 'automatic pre-'.
    ***this is a singleton***That's OK.
    ***Prior or on demand initializations***Change 'prior' to 'automatic'.
    ***a standard
    synchronization mechanism may be implemented, subsequently:***I think this is nonsense. I would need to see the entire paragraph.
    ***an extreme value of this type******this type's minimum or maximum values***
    I would say your author is more in need of a technical reviewer than a translator at this stage. There are far too serious technical errors in this short sample for comfort. The text isn't publishable as is.

  • Two String questions

    Hi!
    I have two questions:
    1) Can I do toString() on a null value?
    2) Is there any difference in writing:
    String s = new String();
    and
    String s;

    isnt it true that in the first case s -object of
    String class is created??Yes, the empty string, length zero, as he said.
    >
    in second case just defining a variable type String??Yes. It will either be null or have an udefined value, depending on whether it's a member variable or a method variable.

  • Quick NativeWindow questions.

    Hi,
    Two Quick Questions about native window actions (I am using AIR with HTML and JS):
    1. How do you "refer" to minimize button ? - So, when a user clicks minimize, it should do an action defined in javascript.
    2. How to define click event for System tray icon ? - So I can display something when my system tray icon is double-clicked.
    Thanks.

    1. Add an event listener to the window.nativeWindow object, listening for the NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGING  or DISPLAY_STATE_CHANGE events.
    2. Add an event listener to your SystemTrayIcon object. You can listen for click, mouseUp or mouseDown events, but doubleClick events are not dispatched by this object.

  • Quick REGEXP_LIKE Question

    Hi everyone,
    Had a very quick question: so I need to retrieve all records that have values in this format "type:123;target_id:456". Note that the numeric value can be 1-6 digits long for either type or target_id.
    Can someone please help me with the regexp_like-ing this?
    Thank you,
    Edited by: vi2167 on May 27, 2009 2:06 PM
    Edited by: vi2167 on May 27, 2009 2:07 PM

    WHERE REGEXP_LIKE(val,'type:\d{1,6};target_id:\d{1,6}')SY.

  • Convert string question... "\"

    I try the below code on jsp, but result is : a , a\b
    but I want the result is : a\\b, a\\\\b
    Thanks !
    <%
         String str = "a\b, a\\b";
         String outStr = "";
         for (int i=0;i<str.length();i++){
              char c = str.charAt(i);
              if (c == '\\'){
                   outStr += "\\";
              else{
                   outStr += c;
    %>
    <%=outStr%>

    Right, because the compiler interprets "\\" as an escape character, indicating that you want a backslash. (If you tried to just use a String "\", you'd probably get a compilation error, since the compiler would think you were trying to escape the second quotation).
    I think you're going to need to use RegExp... this question has been asked a bunch before, so search through the forums for an answer.

Maybe you are looking for

  • Takes a long time to load library

    recently when I click on itunes to initiate....it takes a very long time to load library. Never used to do this. Any advice on how to correct this.

  • Lumia 925 swtiches off all of a sudden

    #NokiaIndia i hope at least you will hear my plea ,  in the month of december 2013 i got a Lumia 925 as a Birthday gift from my sisters. It worked fine , i loved each and every feature in that phone in fact it was an amazing change from my samsung S3

  • Problem using DG4ODBC with named SQL Server instance

    I am running DG4ODBC on a 64 bit LINUX machine with the Microsoft SQL Server driver installed. I have successfully tested this with a SQL Server instance that was not named (GENERALI_DSN).The named instance gives the following when trying to query: O

  • Two different areas on my fcp x project are having difficulty rendering

    It is taking hours to render two video portions of a 7 minute project I have done. It's only at 22% and it has already been 45 minutes. I have tried to see if the project would export (as media) and it always stops at this point in the video (about 5

  • Firefox after 30 seconds lands me at Mac OS X Server

    Logging into a Vessel Management Site (paid) it normally loads in 5sec, after last FF update it will not load after 30 seconds and takes me to Mac OS X Server.