String to column conversion
i have searched the forum before posting
i want to convert single string value to multiple column
445 1945551 1595560 1594591
444 1945553 1595560 1594593 1594544
to col1 --- col5
please give me adv
i am using the following version
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
You can use Regular Expression :
SQL> with t_data as
select '445 1945551 1595560 1594591' as txt from dual union all
select '444 1945553 1595560 1594593 1594544' from dual
select
txt,
regexp_substr(txt,'[^ ]+',1,1) col1,
regexp_substr(txt,'[^ ]+',1,2) col2,
regexp_substr(txt,'[^ ]+',1,3) col3,
regexp_substr(txt,'[^ ]+',1,4) col4,
regexp_substr(txt,'[^ ]+',1,5) col5
From t_data;
TXT COL1 COL2 COL3 COL4 COL5
445 1945551 1595560 1594591 445 1945551 1595560 1594591
444 1945553 1595560 1594593 1594544 444 1945553 1595560 1594593 1594544
SQL>
Similar Messages
-
Problem with String to Int conversion
Dear Friends,
Problem with String to Int conversion
I am having a column where most of the values are numeric. Only 4 values are non numeric.
I have replaces those non numeric values to numeric in order to maintain the data type.
CASE Grade.Grade WHEN 'E4' THEN '24' WHEN 'E3' THEN '23' WHEN 'E2' THEN '22' WHEN 'E1' THEN '21' ELSE Grade.Grade END
This comes the result as down
Grade
_0_
_1_
_10_
_11_
_12_
_13_
_14_
_15_
_16_
_17_
_18_
_19_
_2_
_20_
_21_
_22_
_23_
_24_
_3_
_4_
_5_
_6_
_7_
_8_
_9_
Refresh
Now I want to convert this value to numeric and do some calculation
So I changed the formula as below
cast (CASE Grade.Grade WHEN 'E4' THEN '24' WHEN 'E3' THEN '23' WHEN 'E2' THEN '22' WHEN 'E1' THEN '21' ELSE Grade.Grade END as INT)
Now I get the following error
View Display Error
_ Odbc driver returned an error (SQLExecDirectW)._
Error Details
Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
_State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 17001] Oracle Error code: 1722, message: ORA-01722: invalid number at OCI call OCIStmtFetch. [nQSError: 17012] Bulk fetch failed. (HY000)_
SQL Issued: SELECT cast ( CASE Grade.Grade WHEN 'E4' THEN '24' WHEN 'E3' THEN '23' WHEN 'E2' THEN '22' WHEN 'E1' THEN '21' ELSE Grade.Grade END as Int) saw0 FROM "Human Capital - Manpower Costing" WHERE LENGTH(CASE Grade.Grade WHEN 'E1' THEN '20' WHEN 'E2' THEN '21' WHEN 'E3' THEN '22' WHEN 'E4' THEN '23' ELSE Grade.Grade END) > 0 ORDER BY saw_0_
Refresh
Could anybody help me
Regards
Mustafa
Edited by: Musnet on Jun 29, 2010 5:42 AM
Edited by: Musnet on Jun 29, 2010 6:48 AMDear Kart,
This give me another hint, Yes you are right. There was one row which returns neither blank nor any value.
I have done the code like following and it works fine
Thanks again for your support
Regards
Code: cast (CASE (CASE WHEN Length(Grade.Grade)=0 THEN '--' ELSE Grade.Grade END) WHEN 'E4' THEN '24' WHEN 'E3' THEN '23' WHEN 'E2' THEN '22' WHEN 'E1' THEN '21' when '--' then '-1' ELSE Grade.Grade END as Int) -
Converting Oracle TIMESTAMP(4) column to SQL datetime column conversion error in ssis
I could not able to convert Oracle TIMESTAMP(4) column to SQL datetime column conversion error in ssis.
I'm connecting OLEDD Oracle Source to OLEDB SQL Destination in SSIS package. I'm trying to insert data from oracle datetime column into sql datetime column. I'm getting some errors.
Please provide helpful info.You can transform the data types directly at the source by writing a proper SQL statement, or you can convert them using the data conversion component.
Please refer the below link
http://stackoverflow.com/questions/6256168/how-to-convert-a-timestamp-in-string-format-to-datetime-data-type-within-a-packa -
Missing charsets in STring to FontSet conversion
Hi,
After installed SUn OS 10, I am trying to install SMC and I got a warning error: Missing Charsets in String to FontSet conversion. Cannot convert string "-monotype_arrial-regular-r-normal --*-140-*-*-p-*-iso8859-2" to type FonsStruct
and so on, with different font types. etc....
How can I find out which fontset in the Unix box? How can I permanent set it back to UTF-8 w/o re install OS again?
Thanks
HSToo bad Lily didn't follow up on TommyReynolds' suggestion. I'm also having the same problem ( I think ).
TommyReynolds does say how to get the installed list, but doesn't say how to find out what's missing.
My settings:
[root@OEL5u4DB11gR2 X11]# rpm -qa 'xorg*font*' | /bin/sort
xorg-x11-fonts-100dpi-7.1-2.1.el5
xorg-x11-fonts-75dpi-7.1-2.1.el5
xorg-x11-fonts-base-7.1-2.1.el5
xorg-x11-fonts-ISO8859-1-100dpi-7.1-2.1.el5
xorg-x11-fonts-ISO8859-1-75dpi-7.1-2.1.el5
xorg-x11-fonts-misc-7.1-2.1.el5
xorg-x11-fonts-truetype-7.1-2.1.el5
xorg-x11-fonts-Type1-7.1-2.1.el5
xorg-x11-font-utils-7.1-2
[root@OEL5u4DB11gR2 X11]# uname -a
Linux OEL5u4DB11gR2 2.6.18-164.el5 #1 SMP Thu Sep 3 02:16:47 EDT 2009 i686 i686 i386 GNU/Linux
[root@OEL5u4DB11gR2 X11]# xclock &
[1] 5950
[root@OEL5u4DB11gR2 X11]# Warning: Missing charsets in String to FontSet conversion
I would greatly appreciate any input.
Kind regards,
UFP1701 -
Error Warning: Missing charsets in String to FontSet conversion
Hi
I was installed aqualogic BPM version 6.0 MP4 for weblogic on solaris 10 SPARC
when i ran albpmadmcenter i got an error
bash-3.00$./albpmadmcenter
Warning: Missing charsets in String to FontSet conversion
Warning: Missing charsets in String to FontSet conversion
any solution?
thanks.I just found this on the web at http://www-01.ibm.com/support/docview.wss?uid=swg21146408.
When I ran "export LC_ALL=C" and then ran xclock, I did not get the message. This might work for you.
Paul -
i have proubleam with string to date conversion, i out put date fromat is 2012-04-30T23:48:55.727-07:00 . so please help me the format conversion.
i wrote the method but it not workig
My method is
-(NSDate *)dateformstr:(NSString *)str
NSString *date = [str stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSDateFormatter *dateFormate = [[NSDateFormatter alloc] init];
[dateFormate setDateFormat:@"yyyy-MM-dd'T'HH:mm:sssZZZZ"]
// NSDate *formatterDate = [dateFormate dateFromString:str];
return formatterDate;
but i did not the value and if i try othere formate i is working but my requiremet format is 2012-04-30T23:48:55.727-07:00.
can any help it out in this senario.Sorry Butterbean, but I'm interested in the answer to your question myself.
I've spent a few hours transfering my library from one computer to another and then find out that my ratings didn't transfer. Like you, I've spent many hours rating my 2000+ songs. I'm sure you have more, nevertheless, I want to find out how to get those ratings. They still show in my iTunes on my laptop but, when I go to the iTunes folder and display the details of at song, no rating is there. If you find out how to get them to display there in the iTunes folder, it seems that would be the key.
Hope you get your answer soon. -
Warning: Missing charsets in String to FontSet conversion
Hi ,
I just installed eclipse on a linux box abd while running eclipse i get the folowwing error -
Warning: Missing charsets in String to FontSet conversion
and the font looks distorted with blocks between alphabetsdid you fix this problem? I'm getting the same error :
[bmollett@hextall ~]$ Warning: Missing charsets in String to FontSet conversion
Warning: Cannot convert string "-*-*-medium-r-*-*-*-120-*-*-*-*-*-*" to type FontSet
Warning: Missing charsets in String to FontSet conversion
Warning: Unable to load any usable fontset
Warning:
Name: FONTLIST_DEFAULT_TAG_STRING
Class: XmRendition
Conversion failed. Cannot load font.
Warning:
Name: FONTLIST_DEFAULT_TAG_STRING
Class: XmRendition
Conversion failed. Cannot load font.
Warning:
Name: FONTLIST_DEFAULT_TAG_STRING
Class: XmRendition
Conversion failed. Cannot load font.
Warning: No font found.
Warning:
Name: FONTLIST_DEFAULT_TAG_STRING
Class: XmRendition
Conversion failed. Cannot load font.
Warning:
Name: FONTLIST_DEFAULT_TAG_STRING
Class: XmRendition
Conversion failed. Cannot load font.
Warning:
Name: FONTLIST_DEFAULT_TAG_STRING
Class: XmRendition
Conversion failed. Cannot load font.
JVMDG217: Dump Handler is Processing Signal 11 - Please Wait.
JVMDG303: JVM Requesting Java core file
JVMDG304: Java core file written to /home/bmollett/javacore.20050804.102118.11000.txt
JVMDG215: Dump Handler has Processed Exception Signal 11.
I've tried both motif and gtk2 versions ... -
I can't pass empty string as column of Table Valued Parameter.
Hello.
I have stored procedure which accept TVP with columns of 'sql_variant' type. And I have C++ application which call this stored procedure.
When i pass some non-empty string as sql_variant from my application - all works fine.
But when I need to pass empty string ("") as sql_variant - I get following error:
"OLEDB hr = 0x80040e14
#0: OLEDB provider error 3621 "The statement has been terminated."
#1: OLEDB provider error 8062 "The data for the table-valued parameter 1 doesn't conform to the table type of the parameter."
#2: OLEDB provider error 8046 "The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Table-valued parameter 0 (""), row 1, column 1: The supplied length is not valid for data type sql_variant.
Check the source data for invalid lengths. An example of an invalid length is data of nchar type with an odd length in bytes."
Could you please help me deal with that issue?
Thanks,
VitaliyDear Vitaliy,
Thank you for your question.
Based on my understanding of your question, the issue is related with passing SQL_VARIANT data type in C++ application using Microsoft OLE DB Provider.
As we can see from http://msdn.microsoft.com/en-us/library/ms173829(v=sql.100).aspx:
ODBC does not fully support sql_variant. Therefore, queries of sql_variant columns are returned as binary data when you use Microsoft OLE DB Provider for ODBC (MSDASQL). For example, a sql_variant column that contains the character string data 'PS2091'
is returned as 0x505332303931.
According to above statement, as you are using OLEDB provider for ODBC with sql_variant in your application, it is not fully support. Seems there are some conversion failure within the Stored Procedure calling. You may consider to adjust your application
slightly to use other commonly supported data types which also fits your application requirements.
I listed some more information regarding sql_variant below for your reference:
A column of type sql_variant may contain rows of different data types such as int, binary and char values.
A sql_variant data type must first be cast to its base data type value
before participating in operations such as addition and subtraction. You can find the conversion details in "Comparings sql_variant Values" part.
Below types of values cannot be stored by using sql_variant:
varchar(max)
varbinary(max)
nvarchar(max)
xml
text
ntext
image
timestamp
sql_variant
geography
hierarchyid
geometry
User-defined types
Hope it will be helpful.
Thank you!
Best Regards,
SQL Team - MSFT -
Find out varchar2 string NULL columns and Empty columns
Hi dev's ,
my requiremnt is to find out the string columns Names of whose storing NULL values and EMPTY strings. for that i had written below code. it's getting some error.
SET ECHO OFF;
SET FEEDBACK OFF;
SET SERVEROUTPUT ON;
SET VERIFY OFF;
SET PAGES 0;
SET HEAD OFF;
spool D:\stringnull.csv
DECLARE
v_tab_indent NUMBER(5);
v_col_indent NUMBER(5);
v_val1 VARCHAR2(20);
v_val2 VARCHAR2(20);
v_query1 VARCHAR(500);
v_query2 VARCHAR(500);
BEGIN
--DBMS_OUTPUT.ENABLE(100000);
SELECT MAX(LENGTH(table_name))+1,MAX(LENGTH(column_name)) +1
INTO v_tab_indent,v_col_indent
FROM user_tab_columns
WHERE data_type='VARCHAR2';
FOR i IN
(SELECT table_name,
column_name
FROM user_tab_columns
WHERE data_type IN ('NVARCHAR2', 'CHAR', 'NCHAR', 'VARCHAR2')
ORDER BY table_name,
column_name
LOOP
v_query1:='SELECT NVL('||i.column_name||',0) AS VAL
FROM '||i.table_name||' where '||i.column_name||' IS NULL';
v_query2:='SELECT '||i.column_name||' AS VAL
FROM '||i.table_name||' where '||i.column_name||'=''''';
--dbms_output.put_line(v_query1);
-- dbms_output.put_line(v_query2);
EXECUTE immediate v_query1 INTO v_val1;
EXECUTE immediate v_query2 INTO v_val2;
dbms_output.put_line (rpad(i.table_name,v_tab_indent,' ')||','||rpad(i.column_name,v_col_indent,' ')||' ,'||v_val1||','||v_val2);
END LOOP;
END;
Spool OFF
Set echo on
Set feedback onERROR:
Error report:
ORA-01403: no data found
ORA-06512: at line 31
01403. 00000 - "no data found"
*Cause:
*Action:
set feedback onpls help me on this issue..
Thanks,Example:
SQL> DECLARE
2 v_val VARCHAR2(20);
3 v_query1 VARCHAR(32767);
4 BEGIN
5 FOR i IN (SELECT table_name, column_name FROM user_tab_columns
6 WHERE data_type IN ('NVARCHAR2', 'CHAR', 'NCHAR', 'VARCHAR2')
7 ORDER BY table_name, column_name
8 )
9 LOOP
10 v_query1 := 'SELECT count(*) FROM '||i.table_name||' where '||i.column_name||' IS NULL';
11 EXECUTE immediate v_query1 INTO v_val;
12 dbms_output.put_line(rpad(i.table_name,30,' ')||' : '||rpad(i.column_name,30,' ')||' : '||v_val);
13 END LOOP;
14 END;
15 /
CHILD_TAB : DESCRIPTION : 0
DEPT : DNAME : 0
DEPT : LOC : 0
EMP : ENAME : 0
EMP : JOB : 0
MYEMP_OLD : ENAME : 0
MYEMP_OLD : JOB : 0
MYNULLS : ENAME : 0
MYNULLS : JOB : 4
PARENT_TAB : DESCRIPTION : 0
T : CHAR_VALUE : 0
TABLE1 : COL1_DESC : 0
PL/SQL procedure successfully completed. -
Join String to Column in Query
Hi
I have a column in a query I would like to join a string so that the value from the column always has a descriptor at the end like this:
1.5 "Yards"
2.5 "Yards"
I don't mean:
column AS "Yards"
The value in the column changes length so I want to try and have this descriptor so that when I put it in a report the changing value length does not overwrite a seperate text field in the report.
the column is a float value and I want to join the string to it.
Thanks for any input on how to do thisHi
Sorry I think we have wires crossed
so say I have this:
select columnA
from table A
and It returns this:
columnA
======
123
456
789
.What I want is for it to show this:
columnA
======
123 Yards
456 Yards
789 Yards
. Yards
. Yards
. Yards
. Yards
. YardsSo for ever value returned I want to have the string value "Yards" on the end; column A is a float.
Thanks -
Add one column of string to columns of integer
Hi there,
Could someone help please.
I would like to add one column of strings to a few columns of integer.
--------- Added elements ------
20C= 100 101 102 20C=100 20C=101 20C=102
15C= 200 201 202 15C=200 15C=201 15C=202
10C= 300 301 302 10C=300 10C=301 10C=302
Thanks for help.Hoverman wrote:
I had a look at the tutorial link you sent. They are not particularly relevant to my question.
Why do you think I am posting a question? I have already spent a few hours searching forum and looking at examples. It would be more helpful to have a relevant example or a solution.
Thanks for your time.
What is your problem here? RavensFan gave you information quite relevant to your task, but you had not (and still have not) answered his questions, so he could not (nor anyone else) tell where in your task you are having trouble. Do you know how for loops work, with respect to outputs? Your questions imply that you need to spend some real time learning LabVIEW, not just "having a look at the tutorials."
Hmm, it looks like you had a similar problem with your last question, and you still have not indicated that you understood how to solve it.
Cameron
To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.
To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):
LabVIEW Unit 1 - Getting Started
Learn to Use LabVIEW with MyDAQ -
Archiving a ztable with string/lob column
Hello,
We have a ZTable that is quite big.
Our functionals would like to preserve this information,
even if they rarely access it.
The table is independent of other tables.
This table contains a zone with the abap data type string.
This is stored as a lobs column in the Oracle database.
1. Is it possible to "sara" archive that kind of tables?
2. Where could I found examples of ADK abap delete/write/read/reload programs
for ztables?
Thanks in advance for your answers.Give help.sap.com a chance:
http://help.sap.com/saphelp_sm40/helpdata/EN/2a/fa042d493111d182b70000e829fbfe/frameset.htm
it is pretty well explained there and even mentiones example programs: SBOOKA and SFLIGHTA -
Typecast ( Column Conversion) in OBIEE
Hi all,
I am unable to execute the joins in the physical layer
I have a table with Zone KEY(varchar) as a primary key and i need to join it with an another table with Zone ID(String) both zone Key and ID contains the same list
but due to the difference in datatypes there is no data flowing in the report
Do we have a typecast function to convert one or other data types in the physical layer?
Any other best possible answer??You can change the datatype in the rpd.
Or
Create view in the database and cast to required datatype and import in physical layer
or
go with any join in physical layer, in BMM layer create a new logical column with cast and create a logical foreign key join(not logical complex join) using a new logical column and other column
Any of these should work ;)
If helps pls mark -
ALL I want to do is update a BLOB field in a DB2 database with a string. The field is updating but I'm getting garbage. Here's the code I'm using to test. What am I doing wrong? The GDTXFT is the BLOB field.
Connection c = DriverManager.getConnection("jdbc:db2://DEV550");
PreparedStatement ps =c.prepareStatement("UPDATE PRODDTA.F00165 SET GDTXFT = ? WHERE GDOBNM = 'GT4311' AND GDTXKY = '72455|00005|OR|000|1.000'");
String s="Is anyone out there?";
ps.setBytes(1, s.getBytes());
ps.executeUpdate();You normally do the following steps:
SELECT FOR UPDATE on the BLOB column
Use getBlob() to fetch the BLOB (you may need to cast it to a DB2-specific BLOB in your JDBC driver)
Get a reference to the BLOB's InputStream
Write data to the stream
Commit- Saish -
HELP: String to double conversion?
Hello,
I want to convert a String to a double, and then use this double for a calculation. The conversion seems to be ok, but I get an error with the calculation... Please HELP!
A part of my code:
double angle;
Double converted_angle;
angle=jTextField2.getText();
converted_angle= Double.valueOf(angle);
double theta = cos(Math.PI/180*converted_angle);
ERROR: "operator * cannot be applied to double,java.lang.Double"
Thanks in advance.This is happening because you want to multiply a Double object, instead of a double value. Do this:
Double converted_angle; should be double converted_angle;
converted_angle= Double.valueOf(angle); should be changed to converted_angle = Double.parseDouble(angle);
angle should probably be a String.
check this link for your options:
http://java.sun.com/j2se/1.4/docs/api/java/lang/Double.html
Maybe you are looking for
-
Media Encoder: outputs "Media Offline," freezes during H.264 Export
Hi, I've been experiencing multiple issues with AME...firstly, on occasion when exporting timelines with linked AE comps, one or two of those comps will output with "Media Offline" frames even though the comps are online and fully playable in the tim
-
Safari 5.1.7 Bookmarks - adding or changing hangs for a few seconds
Hello all - Safari 5.1.7 - osx 10.7.4 - MBA Safari hangs when adding a bookmark or deleting/changing order/moving to new folders etc. Hangs for about 5 seconds and then completes the task. It will do the first change just fine, then any further bookm
-
Hosting with Business Catalyst for cli
I currently use Adobe Muse to build websites, I love it it allows me to build and create the type of sites my clients desire. So with that in mind I need the following advice: 1) One of my clients wants to host with a separate company NOT BC. How eas
-
Dear Sir , any 1 can help me its urgent , i could not add my company logo or social network logo on signature in my mac mail
-
Battery - just keeps on charging!help!
I have an ipod Mini and the battery always lasts 2-3hours before it goes dead (which I always thought was a short life). I charge it on a plug adapter and it usually takes a couple of hours to fully charge to 'charge complete', however, when the batt