How to take the values from a String ( CSV values).
Hi All,
I am passing csv String to a procedure as in parameter,but I have to take the values from a csv String one by one.Please let me know Is there any StringTokenizer function in oracle to take values like in java. Here is my javacode.
import java.util.StringTokenizer;
public class Sample {
public static void main(String[] args) {
String s="one,two,three,four,five";
StringTokenizer stringTokenizer=new StringTokenizer(s,",");
System.out.println( stringTokenizer.countTokens());
System.out.println(stringTokenizer.hasMoreTokens());
while(stringTokenizer.hasMoreTokens()){
System.out.print(stringTokenizer.nextToken());
o/p: one two three four five
Something based around one of these two methods should assist...
select substr( the_string
, decode( level, 1, 1, instr(the_string,',',1,level-1)+1)
, decode( instr(the_string,',',1,level), 0, length(the_string), instr(the_string,',',1,level) - decode( level, 1, 0, instr(the_string,',',1,level-1))-1)
) the_value
from ( select '10,12,20,30,30,3,12,12,56' the_string
from dual
connect by level < length(replace(translate(the_string,'01234567890','00000000000'),'0')) + 2
or
SQL> select REGEXP_SUBSTR ('a,b,c,d,e', '[^,]+', 1, level) from dual connect by level<=5
2 /
REGEXP_SU
a
b
c
d
e
SQL>
Similar Messages
-
How to take the data from sage system to sap r/3
hi expects,
how to take the data from sage system to sap r/3? which adapter is to be used?what is the format of data in sage system?how the scenarios will work ? please help me in solving this problem?hi rohit,
the data transfer can be done by using SOAP adapter
do chk this link
http://www.sage.org/lists/sage-members-archive/2001/msg01718.html
http://www.sage.org/lists/sage-members-archive/2001/msg01739.html
thanx
Sampath -
How to take the data from excel list to sap r/3(with time interval)
hi experts,
how to transfer the data from a third party system(if it is in format of excel) to sap r/3.with that in a particular time interval,it will delete the data from excel sheet.Hi
use the Fm
'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_path
i_begin_col = '1'
i_begin_row = '2'
i_end_col = '2'
i_end_row = '500'
giving the starting row and column and passing the ending row and column name
Reward points if useful........
Regards,
Nitin Sachdeva -
How can i store values from my String into Array
Hi guys
i wants to store all the values from my string into an array,,,, after converting them into intergers,,,, how i can do this becs i have a peice of code which just give me a value of a character at time,,,,charat(2)...BUT i want to the values from String to store in an Array
here is my peice of code which i m using for 1 char at time
int[] ExampleArray2 = new int[24];
String tempci = "Battle of Midway";
for(int i=0;i>=tempci.length();i++)
int ascii = tempci.charAt(i); //Get ascii value for the first character.public class d1
public static final void main( String args[] )
int[] ExampleArray2 = new int[24];
String tempci = "Battle of Midway";
for(int i=0;i<tempci.length();i++)
int ascii = tempci.charAt(i);
ExampleArray2=ascii;
for(int i=0;i<ExampleArray2.length;i++)
System.out.println(ExampleArray2[i]); -
How to extract an integer or a float value from a String of characters
Hi i have a problem getting to a float value within a string of characters..
for instance the string is
"numberItem xxxxxxxxx 700.0" (each x is a space..the forum wouldnt let me put normal spaces for some reason)
how do i store 700.0 in a float variable
remember the string is obtained from an inputfile
so far i got the program to store the inputfile data line by line in a String array..i tried tokenizing the string to get to the the float value but since i have mulitple spaces within my string, the token method only gets "numberItem" from the above String
This is all i have so far:
String c;
String Array[] =new String[g]; (i used a while loop to obtain g(the nubmer of lines in the file))
while((c=(cr.readLine()))!=null)
Array[coun]=c;
it would be reallllllllllllllllllllllllllllllllllllllly easy if there was a predefined method to extract numeric values from a string in java..
Edited by: badmash on Feb 18, 2009 5:50 PM
Edited by: badmash on Feb 18, 2009 5:50 PM
Edited by: badmash on Feb 18, 2009 5:55 PMbadmash wrote:
Hi i have a problem getting to a float value within a string of characters..
for instance the string is
"numberItem xxxxxxxxx 700.0" (each x is a space..the forum wouldnt let me put normal spaces for some reason)
with the space included
how do i store 700.0 in a float variable
remember the string is obtained from an inputfile
so far i got the program to store the inputfile data line by line in a String array..i tried tokenizing the string to get to the the float value but since i have mulitple spaces within my string, the token method only gets "numberItem" from the above StringHuh?
Not true.
Anyway why not use string split, split on spaces and grab the last element (which by the format you posted would be your 700.0)
Then there is the Float.parseFloat method.
It is easy.
And another thing why not use a List of Strings if you want to store each line? (And why did you post that code which doesn't really have anything to do with your problem?) Also in future please use the code formatting tags when posting code. Select the code you are posting in the message box and click the CODE button. -
From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?
Hi,
Use NVL or COALESCE:
NVL (col_a, col_b)
Returns col_a if col_a is not NULL; otherwise, it returns col_b.
Col_a and col_b must have similar (if not identical) datatypes; for example, if col_a is a DATE, then col_b can be another DATE or it can be a TIMESTAMP, but it can't be a VARCHAR2.
For more about NVL and COALESCE, see the SQL Language manual: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions119.htm#sthref1310
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002 -
How can I take the pics from my old ipod and transfer them onto my computer without deleting anything?
Pictures on an iPod are stored in a special format, optimized for the iPod's small lower resolution screen, to save storage space. iTunes puts them into that format when syncing. There is setting in iTunes, on the iPod's Photos screen (where you set up syncing of photos) for Include full resolution photos. If that checkbox was checked when you synced the photos to the iPod, THEN you can Enable disk use and find those photo files on the iPod in the Photos folder.
Otherwise, you cannot get your photos back, using iTunes. There may be third-party utilities that can extract individual photos from the iPod, but they will still be lower-resolution versions of the original photo. -
How do i take the music from my ipod and transfer it permanently onto my PC's itunes?
How do i take the music from my ipod and transfer it permanently onto my PC's itunes?
If you were using a Mac you could use a program but AFAIK there is nothing similar yet for the PC.
However, you should have a backup of your music, correct? Just restore from that backup to your computer (and, if not, at least this will teach you the importance of always backing up your music purchases onto writable media like DVD). -
For some reason my Itunes deleted my current library and reverted back to a library from 5 years ago! How do I take the music from my Iphone and put it back into my Itunes library?
backup from old computer and restore to new either to icloud or an external drive also check out turingtest2's excellent article on backup using synctoy
-
How does the production system take the benefit from user-exits.
How does the production system take the benefit from user-exits.
and it is not the production system that benefits. its the company and the people working with SAP that benefits from the user exits which allow SAP to be altered for the company specific situations.
-
How does the PRODUCTION SYSTEM take the benifit from the USER EXITS?
how does the PRODUCTION SYSTEM take the benifit from the USER EXITS?
please explainand it is not the production system that benefits. its the company and the people working with SAP that benefits from the user exits which allow SAP to be altered for the company specific situations.
-
I am using the hp 3525 model printer , i like to know how to take photo print from the printer
Hi,
I am using the hp 3525 model printer , i like to know how to take photo print from the printer .
Regards
Mukesh.RHi Mukesh,
I'd like to help, but can you clarify the issue? Are you asking how to print a photo from your printer? Also, can you confirm that your printer is a HP Deskjet Ink Advantage 3525 e-All-in-One Printer?
Thanks!
Tara
**Although I am an HP employee, I am speaking for myself and not for HP. -
How do I take the audio from a video and divide it into separate songs
How do I take the audio from a video file and divide it into separate audio songs? I then want to export those songs into itunes.
http://www.bulletsandbones.com/GB/GBFAQ.html#exportsections
(Let the page FULLY load. The link to your answer is at the top of your screen) -
I want to take the photos from my old iphone 5 that is backed up on my itunes and but them on icloud and onto iphoto. Any help?
Welcome to the Apple community.
You can only use a back up to restore another device. -
How to bring the data from application server to presentation server
hi,
i have one problem,i have written the program which will open the files in the application server when we run the program in the background(sm37),the same data from application server i want to bring into presentation server in the format of (.csv),how to bring the data from application to presentation server can any body help me on this topic.folowing is the code .
*& Report ZPFA_HIER_LOAD
REPORT ZFPA_HIER_LOAD.
*---- Declaration of Oracle connectioN
DATA con_name LIKE dbcon-con_name VALUE 'COMSHARE'.
DATA: MFL1(9),MFL2(5),MFL3(9),MFL4(2),MFL5(8) TYPE c.
DATA : mfilename type string.
data: begin of matab1 occurs 0,
MFL1(9) TYPE C,
MFL2(5) TYPE C,
MFL3(9) TYPE C,
MFL4(2) TYPE C,
MFL5(8) TYPE C ,
end of matab1 .
data: setid(8) type c.
data: begin of source occurs 0,
setid(8) type c,
end of source.
*PARAMETERS : p_pfile LIKE filename-FILEEXTERN.
*PARAMETERS : m_bsenty(8). " type c obligatory.
*mfilename = P_PFILE.
EXEC SQL.
SET CONNECTION :con_name
ENDEXEC.
EXEC SQL.
CONNECT TO :con_name
ENDEXEC.
EXEC SQL PERFORMING get_source.
SELECT set_id FROM UNIT_SET INTO
:setid
ORDER BY SET_ID
ENDEXEC.
start-of-selection.
LOOP AT SOURCE.
REFRESH matab1. CLEAR matab1.
EXEC SQL PERFORMING evaluate.
SELECT TO_CHAR(MEM_ID),TRIM(TO_CHAR(MEM_PID)) FROM UNIT_TREE INTO :MFL1,
:MFL5
where set_id = :SOURCE-SETID ORDER BY MEM_ID
ENDEXEC.
if SOURCE-SETID = '80000000'.
mfilename = '/tmp/aesorg'.
elseif SOURCE-SETID = '80000006'.
mfilename = '/tmp/Consolidation_Manager'.
elseif SOURCE-SETID = '80000010'.
mfilename = '/tmp/10org'.
elseif SOURCE-SETID = '80000012'.
mfilename = '/tmp/20org'.
elseif SOURCE-SETID = '80000018'.
mfilename = '/tmp/30org'.
elseif SOURCE-SETID = '80000025'.
mfilename = '/tmp/40org'.
Endif.
mfilename = '/usr/test.dat'.
************************This was i tried***********************
open dataset mfilename for output in text mode encoding default." IN
*TEXT MODE ENCODING DEFAULT.
if sy-subrc <> 0.
exit.
endif.
close dataset mfilename.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = MFILENAME
FILETYPE = 'ASC'
TABLES
data_tab = matab1
EXCEPTIONS
file_write_error = 1
invalid_type = 2
no_authority = 3
unknown_error = 4
OTHERS = 10.
loop at matab1 .
transfer matab1 to mfilename.
endloop.
clear matab1.
ENDLOOP.
loop at matab1 .
transfer matab1 to mfilename.
endloop.
close dataset mfilename.
MFL5 = '0'.
CLEAR MFL5.
FORM evaluate.
if MFL5 = -1.
MFL5 = ''.
ENDIF.
concatenate MFL1 ',' into MFL1.
concatenate MFL1 ',' into MFL3.
matab1-MFL1 = MFL1.
matab1-MFL2 = 'ZBUE,'.
matab1-MFL3 = MFL3.
matab1-MFL4 = ' ,'.
matab1-MFL5 = MFL5.
append matab1 .
CLEAR MFL1.
CLEAR MFL2.
CLEAR MFL3.
CLEAR MFL4.
CLEAR MFL5.
ENDFORM.
"evaluate
*& Form GET_SOURCE
text
FORM GET_SOURCE.
source-setid = setid.
append source.
clear source.
ENDFORM. "GET_SOURCEHi Rammohan,
You cannot use OPEN DATASET to transfer data from application server to presentation server.
You can do the following :
<b>Do 1st point in BACKGROUND</b>
1. Read the data file from application server into an internal table using OPEN DATASET
<b>Do 2nd point in Foreground</b>
2. Once you get the data into an internal table, then use FM GUI_DOWNLOAD to download it on presentation server
You cannot use the above 2 point together in Background because its not possible. Hence you need program it partially in background and partially in foreground.
Best regards,
Prashant
Maybe you are looking for
-
How to display check box in atable control
hi here is my requirement how can i display check box in table control and also when i check that check box it has to dispaly one pop up screen with the records of table control row points will be rewarded Thanks&Regards Nagesh.Paruchuri
-
On both my G5 and Ti Book I can bring Tiger to a screeching halt using Safari. All I need to do is open 6 - 10 tabs in quick succession, so that they are all trying to load at the same time. I ctrl-click various links on my book marks to bring up the
-
How to establish ebooks for automatic reading?
I find some book can automatically reading,but i use ibooks author create book can't automatically reading. It lose Voice icon on top toolbar,it is not like other books can click open dialog by this icon,then control automatically or manual turn pag
-
Just updated my iPad with iOS 7.0.3 > my iTunes music downloads are messed up....the regular tracklist of the albums are in chaos, can someone help me out to get them " in line" again!?
-
My Photoshop freezes and then won't open? Help?
Hi all, I am running CS6, but over the past fe wmonths it has started acting strange. When I go to save the file, sometimes as a PSD and other times as a jpeg or gif, the program freezes up on me and I get the spinning beachball. I have to force qu