Check newline character in data
Hi,
How to check for a new line character in data using SQL query ?
Thx
select * from test where cc like '%' || chr(13) || chr(10) || '%'
remember that unix does not use carriage return, so this may be more complete:
select * from test where cc like '%' || chr(10) || '%'
bye
aldo
Similar Messages
-
How to check the newline character
Hi,
I want to check a character whether it is '\n'. I tried with the code,
<code>
char nl='\n';
if(nl=='\n')
System.out.println("its a newline");
</code>
But, the above condition is not checked. How to modify the condition?Thanks in advance.
bhuvana.Remember newline characters differ on different platforms. For example under DOS its \r\n and under UNIX its \n. Thankfully you can retrieve this information using System.getProperty("line.separator");.
Here is some code
public class nl
public static void main(String args[])
String newLine = System.getProperty("line.separator");
String dos = "\r\n";
String unix = "\n";
if(newLine.equals(dos))
System.out.println("dos newline");
else if(newLine.equals(unix))
System.out.println("unix newline");
else
System.out.println("not a newline");
}I hope this helps! -
Loading data having newline Character
Hello Everyone,
I am trying to load a .csv file to a single table using SQL Loader.
Sql*loader 11.2.0.1.0
Operating system: Windows 7
My control file is as follows
LOAD DATA
INFILE 'C:\Test.csv'
Into table TEST
Fields terminated by "," optionally enclosed by '"'
TRAILING NULLCOLS
name ,
group,
description
Test.csv File is as follows
Sam, Developer, "This is test data,This is Test data. Tis is test data this is test data,Tis is test data
Test1Test2
Test1 Test2
", Anna, PM,"This is testdata
This is test data@Test
this is test data
newline character Test
"newline character Test:Test Data Test data""
My log file gives me an error
Record : Rejected - Error on table TEST, column DESCRIPTION.
Initial enclosure character not found
Record : Rejected - Error on table TEST, column DESCRIPTION.
second enclosure string not present
Help Please!Looks like you have syntax errors :
Cause: A mandatory initial enclosure delimiter was not present. Either it is missing on the current field or the previous field is missing an identical closing delimiter.
Action: Supply the missing delimiters.
Cause: The logical end of record or the end of a LOBFILE was reached before a second enclosure delimiter was found.
Action: Correct the datafile to include the missing delimiter.
Regards -
How to remove the newline character at the start in the attachment ?
Hi All,
I have been trying to attach a .dat file generated at an external source and send it as an attachment by mail using UTL_SMTP, all things are working but the .dat file which comes attached in mail contains a newline character i.e. chr(10) at the start line and the contents of the file are written from second line onwards. Below is some part of the code which deals with read/write of attachment of mail to be sent.
Can anyone help me on this, is something to be changed in this code??
UTL_SMTP.write_data(c,
'Subject' || ': ' || P_SUBJECT || UTL_TCP.crlf);
UTL_SMTP.write_data(c,
'MIME-Version: 1.0' || UTL_TCP.crlf || -- Use MIME mail standard
'Content-Type: multipart/mixed;' || UTL_TCP.crlf ||
' boundary="-----SECBOUND"' || UTL_TCP.crlf ||
UTL_TCP.crlf);
UTL_SMTP.write_data(c,
'-------SECBOUND' || UTL_TCP.crlf ||
'Content-Type: text/plain;' || UTL_TCP.crlf ||
'Content-Transfer_Encoding: 7bit' || UTL_TCP.crlf ||
UTL_TCP.crlf);
UTL_SMTP.write_data(c, UTL_TCP.crlf || l_text);
UTL_SMTP.write_data(c, UTL_TCP.crlf);
UTL_SMTP.write_data(c, UTL_TCP.crlf);
UTL_SMTP.write_data(c,
'-------SECBOUND' || UTL_TCP.crlf ||
'Content-Type: text/plain;' || UTL_TCP.crlf ||
' name="/inetpub/wwwroot/Novation_Merge/FS_Extract.dat"' ||
UTL_TCP.crlf ||
'Content-Transfer_Encoding: 8bit' || UTL_TCP.crlf ||
'Content-Disposition: attachment;' ||UTL_TCP.crlf || ' filename="' || p_description ||
TO_CHAR(SYSDATE, 'DD-MON-YYYY') || '.dat"' ||
UTL_TCP.crlf || UTL_TCP.crlf ||UTL_TCP.crlf);
BEGIN
l_filehandle := UTL_FILE.fopen('c:\temp',
'FS_Extract.dat',
'r',
32767);
LOOP
UTL_FILE.GET_LINE(l_filehandle, l_buffer, 32767);
UTL_SMTP.write_data(c, l_buffer || UTL_TCP.crlf);
END LOOP;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
UTL_FILE.fclose(l_filehandle);
UTL_SMTP.write_data(c, '-------SECBOUND--');
UTL_SMTP.close_data(c);
UTL_SMTP.quit(c);
EXCEPTION
WHEN UTL_SMTP.transient_error OR UTL_SMTP.permanent_error THEN
BEGIN
UTL_SMTP.quit(c);
EXCEPTION
WHEN UTL_SMTP.transient_error OR UTL_SMTP.permanent_error THEN
NULL;
-- When the SMTP server is down or unavailable, we don't have
-- a connection to the server. The quit call will raise an
-- exception that we can ignore.
END;
RAISE_APPLICATION_ERROR(-20000,
'Failed to send mail due to the following error: ' ||
SQLERRM);
END;
Thanks,
-AmolAs I recall, a single blank line serves as separator between Mime Header and Mime Body.
This code..
UTL_SMTP.write_data(c,
'-------SECBOUND' || UTL_TCP.crlf ||
'Content-Type: text/plain;' || UTL_TCP.crlf ||
' name="/inetpub/wwwroot/Novation_Merge/FS_Extract.dat"' ||
UTL_TCP.crlf ||
'Content-Transfer_Encoding: 8bit' || UTL_TCP.crlf ||
'Content-Disposition: attachment;' ||UTL_TCP.crlf || ' filename="' || p_description ||
TO_CHAR(SYSDATE, 'DD-MON-YYYY') || '.dat"' ||
UTL_TCP.crlf || UTL_TCP.crlf ||UTL_TCP.crlf); ..generates 2 blank lines after the Mime Header.
Remove the last CRLF and see if that does the trick. -
Hi,
How can i introduce a newline character while displaying a string using string functions in a report..
My requirement is, i need to replace a particular character with a newline character in a string using replace function
Can anyone help me
Thanks in advance..Hi,
Try this,
REPLACE(Table.ColumnName, 'StringOrCharacterToReplace', '[br]')
*replace [ and ] with < and > in br tag. Change the data format of the column to HTML
Rgds,
Dpka -
How to remove a newline character from a column
hi all...
i have a column in a table in which some of the datas contain a newline character at their last.
i need to remove those newline characters.
for example.... a data is
'abcd
(notice the end of the quotation).....i need to get the data as...'abcd'
plss help me...
thanks in advance..thanks for ur reply...
i got your point..but here what you have done is....u have inserted a particular character set in between 'abcd' and 'xyz' and afetr that just replaced those character set by null....
but in my case the problem is a bit different...
the datas are already present and what i have to do is to remove the newline spaces from the end of the datas.
select replace(column_name,'<what shall i put here>',null) from table_name;
in your example...that is 'chr(10)'...but in my case its a newline character.... -
NewLine Character in the String received from Interactive Adobe Form
Hello Experts,
Following is the issue we have with interactive Adobe Form
We have a text area within the form. User enters the text in multiple lines in this text area.
We are calling a backend function module designed in SE37 that accepts and process the data from the adobe form. We are also processing the string data user enters in the text area.
When we receive the string from the form, the newline character within the string is displayed as '#' in the debugger. We tried splitting this string using cl_abap_char_utilities=>newline and cl_abap_char_utilities=>cr_lf but NO luck. Though in the debugger we see cl_abap_char_utilities=>newline as '#' in the debugger and also '#' is present within the string, for some reason when string is processed to find cl_abap_char_utilities=>newline, we can find/locate it.
Because ABAP code is not able to identify the newline character within the string received from Adobe form, we are not able to maintain the formatting of the string as it was entered in the form.
Any help to resolve this issue is appreciated.
Thanks in Advance.
Regards,
BhushanHi Bhushan,
I was going through your issue, and I feel this is something you can do with scripting. Basically you should read whole string and find the new line character and replace with a space or comma, as per your requirment.
Do like following:
In the exit event of the field select java script and write following code:
var strng = this.rawValue;
strng.replace(/\n/g, " ");
above im reaplcing new line with a space.
I think it should work I have not tested it. Pls update if you test it .
Regards,
Ravi.D -
Getting the newLine character when deleting a line...
I have a JTextArea that has a custom DocumentListener added. What I want is to be notified when the user hits enter for a new line and be notified when the user removes a line. Getting the newLine when the user hits enter is easy enough, however the reverse is not true. Whenever backspace is pressed it gets the same removeLine character, which is not what I want, because a backspace is not a removeLine( or newLine) character. Here is my code so far...
public void insertUpdate(DocumentEvent e){
Document d = e.getDocument();
try {
String s = d.getText(e.getOffset(), e.getLength());
System.out.println("got a line");
} catch (BadLocationException e2) {
e2.printStackTrace();
public void removeUpdate(DocumentEvent e){
Document d = e.getDocument();
try {
String s = d.getText(e.getOffset(), e.getLength());
if(s.equals("\n"))
System.out.println("removed a line");
} catch (BadLocationException e2) {
e2.printStackTrace();
};It's in the removeUpdate that my code is flawed. Can anyone stear me in the right direction?What for?By definition when you have a problem, you don't know what the problem or solution is. So you post a SSCCE showing what you've attempted so far so that we can see the problem you are describing.
Since you also don't know how to ask a very clear question. The SSCCE help in describing the problem. Maybe it won't help in this case, but you don't know that before hand. So you get in the habbit of always posting a SSCCE.
You talk about removing a line, but I don't know what that means. What happens if you data in a text area like:
123
456
789
To me removing a line means removing "123\n" to that the entire line is removed from the file. Or what happens if you select 3 and 7 with the mouse and then use the "Delete" key? Did you remove 1 line or 2 lines. Are you trying to count the number of "\n" characters that have been removed. Or do you only care about the backspace key because that was a concious decision or did you just not think about all the other possibilities of how text can be removed from a Document?
So as you can see you question is not a simple and straight forward as you thought. Without a SSCCE to clarify exactly what you are doing we can only provide half an answer.
You can find the answer by reading the Swing tutorial. Maybe the section on Key Bindings, if you just want to know when a certain key was pressed. Or maybe the section on a DocumentFilter if you want to know what text has actually been added or removed from the Document (before it happens). -
TCP Callback on Newline Character
I have a TCP connection to a device that sends its short message (< 100 characters) in chunks. Unfortunately these chunks seem to be random. I am having some difficulty tokenizing the data and getting it into five floats. Is there any way I can make this TCP callback fire only when a newline character is received, or a better method of putting the message together? I'm going to be dealing with much larger TCP messages for other devices, so it will be good to get this issue resolved on a small scale problem.
For whatever reason, my logic is allowing incomplete messages to be tokenized. The message leads with BARO and ends with \r\n.
receiveBuf[dataSize] = '\0';
if (strstr(receiveBuf,"\n") == NULL)
strcpy(Vaisala.Message, receiveBuf);
else
if ((strlen(Vaisala.Message) + strlen(receiveBuf) < 100) || (strstr(receiveBuf,"BARO") == NULL))
strcat(Vaisala.Message, receiveBuf);
Vaisala.Message[strlen(Vaisala.Message) - 2] = '\0';
token = strtok(Vaisala.Message, "\t");
token = strtok(NULL, "\t");
Vaisala.Barometric = atof(token);
token = strtok(NULL, "\t");
token = strtok(NULL, "\t");
Vaisala.DryBulb = atof(token);
token = strtok(NULL, "\t");
token = strtok(NULL, "\t");
Vaisala.WetBulb = atof(token);
token = strtok(NULL, "\t");
token = strtok(NULL, "\t");
Vaisala.Dewpoint = atof(token);
token = strtok(NULL, "\t");
token = strtok(NULL, "\t");
Vaisala.RH = atof(token);
else
memset(Vaisala.Message, '\0', 100);
Michael Chadwell
Department of Engine and Vehicle R&D
Southwest Research InstituteI found a workaround that I don't like.
1. If the message starts with B, start a new string.
2. If the message does not have \n, concatenate the message.
3. If the message has a \n, parse the data.
Seems to work well but I won't always have such fixed strings so I'd like a callback that fires when the \n is received.
case TCP_DATAREADY:
if ((dataSize = ClientTCPRead (VaisalaTCPConnectionHandle, receiveBuf, dataSize, 1000)) < 0)
// Error
else
receiveBuf[dataSize] = '\0';
if ((strstr(receiveBuf,"\n") == NULL) && (receiveBuf[0] == 'B'))
strcpy(Vaisala.Message, receiveBuf);
else if (strstr(receiveBuf,"\n") == NULL)
strcat(Vaisala.Message, receiveBuf);
else
if ((strlen(Vaisala.Message) + strlen(receiveBuf) < 100) || (strstr(receiveBuf,"BARO") == NULL))
strcat(Vaisala.Message, receiveBuf);
Vaisala.Message[strlen(Vaisala.Message) - 2] = '\0';
token = strtok(Vaisala.Message, "\t");
token = strtok(NULL, "\t");
Vaisala.Barometric = atof(token);
token = strtok(NULL, "\t");
token = strtok(NULL, "\t");
Vaisala.RH = atof(token);
token = strtok(NULL, "\t");
token = strtok(NULL, "\t");
Vaisala.Dewpoint = atof(token);
token = strtok(NULL, "\t");
token = strtok(NULL, "\t");
Vaisala.DryBulb = atof(token);
token = strtok(NULL, "\t");
token = strtok(NULL, "\t");
Vaisala.WetBulb = atof(token);
else
memset(Vaisala.Message, '\0', 100);
// Process data here
break;
Michael Chadwell
Department of Engine and Vehicle R&D
Southwest Research Institute
Attachments:
Serial.jpg 105 KB -
Lyrics on ipod touch: newline character?
Is there a newline character for lyrics to allow me to separate stanzas when displayed on ipod touch?
Right now all the lines (and thus stanzas) are running together.Step by step:
In iTunes, have you added the lyrics to each individual song and in the lyrics tab of the song?
If you use Sync to manage your iPod, have you then Synced your iPod after adding the lyrics?
If you manually mange the iPod, you need to remove the album from the iPod and then add it back again (with the lyrics)
If you still have no luck, then if you use Sync, try typing anything into the lyrics field of any song. Then after a Sync with the iPod, check that song. When you can see the scrubber bar (with the time), you should be able to see the text you typed.
If you manually manage the iPod, remove one song from the iPod, add some text to that song and then add it back onto the iPod and play it. Can you see the lyrics now?
If none of that works, perhaps the iPod need a Reset or a Restore. -
While importing a request error message' Check-sum error in data file'
Hi Friends
I have a problem.
We are trying to inport a request after putting the files in cofile and data file folders( 4.6C System).While doing so an error message is seen in the log " Check-sum error in data file after XXXX bytes".
Can some one help me with this?
Thanks
Regards
AnkurHi Ankur,
It is sure your file is corrupted or not present.
Check in cofiles and data directory under /usr/sap/trans your transport request number.
Best Wishes.
Kumar -
How to check if a physical data channel has data on it
I am aquiring data continuously and am trying to check if there is data on the physical line, if there is digital data I want it to be passed to the next stage, if there is not I want the data diguarded. Is there a way of checking this digital line for inactivity because when I suspend the data flow the clock continues to clock and my buffer just fills with empty data.
ThanksYou should get a timeout error from the DAQmx Read if there is no data availalbe. Are you not getting an error?
As for your consumer loop, there is no need to check to see if there is data in the queue. Just call the Dequeue Element. If there is no data in the queue, then it sleeps until there is data (assuming you don't use a timeout). It will then pass out the data as soon as it is available.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines -
Is there any tool to check whether the proper data is inserting or not?
Hi,
We have different products A,B and C.
whenever user crates an account under these products some X,Y,Z table gets updated.
If user1 creates an account under A then X, Y, Z tables update with some data along with some ID
If user2 creates an account under A then X, Y, Z tables update with SAME DATA along with some other ID
Is there any tool to check whether the proper data is inserting (same data is inserting every time) or not?
p.s : if this thread is not related to this forum .. where can I post?
Thanks,
PraveenIs there any tool to check whether the proper data is inserting (same data is inserting every time) or not?You need to check the code to see that. Is the update or insert on the table has from different places? In that case it would be better to have them moved to a centralized place may be a package.
If you want to restrict the columns to specific values then you can use constraints. -
Hi All,
following piece of code was working fine in 4.6 C but in ECC 6.0 I get the following error:
" "END_OF_RECORD" must be a character-type data object (data type C, N,D, T or STRING) . "
I tried type-casting with field symbols but still not able to remove the error. Cannot convert end_of_record directly to type C as it may hamper the functionality. Plz advice how to remove the error without converting type x to type C
In the following code :
DATA: DELIMITER TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
end_of_record TYPE x.
SPLIT data_file_i AT delimiter INTO it_ekko-rtype
it_ekko-ebeln
it_ekko-bsart
it_ekko-lifnr
it_ekko-bedat
it_ekko-ekorg
it_ekko-ekgrp
it_ekko-bukrs
it_ekko-zterm
it_ekko-zbd1t
it_ekko-zbd1p
it_ekko-zbd2t
it_ekko-zbd2p
it_ekko-zbd3t
it_ekko-inco1
it_ekko-inco2
it_ekko-waers
it_ekko-wkurs
it_ekko-kufix
it_ekko-verkf
it_ekko-telf1
it_ekko-ihrez
it_ekko-unsez
it_ekko-angnr
it_ekko-ihran
it_ekko-submi
it_ekko-loekz
end_of_record.
where all these fields except " end_of_record " are of character type and "data_file_i " is a character type structure as defined below:
DATA :
BEGIN OF data_file_i OCCURS 0,
record(1000),
END OF data_file_i,Type X is not allowed in Unicode. When a field is declared as Type X with Value u201809u2019 or any other value, it can be resolved by using classes.
Before Unicode
CONSTANTS: c_hex TYPE x VALUE '09'.
Resolution:
Itu2019s work for any value of x.
First a temporary field of Type c should declare. Following class will convert Type x variable into type c.
Example:
CONSTANTS: c_hex TYPE x VALUE '09'.
DATA: LV_TEMP TYPE STRING.
DATA: LV_TMP TYPE C.
TRY.
CALL METHOD CL_ABAP_CONV_IN_CE=>UCCP
EXPORTING
UCCP = c_hex
RECEIVING
CHAR = LV_TMP .
CATCH CX_SY_CONVERSION_CODEPAGE.
CATCH CX_PARAMETER_INVALID_TYPE.
CATCH CX_SY_CODEPAGE_CONVERTER_INIT.
ENDTRY.
CONCATENATE I_OUTPUT-BKTXT I_OUTPUT-BVORG
I_OUTPUT-BUDAT I_OUTPUT-MESSAGE INTO
SEPARATED BY LV_TMP.
I_BUFFER = LV_TEMP.
CLEAR LV_TEMP.
CLEAR LV_TMP.
OR
Note: It works only for type x value 09.
CLASS cl_abap_char_utilities DEFINITION LOAD.
CONSTANTS: c_hex TYPE c VALUE
abap_char_utilities=>HORIZONTAL_TAB. -
Using a checkbox in numbers- if,then, I want to display today's date if checked, and keep that date, the day it was checked, not the current day
this will not work. Numbers does not provide a timestamp. you can, however, enter the formula "=now()" in any cell, then copy that same cell, then paste (using the command "Edit > Paste Formula Results"
If you need a time stamp often,
make a single cell table with the formula (mentioned earlier).
and copy and paste as needed
Maybe you are looking for
-
I installed the Outlook mobile app on my iPhone using my Hotmail email address and the authenticator code. It works, but I can no longer send emails from Mail. I have not forgotten the password, so I don't know why I am unable to send messages from
-
Copyig Data from a TABLE MODEL (TABLE) TO A FILE
Hi guys, I wont to copy data from a Default Table Model to a File can someone write a pease of code that will do that for me. DefaultTableModel model = new DefaultTableModel(); JTable table; public basic() super(); model.addCo
-
Turned off Genius, how do I restore Genius playlists from ipod to my iTunes
Hi, I turned off Genius in iTunes by accident and my Genius playlists have been deleted. They are still on my iPod. I'd like to know if they will automatically sync back to iTunes when I connect my iPod or have I lost them for good? Many thanks
-
Flashing questionmark in folder in macbook
Hi, I'm a new mac user and am extremely grateful for these forums. I think i have figured out my problem. I am trying to boot my macbook and all that i get is a flashing question mark in a folder. I've tried resetting the pram and installing from a c
-
mac app is working