Multi line strings - line continuation chars?

Hi all,
I'm not sure if this is a daft question or not...
I need to put a multiline select statement into a string variable.
ie I would like to put the sql below into a variable.
select bla bla bla bla bla
from bla
where bla
strvar := 'select bla bla bla bla bla
from bla
where bla';
Is there a standard line continuation character that I can put at the end of each line to enable me to put the single quote and the beginning of line 1 and the end of line 3? Or do I need to quote each line front and back and cat them together as separate strings?
rgds
John

Hi John,
See if this can help you
declare str varchar2(10000);
begin
str := 'select bla bla bla bla bla '||chr(10);
str := str||'from bla '||chr(10);
str := str||'where bla '||chr(10);
dbms_output.put_line(str);
end;
SQL> /
the output should be like below :
select bla bla bla bla bla
from bla
where bla
Anyway new line character is chr(10) for SQL.
Thanks
Kailash K Agarwalla,
Delhi, India.

Similar Messages

  • Multi-line String - Match Regular Expression

    I am trying to figure out the format of a regular expression in order to pull select lines out of a multi-line string and populate those lines as individual elements of a string array while using Match Regular Expression. The overall length of the multi-line string can vary as well as the text contained within the string. The string can contain letters, numbers, and special characters. I have attached an example VI. Within the example VI I only want to return the lines beginning with "Device #" into the array. The number of lines beginning with "Device #" can vary but I want to capture them all.
    Or is there a better function to use instead of Match Regular Expression that will give me the desired outcome?  
    Solved!
    Go to Solution.
    Attachments:
    MultiLine Regular Expression.vi ‏22 KB

    aaronb wrote:
    I am trying to figure out the format of a regular expression in order to pull select lines out of a multi-line string and populate those lines as individual elements of a string array while using Match Regular Expression. The overall length of the multi-line string can vary as well as the text contained within the string. The string can contain letters, numbers, and special characters. I have attached an example VI. Within the example VI I only want to return the lines beginning with "Device #" into the array. The number of lines beginning with "Device #" can vary but I want to capture them all.
    Or is there a better function to use instead of Match Regular Expression that will give me the desired outcome?  
    Match Regular Expression works well for this.
    Ben64

  • Multi-line string - Array?

    I was wondering if someone could tell me how to take a multi-line
    string and dump it into an array. I'm assuming that I use the 'Pick
    Line' function in a while loop? What do I check for to terminate the
    loop?
    Thanks...
    -- N

    "kevin" wrote in message news:...
    > In article <[email protected]>, "Natalia"
    > wrote:
    >
    > > I was wondering if someone could tell me how to take a multi-line string
    > > and dump it into an array. I'm assuming that I use the 'Pick Line'
    > > function in a while loop? What do I check for to terminate the loop?
    > >
    > > Thanks...
    > >
    > > -- N
    >
    > Natalia,
    >
    > Use the 'Spreadsheet String to Array' vi. Use the End of Line delimiter
    > (or carriage return, depends on OS). Add a %s to the format string and
    > POOF!, an instant text array. No loops required. Oh yeah, you also need
    > to add an array string constant to the array type so the output comes ou
    t
    > as a string type instead of the default double.
    >
    > You can do it with you present method if you need the loops for other
    > stuff. To terminate the loop just look for a -1 in the output of 'Pick
    > Line' when searching for you CR or EOL. You just have to remember to dump
    > the last value.
    >
    > good luck,
    > - Kevin
    Kevin -
    Thank you. That did the trick.
    -- Natalia

  • JTable -showing column headers and displaying multi-line strings

    Hi,
    This is two questions really.
    #1 - Does anyone know why my column headers aren't showing in my jtable using the model below?
    #2 - Does anyone know how I can display, mulitple line strings in a jtable? Currently my newline character ('\n') is just being displayed as a character.
    any help very much appreciated,
    Tom
    private class TaskHistoryTableModel extends AbstractTableModel {
    private List taskHistory = new ArrayList();
    public Object getValueAt(int row, int col) {
    if (col == 0) {
    return ((TaskHistoryItem) taskHistory.get(row)).getText();
    } else {
    return ((TaskHistoryItem) taskHistory.get(row)).getDate().getTime();
    public int getRowCount() {
    return taskHistory == null ? 0 : taskHistory.size();
    public int getColumnCount() {
    return 2;
    /** Getter for property taskHistory.
    * @return Value of property taskHistory.
    public List getTaskHistory() {
    return taskHistory;
    /** Setter for property taskHistory.
    * @param taskHistory New value of property taskHistory.
    public void setTaskHistory(List taskHistory) {
    this.taskHistory = taskHistory;
    public String getColumnName (int col) {
    return col == 0 ? "Text" : "Entered At";
    public boolean isCellEditable(int row, int col) {
    return false;
    }

    fixed my own problem - make your mulit-line string into html format e.g.
    this string will appear on two lines in a jtable
    "<html><p>A much more interesting entry</p> <p>on multiple lines</p></html>"

  • Text file: reading char one at a time line by line

    I need to read an external .txt file, one character at a time, line by line, and compare each character in order to do various things. The problem is that when I use the Buffered Reader I have only readLine() method and others to work with, but none that actually read a character at a time, and line by line. The program has to read a character, then move to the next one and read it, and so on. Then move to the next line, and read the first character, and so on. I am working with chars not Strings. Could you please help me with this problem?

    InputStreamReader can read a single char.
    InputStreamReader isr = new InputStreamReader(InputStream in);
    isr.read(); will return 1 character from "in".

  • Scanning... and Mulitple String lines

    My text file that I want to scan looks like this format:
    Name of Student
    Test Answers (True or false)
    Example:
    Joe Smith
    TFTFTFFTFFFTFFTFFTFTTFF etc..
    Jane Sims
    FTFTFTTFFTTFFTFFFTFTFTF etc..
    The issue is - I know how to scan the data of my textfile. However I am dealing with Strings on two lines.
    I want to compute the True and False answers, by tallying them up.
    But my real question is this.
    How can I seperate the detection of the line with the name, and the line with the True & false answers.
    import java.util.*;
    import java.io.*;
    public class TureFalseTest {
         public static void main(String[]args) throws FileNotFoundException {
         System.out.println("This program computes the results of students from the test");
         Scanner input = new Scanner(new File("answers.txt"));
         while(input.hasNextLine()){
              String questionResults = input.nextLine();
              // this is the part that is getting me troubled. 
         public static int[] computeAnswers (String questionResults) {
              int[] questions = new int[70]
                    // going to continue on with my arrays and what not.Below is what I got, I know that input.nextLine(); will start scanning each line in the text document, line-by-line.
    I want to run my array/caclulations only on the True & False answers of every student.
    But i'm not understanding
    If someone could give me some pointers or tips, that will be greatly appreciated.

    accident 2nd post.
    Edited by: theendgame on Nov 18, 2008 6:29 PM

  • How can I re-organize String lines

    Hello My String consists of random lines. Every line has an priority number. Example of a String:
    Done     id     pri     created          finished     description     
         000     1     2006-12-11     -          job     
    x     001     2     2006-12-11     -     do this     
         002     3     2006-12-11     -          work
    x     003     0     2006-12-11     -          some
         004     2     2006-12-11     -          thing
         005     1     2006-12-11     -          reads
         006     0     2006-12-11     -          here
    Every "token" is seperated by \t (done \t id \t ....\t 000 \t 1 \t 2006-12-12 \t...)
    How can I organize the String and save it to another String so that pri-values are in a descending order:
    Done     id     pri     created          finished     description     
    002     3     2006-12-11     -          work
    x     001     2     2006-12-11     -     do this     
    004     2     2006-12-11     -          thing
    000     1     2006-12-11     -          job     
    005     1     2006-12-11     -          reads
    x     003     0     2006-12-11     -          some
         006     0     2006-12-11     -          here

    I'm trying but I don't know what I'm doing
    import java.io.*;                
    import java.util.*;                    
    import java.util.ArrayList;
    import java.util.Collections;
    import java.util.List;
    import java.util.Comparator;
    public class Start {
    public static void main(String[] args) throws IOException {
    sort();
    public static void sort() throws IOException  {
         class Work implements Comparable {
         String id;
         int pri;
         String d1;
         String d2;
         String job;
         public Work(String id, int pri, String d1, String d2, String job){
              this.id = id;
              this.pri = pri;
              this.d1 = d1;
              this.d2 = d2;
              this.job = job;
         BufferedReader reader = new BufferedReader(new FileReader("Tehtava.txt"));
         //BufferedWriter writer = new BufferedWriter(new FileWriter("Tempo.txt"));
         String lookingFor3 = "-";
         String line = null;
         while ((line = reader.readLine()) != null) {     //---------------z
                   String[]result = line.split("\t");
                   List tasks = new ArrayList();
                   if (result[4].equals(lookingFor) == true) {     
                   tasks.add(new Work(line));     
                   continue;
                   public int getpri()     {
                   return pri;          }
                   public int compareTo(Object o)     {
                   Work otherWork = (Work) o;
                   return this.getpri().compareTo(otherWork.getpri());     }
              Collections.sort(tasks); //-------------------x
              System.out.print(tasks); //------------------x
              //reader.close();
    }I don't know what but Where and I'm getting errors like:
    <identifier> expected
    for lines ------------x
    illegal start of type:
    for line -------------z

  • My test instrument is outputting a 5 line string but labview only read until the carriage return. how can I get it to read the whole string?

    I have a labview sub-VI reading the string being outputted by a pH meter.  The meter outputs a 5 line string and labview is only reading up to each lines carriage return, there-by giving me 5 separate strings is there anyway to rectify this and have the 5 line read as one string?
    NAS1
    St Petersburg FL
    Labview 2010

    Yes, LabVIEW will automatically update. What happens is that the old serial functions still exist in 7.1 and above but the code (the block diagram) has been modified to use VISA functions. Older versions of LabVIEW are fully supported in this manner. The only way you can avoid the automatic update is to have the old serial functions in an llb and your top level VI refer to these. Having any VI that was part of vi.lib in an llb is a very bad idea and the way to fix things is to remove any VIs in the llb that are part of the LabVIEW distribution.
    I don't remember how the old serial config worked and what the new version does with the VISA Configure Serial Port. Your program should only have a single serial config and you might just be able to directly replace that with the VISA configure Serial Port.

  • How to display two-lines strings item

    Hi,
    How can I display list of two-line string items? Each Item in the list should have a phone number and a time. It should look similar to the "dialled numbers" display where each item has an image, and two-line string.
    Is it possible doing it with the high-level API or should I go low-level?
    Thanks in advance
    Imzadi

    use: list.setFitPolicy(Choice.TEXT_WRAP_ON)

  • Error message in configurin​g profession​nal email account (Invalid\e​scape: line 1 column 271 (char 271).)

    Hi,
    I have an issue I am not able to solve.
    When configuring a pro email in the advanced menu, I have the below error message :
    Invalid\escape: line 1 column 271 (char 271).
    I have checked the email information (server adress, password and so on), everything is fine...
    Cannot find the meaning of the message error.
    Thanks a lot for your help.
    Regards

    Hi..
    For Work Account ::
    User ID : Email Adress ( [email protected])
    Activation Password : Provided from the IT Admin
    Server Adress : provided by It Admin ( S3459908)
    For Microsoft Exchange ActiveSync
    Description :  Your Desired Name (eg.  Your Company name)
    Domain : Your Organizatin Domain name
    Username: Credentials of your Account
    Email Address: Your Email Address
    Password: Password for the Email
    Server Adress: Provided by the IT Admin
    Port: Provided by the IT admin
    Use SSL : ON/OFF as per your IT Admin..
    Please feedback me in this regard...
    Thanks.. 
    Please update the result after applied..
    Thanks

  • How to do the multiple-line String at JList?

    hey everyone,
    i want to create a JList have to display multiple-line string.
    i have use String a="text1"+"\n"+"text2" inside my JList...
    the "\n" change to a sequare box...
    how cum like that.................??
    i need ur kindly helping...

    Because the default renderer for a JList element is a
    JLabel, and that is how JLabel behaves. The question
    "how to do a multiple-line JLabel" has been asked
    hundreds of times in this forum, search for that.i have search for it already but i no get it..anything!
    so, can u give me the url for me? thank you!

  • How to do the multiple-line String at JList? help!

    i need some code to multiple-line String at JList.
    i know that it is can be done by html code.
    example:
    <p>line1</p><p>line2</p>
    but if i use that html code...
    i face another problem to my JList..
    it cannot set the font use the ListCellRenderer..
    like:
    public Component getListCellRendererComponent(
    JList list,
    Object value,
    int index,
    boolean isSelected,
    boolean cellHasFocus)
    Color newColor = new Color(230, 230, 230);
    setIcon(((DisplayItem)value).getIcon());
    setText(((DisplayItem)value).getChat());
    setFont(((DisplayItem)value).getFont());
    setBackground(isSelected ? newColor : Color.white);
    setForeground(isSelected ? Color.black : Color.black);
    if (isSelected) {
    setBorder(
    BorderFactory.createLineBorder(
    Color.red, 2));
    } else {
    setBorder(
    BorderFactory.createLineBorder(
    list.getBackground(), 2));
    return this;
    all my JList will be html type...
    i don't want that happen..can be another method to do that multiple-line String in JList??
    i also need to set a icon image between string in the JList. anyone get idea??
    i need ur help!
    thank you.

    I think you should create/override several methods like setText(String), setIcons(Icon[]), paintComponent(Graphics), getMinimumSize(), getPreferredSize(), etc.
    I would like to code like below...:class MultilineLabel extends JLabel {
        private String[] text = null;
        private ImageIcon[] icons = null;
        public void setText( String newText ) {
            // It overrides JLabel.setText( String )
            // Tokenize newText with line-separator
            // and put each text into the 'text' array.
        public void setIcons( Icon[] newIcon ) {
            // It is similar to JLabel.setIcon( Icon ) method,
            // but it receives an array of Icon-s. Set these icons to 'icons' variable.
        public void paintComponent( Graphics g ) {
            // It overrides JComponent.paintComponent( Graphics ) method.
            super.paintComponent( g );
            if ( text != null && icons != null ) {
                int icon_x = 0;
                int text_x = 0;
                int y = 0;
                // draw customized content..
                for ( int i=0; i<text.length; i++ ) {
                    // compute x and y locations
                    // icon_x = ...
                    // text_x = ...
                    // y = ...
                    // and draw it!
                    g.drawString( text[ i ], text_x, y );
                    icon[ i ].paintIcon( this, g, icon_x, y );
        public Dimension getMinimumSize() {
            int width = super.getMinimumSize().width;
            int height = ... // I think you must compute it with 'text' and 'icons'' arrays.
            return new Dimension( width, height );
        public Dimension getPreferredSize() {
            int width = super.getPreferredSize().width;
            int height = ...
            return new Dimension( width, height );
    }I think that code-structure above is the minimum to implement your requirements. (Of course if you want to implement it :)
    Good luck and let me know it works or not. :)

  • Track a Line String with a Trigger

    Hi,
    (sorry for my bad english)
    I need to know if i can track a Line String with a trigger. For example, in my case, i've to colums called "COORDINATEPARTENZA" and "COORDINATEARRIVO". From contains a CONTROID() coordinates, anche TO contains CENTROID() coordinates. Now, can i track a line in a colums "LINE" with a trigger? All in automatic?
    There is a method to take the coordinates from "COORDINATEPARTENZA" and "COORDINATEARRIVO" and track an automatic stringline with a trigger?
    This is the code:
    This is the Trigger:
    CREATE OR REPLACE TRIGGER "TRIGGERPERCORSO"
    BEFORE INSERT OR UPDATE OF luo_nomeluogo ON "SPOSTAMENTI"
    FOR EACH ROW
    DECLARE
    partenza VISUALPERCORSO.coordinatepartenza%TYPE;
    arrivo VISUALPERCORSO.coordinatearrivo%TYPE;
    vecchioluogo LUOGHI.nomeluogo%TYPE;
    nuovocodicespostamento SPOSTAMENTI.codicespostamento%TYPE;
    presenza NUMERIC;
    BEGIN
    SELECT COUNT(*) INTO presenza
    FROM spostamenti
    WHERE ope_codiceopera = :new.ope_codiceopera;
    IF (presenza >= 1) then
    SELECT luo_nomeluogo INTO vecchioluogo
    FROM (SELECT * FROM spostamenti
    WHERE ope_codiceopera = :new.ope_codiceopera
    ORDER BY codicespostamento DESC)
    WHERE ROWNUM <2;
    SELECT SDO_GEOM.SDO_CENTROID (c.COLLOCAZIONE, m.diminfo) INTO partenza
    FROM LUOGHI c, user_sdo_geom_metadata m
    WHERE m.table_name = 'LUOGHI' AND m.column_name = 'COLLOCAZIONE' AND c.nomeluogo = vecchioluogo;
    SELECT SDO_GEOM.SDO_CENTROID (d.COLLOCAZIONE, n.diminfo) INTO arrivo
    FROM LUOGHI d, user_sdo_geom_metadata n
    WHERE n.table_name = 'LUOGHI' AND n.column_name = 'COLLOCAZIONE' AND d.nomeluogo = :new.luo_nomeluogo;
    INSERT INTO VISUALPERCORSO(LUOGOPARTENZA, OPE_CODICEOPERA, COORDINATEPARTENZA, LUOGOARRIVO, COORDINATEARRIVO) VALUES (vecchioluogo, :new.ope_codiceopera, partenza, :new.luo_nomeluogo, arrivo);
    END IF;
    END;
    So, now i need to track a line (with oracle spatial) from "COORDINATEPARTENZA" to "COORDINATE ARRIVO". With another trigger.
    Thanks a lot (sorry for my bad english).

    "COORDINATEPARTENZA" and "COORDINATEARRIVO" are points, correct?
    If I understand, you need to create a line from initial point (PARTENZA) to final point (ARRIVO) in a trigger.
    Yes, you can do it.
    Anyway, you can write to me in italian (miguel dot fornari at gmail).

  • Error  SDO_WITHIN_DISTANCE of a line string

    I am writing a number of queries for a prototype application. All of my queries are working except for when I try to find POINTS which are a certain distance from a line string.
    select
    poi.*
    from
    point_of_interest poi
    where
    SDO_WITHIN_DISTANCE(poi.location,
    SDO_GEOMETRY(2003,8307,null,
    SDO_ELEM_INFO_ARRAY(1,2,1),
    SDO_ORDINATE_ARRAY(45.0264,32.0082,44.998,32.0027,44.9858,32.0008,44.9797,32.0001)),'distance=5 unit=KM') = 'TRUE';
    The error I receive is
    ERROR at line 1:
    ORA-29902: error in executing ODCIIndexStart() routine
    ORA-13032: Invalid NULL SDO_GEOMETRY object
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD_10I", line 333
    The location fields in my table are points defined by
    SDO_GEOMETRY(2001,8307,SDO_POINT_TYPE(<longitude>,<latitude>,null),null,null)
    I can create a valid SDO_GEOMETRY on the line string. I only receive this error when I try to compare the points and line string with the SDO_WITHIN_DISTANCE.

    Oops, I finally see what I did wrong. My SDO_GTYPE was wrong 2003 should have been 2002.

  • How to display values and new char line (blank line)

    Hi,
    In database, one field contains values followed by new character lines (blank lines) after blank lines there is no values. Finally, I would say the field contains values and blank lines. Every thing is fine in database.
    In Crystal Reports the field is displaying only values. Need to display values and blank line.
    User is asking after values new character lines (blank line) to be shown. They enter like that in an application. The user doubt is why report is not showing what they enter in the application.
    In detail explanation, front end tool is ASP.NET and backend is SQL Server.
    User enter some values in note field, after that they hit enter button in the same field, cursor will go next line...user may hit u2018enter buttonu2019 more than 5 times. So note field contain values and some blank lines which are created by after hitting enter button.
    If user opens the application, they could see values plus blank lines in the note field.
    They are fine with the application.
    In Crystal Reports, the note field shows only values.
    User is questioning that why we could not see in report we enter.
    I checked in .Net application and SQL server database it is fine. It is displaying values and blank line.
    Please help me out how to display values followed by blank lines in Crystal Reports - the way they enter in the application.
    Thanks and Regards,
    Manjunath N. Jogin

    Hi,
    Sharonmat,
    I tried as you suggested. It is still displaying only values.
    I would like to explain again.
    it is not exactly null values.
    In .Net application it is called 'new char line'.
    it shows those many lines look like null.
    it is working fine in database.
    Why it is not working in Crystal Reports? I am wondering...
    Thanks for your suggestion.
    Debi,
    User may enter any number of blank lines or they may not enter blank lines.
    That is the reason I can not always give more height or blank text object.
    Thanks for your suggestion.
    Please suggest me some more suggestions,
    Thanks and Regards,
    Manjunath N. Jogin

Maybe you are looking for