SQLLDR Problem in converting a date column having spaces
Hi,
I am trying to load some data from Digtal Alpha Server (VMS OS). Sequential file is created using COBOL. A column which is holding some dates 'yyyymmdd' also can have spaces in it as we are moving spaces with cobol command 'MOVE SPACES TO FIELD_NAME'.
I have mentioned NULLIF field_name=BLANKS "to_date(field_name,'yyyymmdd')"
but it does not recognize BLAKNS as it gives error like
Record 588: Rejected - Error on table BASIC_INFO.
ORA-01841: (full) year must be between -4713 and +9999, and not be 0
i edited the sequential file in windows word pad and just saved it to get rid of soem operating system specific formating things 'i have no idea about these as wordpad told me about that :('
and when i tried tried again loading it worked fine as it replaced blanks with null.
any idea what should i do in order to load data in one go.
thanks
nadeem
it would make it more easier to code the sqlldr control file if you could make the flat file as comma delimited (*.csv)
Similar Messages
-
Problem in converting legacy date format
Hello all,
I am having a legacy file in which the date format is yyddd ( e.g 07129 ).
Can any of you experts suggest me how can i convert these date format in SAP date format i.e YYYYMMDD.
Please suggest.
ArunHi, Arun
May be the following code will help you in this way,
data: date like sy-datum,
year(4),
month(2),
day(2).
year = '2006'.
month = '12'.
day = '01'.
date+0(4) = year.
date+4(2) = month.
date+6(2) = day.
Replay if any problem,
Kind Regards,
Faisal
Edited by: Faisal Altaf on Jan 6, 2009 11:00 PM -
Problem in converting util date format to sql date format
im trying to convert util date to sql date...i'm getting the error msg as
Error is : java.lang.NullPointerException
Error Message : null
i'm not bale to track the result...whatz the problem with this code?
This fromDate value will be dynamically built, value will be
fromDate="Tue Jul 15 00:00:00 IST 2003";
java.util.Date xx=util.stringToDate(fromDate);
java.sql.Date sqlD=null;
sqlD.setTime(xx.getTime());
System.out.println("sqld"+sqlD);I try this and it works:
SimpleDateFormat simpledateformat = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.UK);
String s = "Tue Jul 15 00:00:00 IST 2003";
java.util.Date date = simpledateformat.parse(s);
java.sql.Date sqlD=new java.sql.Date(date.getTime());
System.out.println("sqld"+sqlD);
Hope this helps. -
Problem in converting table data into CSV file
Hi All,
In my Process i need to convert my error table data into csv file,my data is converted as csv file by using OdisqlUnload function,but the column headers are not converted,i use another procedure for converting column headers but iam getting below error ...
com.sunopsis.sql.SnpsMissingParametersException: Missing parameter string.find, string.find
SQL: import string import java.sql as sql import java.lang as lang import re sourceConnection = odiRef.getJDBCConnection("SRC") output_write=open('C:/Oracle/Middleware/Oracle_ODI2/oracledi/pro/PRO.txt','r+') myStmt = sourceConnection.createStatement() my_query = "select * FROM E$_LOCAL_F0911Z1" my_query=my_query.upper() if string.find(my_query, '*') > 0: myRs = myStmt.executeQuery(my_query) md=myRs.getMetaData() collect=[] i=1 while (i <= md.getColumnCount()): collect.append(md.getColumnName(i)) i += 1 header=','.join(map(string.strip, collect)) elif string.find(my_query,'||') > 0: header = my_query[7:string.find(my_query, 'FROM')].replace("||','||",',') else: header = my_query[7:string.find(my_query, 'FROM')] print header old=output_write.read() output_write.seek(0) output_write.write (header+'\n'+old) sourceConnection.close() output_write.close()
And i used below code for converting.......
import string
import java.sql as sql
import java.lang as lang
import re
sourceConnection = odiRef.getJDBCConnection("SRC")
output_write=open('C:/Oracle/Middleware/Oracle_ODI2/oracledi/pro/PRO.txt','r+')
myStmt = sourceConnection.createStatement()
my_query = "select FROM E$_COMPANY"*
*my_query=my_query.upper()*
*if string.find(my_query, '*') > 0:*
*myRs = myStmt.executeQuery(my_query)*
*md=myRs.getMetaData()*
*collect=[]*
*i=1*
*while (i <= md.getColumnCount()):*
*collect.append(md.getColumnName(i))*
*i += 1*
*header=','.join(map(string.strip, collect))*
*elif string.find(my_query,'||') > 0:*
*header = my_query[7:string.find(my_query, 'FROM')].replace("||','||",',')*
*else:*
*header = my_query[7:string.find(my_query, 'FROM')]*
*print header*
*old=output_write.read()*
*output_write.seek(0)*
*output_write.write (header+'\n'+old)*
*sourceConnection.close()*
*output_write.close()*
Any one can you help regarding this
Edited by: 30021986 on Oct 1, 2012 6:04 PMThis may not be an option for you but in pinch you may want to consider outputing your data to an MS Spreadsheet, then saving it as a CSV. It's somewhat of a cumbersome process, but it will get you by for now.
You will need to change your content type to application/vnd.ms-excel.
<% response.setContentType("application/vnd.ms-excel"); %> -
Problem in converting the date format in Second's place
I am developing an application using OAF in JDeveloper.
I have to pass the current date from my page to a quary to filter the data.
I used the following:
String PresentDate=this.getOADBTransaction().getCurrentDBDate().toString();
However it is sending a date like '2011-03-22 17:04:14.0'. Here if you see the seconds place, it has a fraction as well.
I need to convert it by using TO_DATE(PresentDate, 'YYYY-MM-DD HH24:MI:SS')
But because of the fraction in Seconds place, it gives an error.
Can anyone help me to solve this problem?
Thanks & Regards
HawkerHawker,
Instead of that use..
//Calling dateValue( ) does not include time.
long sysdate = transaction.getCurrentDBDate().dateValue();
Regards,
Gyan -
How to convert a date column into timestamp
My sample data is:
3/7/2011 11:40:00 AM
I tried this :
TO_TIMESTAMP (completiondate, 'MM/DD/YYYY HH12:MI:SS.FF')
but iam getting error as
ORA-01858: a non-numeric character was found where a numeric was expected
can any one help me
thanks in advance846773 wrote:
My sample data is:
3/7/2011 11:40:00 AM
I tried this :
TO_TIMESTAMP (completiondate, 'MM/DD/YYYY HH12:MI:SS.FF')
but iam getting error as
ORA-01858: a non-numeric character was found where a numeric was expected
can any one help meformat mask must match the data & yours does not match
My sample data is:
3/7/2011 11:40:00 AMpost SQL & results that proves above is true & valid
SQL> declare
2 my_ts timestamp;
3 begin
4 my_ts := sysdate;
5 end;
6 /
PL/SQL procedure successfully completedEdited by: sb92075 on Jun 20, 2011 12:10 PM -
Converting Date Column to format MM/DD/YYYY in RPD
Hi all,
I have a requirement like converting a Date column to format MM/DD/YYYY in RPD. Any help as we are not supposed to use the BI Answers Data Fomat for showing this format.
Thankyou,
Edited by: [email protected] on May 10, 2010 11:49 PMHi Saichand,
I need the resulting column in DATE format only. The solution which you specified converts the datatype to character. Is there anyway to convert the format but not the datatype. -
Problem in Uploading Excel Data ! - Urgent
Dear Experts,
I am uploading excel data using FM 'TEXT_CONVERT_XLS_TO_SAP' , its directly convert data and store in internal table same as in excel sheet(row , column wise).
But the problem is , one of the column having description more then 500 characters. so while uploding excel to itab its truncating the text and only uploding 255 characters.
Is there any other way , so that i can upload more then 500 characters long text. Also i have tried 'ALSM_EXCEL_TO_INTERNAL_TABLE' FM , it was also not working.
Please Help me , its Urgent.
Points will be rewared.
Thanks & Regards,Hi,
Please use FM 'GUI_UPLOAD'.
types: begin of ttab,
rec(1000) type c,
end of ttab.
types: begin of tdat,
fld1(10) type c,
fld2(10) type c,
fld3(10) type c,
end of tdat.
data: itab type table of ttab with header line.
data: idat type table of tdat with header line.
data: file_str type string.
parameters: p_file type localfile.
at selection-screen on value-request for p_file.
call function 'KD_GET_FILENAME_ON_F4'
exporting
static = 'X'
changing
file_name = p_file.
start-of-selection.
file_str = p_file.
call function 'GUI_UPLOAD'
exporting
filename = file_str
filetype = 'ASC'
tables
data_tab = itab
exceptions
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
others = 17.
Best regards,
Prashant -
How to Convert Rows to Column in Query
Dear All,
I'm having problems in converting the data from rows into columns. Eg:
- item A sold on 01/01/07 = 5 kg
- item A sold on 10/01/07 = 5 kg
total item A sold in "JAN" = 10kg
- item A sold on 01/03/07 = 20 kg
total item A sold in "Mar" = 20kg
I did a query and it appear as below (in which I need the period as column)
Item Qty Period
A 10 2007-01
A 20 2007-03
The output I need is :
Item Jan Feb Mar
A 10 - 20
I've refer to the query posted in "Item History Query", even though I can get the column from Jan - Dec, but the total quantity for each month is not accurate. Please advise, and thanks for your time.
Cheers,
SereneHello Serene,
The Quantities will not be correct because you are using a Period Code in the Selection Criteria but it is not checked in the Select Statement.
But rewriting the code would cause duplicate entries for each item per months because of how the Group by clause works.
CHECK THIS
SELECT T1.ItemCode, T1.Dscription,
(SELECT SUM(QUANTITY) FROM INV1 WHERE MONTH(DOCDATE) = 1 AND ITEMCODE = T1.ItemCode AND DOCDATE >= T2.F_RefDate AND DOCDATE <= T_RefDate) AS 'JAN',
(SELECT SUM(QUANTITY) FROM INV1 WHERE MONTH(DOCDATE) = 2 AND ITEMCODE = T1.ItemCode AND DOCDATE >= T2.F_RefDate AND DOCDATE <= T_RefDate) AS 'FEB',
(SELECT SUM(QUANTITY) FROM INV1 WHERE MONTH(DOCDATE) = 3 AND ITEMCODE = T1.ItemCode AND DOCDATE >= T2.F_RefDate AND DOCDATE <= T_RefDate) AS 'MAR',
(SELECT SUM(QUANTITY) FROM INV1 WHERE MONTH(DOCDATE) = 4 AND ITEMCODE = T1.ItemCode AND DOCDATE >= T2.F_RefDate AND DOCDATE <= T_RefDate) AS 'APR',
(SELECT SUM(QUANTITY) FROM INV1 WHERE MONTH(DOCDATE) = 5 AND ITEMCODE = T1.ItemCode AND DOCDATE >= T2.F_RefDate AND DOCDATE <= T_RefDate) AS 'MAY',
(SELECT SUM(QUANTITY) FROM INV1 WHERE MONTH(DOCDATE) = 6 AND ITEMCODE = T1.ItemCode AND DOCDATE >= T2.F_RefDate AND DOCDATE <= T_RefDate) AS 'JUN',
(SELECT SUM(QUANTITY) FROM INV1 WHERE MONTH(DOCDATE) = 7 AND ITEMCODE = T1.ItemCode AND DOCDATE >= T2.F_RefDate AND DOCDATE <= T_RefDate) AS 'JUL',
(SELECT SUM(QUANTITY) FROM INV1 WHERE MONTH(DOCDATE) = 8 AND ITEMCODE = T1.ItemCode AND DOCDATE >= T2.F_RefDate AND DOCDATE <= T_RefDate) AS 'AUG',
(SELECT SUM(QUANTITY) FROM INV1 WHERE MONTH(DOCDATE) = 9 AND ITEMCODE = T1.ItemCode AND DOCDATE >= T2.F_RefDate AND DOCDATE <= T_RefDate) AS 'SEP',
(SELECT SUM(QUANTITY) FROM INV1 WHERE MONTH(DOCDATE) = 10 AND ITEMCODE = T1.ItemCode AND DOCDATE >= T2.F_RefDate AND DOCDATE <= T_RefDate) AS 'OCT',
(SELECT SUM(QUANTITY) FROM INV1 WHERE MONTH(DOCDATE) = 11 AND ITEMCODE = T1.ItemCode AND DOCDATE >= T2.F_RefDate AND DOCDATE <= T_RefDate) AS 'NOV',
(SELECT SUM(QUANTITY) FROM INV1 WHERE MONTH(DOCDATE) = 12 AND ITEMCODE = T1.ItemCode AND DOCDATE >= T2.F_RefDate AND DOCDATE <= T_RefDate) AS 'DEC',
(SELECT SUM(QUANTITY) FROM INV1 WHERE ITEMCODE = T1.ItemCode AND DOCDATE >= T2.F_RefDate AND DOCDATE <= T_RefDate) AS 'TOTAL'
FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OFPR T2 ON T0.FinncPriod = T2.AbsEntry
WHERE T0.CardName ='[%A]' AND T2.Code >='[%1]' AND T2.Code <='[%2]'
GROUP BY T1.ItemCode, T1.Dscription, T2.F_RefDate, T2.T_RefDate
The Only way out of this is to declare Variable and Assign the F_RefDate and T_RefDate and then use the variables in the Select Statements.
Suda -
How to convert BLOB data into string format.
Hi,
I have problem while converting blob data into string format.
for example,
Select dbms_lob.substr(c.shape.Get_wkb(),4000,1) from geotable c
will get me the first 4000 byte of BLOB .
When i using SQL as i did above,the max length is 4000, but i can get 32K using plsql as below:
declare
my_var CLOB;
BEGIN
for x in (Select X from T)
loop
my_var:=dbms_lob.substr(x.X,32767,1)
end loop
return my_var;
I comfortably convert 32k BLOB field to string.
My problem is how to convert blob to varchar having size more than 32K.
Please help me to resolve this,
Thanx in advance for the support,
NileshNilesh,
. . . .The result of get_wkb() will not be human readable (all values are encoded into some binary format).
SELECT utl_raw.cast_to_varchar2(tbl.geometry.get_wkt()) from FeatureTable tbl;
-- resulting string:
☺AW(⌂özßHAA
Å\(÷. . . .You may also want to have a look at { dbms_lob | http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_lob.htm#i1015792 } "The DBMS_LOB package provides subprograms to operate on BLOBs, CLOBs, NCLOBs, BFILEs, and temporary LOBs."
Regards,
Noel -
Import csv through SSIS package - format date column
Hello -
I need to import a csv file to SQL server using SSIS. The date column in excel is, for example, 7/8/2014, but it imports as 41828 in SQL Server. How can I convert this?
Any help will be greatly appreciated!Hi,
According to your descrition, date column convert to string data type column when import data from a csv file to SQL Server table. While you want the column still stores as date data type in SQL Server table.
In order to achieve this goal, there are several methods:
Add a Derived Column Transformation before the OLE DB Destination. Then add a derived column to replace the date column with the expression like bewlow to convert the column to date data type:
(DT_DBDATE)column_name
Add a Data Conversion Transformation before the OLE DB Destination.Then convert the date column to date[DT_DATE] data type. Use the new column as the destination column.
In the OLE DB Destination Editor, we can change the data type from varchar(50) to date when create a table as the destination.
If there are any other questions, please feel free to ask.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Problem in cut-paste data from a column in d2k forms to word file
Hello all,
Thanks for going through my problem. One of my clients is using a HP P-4 machine with Windows XP as OS. I have given them a D2k form for data entry having a multiple line column through a three-tier architectute on Apache web server. His problem is that he is not able to cut-paste the data entered in the multi-line column into a word file or vice-versa; whereas I am able to do the same from my machine or any other non-Xp machine. What might be the problem?
Regards
NJThis is usually caused by a security issue. Look for "Applet warning" in the browser status bar. If there is a warning you will not be able to copy and paste. It was also common when using the MS-JVM to run Forms. Try using the latest version of Jinitiator - 1.3.1.23
This can also be caused if the browser security settings are set too high.
In the future please be sure to provide more details. For example, Forms version, browser and its version, etc. -
How to create Tree format in Table Rn in one Column having data?
Hi Gurus,
i got the new requirement it's very interesting pl z help me...
My Requirement is i have one Table Rn in Table Rn having 5 columns There here one column name is 'Competencies ' That Competencies column having the more rows liki
FUNC.ADMIN.Achievement Orientation
FUNC.ADMIN.Administrative Assistance and Support
FUNC.ADMIN.Administrative(ADMIN)
This is one column data my Requirement is now
FUNC
+ADMIN
+Achievement Orientation
like clients are expecting pl z tell me how to approach in this requirement and what are prerequisites are needed ...plz help me it's urgent requirement.
Regards,
SriniHi Gyan,
Thank's for valuable suggestions
My Requirement is This ...
"Competencies" Table Layout: (InstTableLayout)
COMPETENCIES (COLUMN NAME)
BEHV.Generic.Communication(BEHV)
BEHV.Generic.Planning, Organizing & Time Management
BEHV.Generic.Problem Solving Ability
BEHV.Generic.Productivity
BEHV.Generic.Punctuality
like number of rows are there now Tree format is row data
like each column divided each one
ex:
+ BEHV
*|*
+Generic
*|*
+Communication(BEHV)
like he expected client in tree format pl z tell me how to approach in this requirement and what are the prerequisites are required .....
Regards,
Srini
Edited by: 876628 on Dec 1, 2011 8:37 PM
Edited by: 876628 on Dec 1, 2011 8:37 PM -
Comparing Converted Text To Date With Date Column
I have a query where I need to break out a text column into a date format and then compare that column against another column in the same table which is already date format. I tried using a sub query to avoid doing it in two steps, but get an:
'ORA 01858' a non numeric character was found where numeric was expected
error message which obviously has something to do with the formating of the date in the subquery: the types don't match.
Note: clock_num is a text column and contains numbers that are supposed to be dates like 070111 - hence the need for conversion into a date type to match the stat_date which is date column type. I do not have contol over the data in this column. It is not my table, it is the company's table and I must use it!
So my quesion is what syntax/function do I use to get the clock_nbr expression type to match the eff_date type.
Or is there a different way to go about doing the same thing without using the subquery?
Any assistance is appreciated..
SELECT
me.ssn,
FROM
member_enroll me
WHERE me.ssn = '999999999'
AND me.stat_date <
(SELECT to_date(substr(me.clock_num,1,2)||'/' || substr(me.clock_num,3,2)|| '/' ||substr(me.clock_num,5,2),'mm-dd-yy') as clock_nbr
FROM member_enroll me
WHERE me.ssn = '999999999')user12296489 wrote:
I wasn't assuming that all the dates were correct. But that is where I made the error. But the reason I didn't see the error was that I didn't know if the way I had the substr function set up with the subquery was correct. I thought that was the problem and so wanted to make sure that was correct before I moved on. As I pointed out, there is a much simpler way to convert the string to a date using a format mask that matches the string data rather than parsing the data using SUBSTR and converting it to a different format before calling TO_DATE.
It turns out that the reason you posted your function was actually what was holding it up. I had forgotten to include enough criteria in the subquery to return only the 1 record that had a valid clock_num. Once I did that, the query worked - without your function.Just be aware that though it works today, it may not work tomorrow when the query plan changes.
So, now, onto the issue that you brought up, I don't know how to integrate that function you posted into my query. I have no knowledge of creating functions in pl/sql. I tried placing it before the query and it ran but returned no records You need to create the function once whereas you would run the query many times. I'm not sure what application you're using to interact with the database. If you run just the CREATE FUNCTION DDL statement, does that work? If you're using SQL*Plus, you'd see something like this with the "Function created." feedback.
SQL> CREATE OR REPLACE FUNCTION my_to_date( p_str IN VARCHAR2 )
2 RETURN DATE
3 IS
4 l_date DATE;
5 BEGIN
6 BEGIN
7 l_date := to_date( p_str, 'MMDDYY' );
8 EXCEPTION
9 WHEN OTHERS THEN
10 l_date := null;
11 END;
12
13 RETURN l_date;
14 END;
15 /
Function created.>
Here is what I did. It doesn't error out. It says 'done in 0.156 seconds', but no records are returned. when I replace the function you gave (and rem out your function) with the to_date function, it returns 1 record. If I don't rem out your function and use the to_date function, it runs, but again, no records are returned.
select me.subs_ssn,
me.clock_num,
my_to_date(mbr02.mbr02_clock_num) as clock_num
from odw.mbr02_member_enroll_info mbr02
where mbr02.mbr02_subs_ssn = '999999999'
and mbr02.mbr02_grp_id = '00000'If you only have the function call in the SELECT list, the presence or absence of the function cannot possibly change the number of rows that are returned. So if your description is of the behavior of this particular query, something is very wrong. It is possible that the CLOCK_NUM column could be NULL if the MBR02_CLOCK_NUM column is in an invalid format. But the other two columns would have to be populated here if they are populated when you simply remove the call to the function.
Justin -
Problem in converting Spool to PDF file, having non-English characters
Hi All,
I have problem in converting Spool to PDF format.
Scenario : I have a spool which has non-English characters. I am using CONVERT_ABAPSPOOLJOB_2_PDF FM to perform conversion. But my output is having junk values( ie # ) for non-English characters. Any pointers to solve this issue will be appreciated.
I even tried with report RSTXPDFT4 , it also gives me the same junk characters.
Regards,
Navin.Hi All,
I have problem in converting Spool to PDF format.
Scenario : I have a spool which has non-English characters. I am using CONVERT_ABAPSPOOLJOB_2_PDF FM to perform conversion. But my output is having junk values( ie # ) for non-English characters. Any pointers to solve this issue will be appreciated.
I even tried with report RSTXPDFT4 , it also gives me the same junk characters.
Regards,
Navin.
Maybe you are looking for
-
How to add a mm-dd-yyyy date field type in a Planning Data Form
Hi John, pls, I have one question regarding the possibility of adding a date field type for example 03-03-2009 in a cell of Planning Data Form application. for example, I created: - 2 members in Period dimension: StartProject and EndProject and I nee
-
Modifying Primative shapes in Illustrator CS4
Hi I know you can change the properties of primitive shapes (star, polygon, rounded rectangle etc) using the left, right, up and down arrows as well as Ctrl and Alt. However, these settings change the default of the tool for the next time you draw a
-
I am not able to publish my site to a test site. I get this message: The account (my email address) does not have privileges to create an Adobe Business Catalyst temporary site. Please contact the sit eadministrator. This is a new site so there is no
-
I recently updated my iphone software and now I can't upload photos from iphone to mac computer. Help please.
-
Hdv export wrong format on a .mov file.
i've set up a hdv project and both the easy setup and sequense settings says : hcv 1080i50 1440x1080. But when I export using quicktime conversion with any codec and setup(allmost) I get a.mov file with a streched format. why is that I ask. dual 2.5