Change Col datatype to Date from Number
Hi all,
I have a table storing date in 'YYYYMMDD' Format and the dataype of the column is NUMBER. Now how can I convert this column datatype into DATE in DD-MON-YY. Any help would be highly apreciated.
Regards,
firstly dates are stored in oracle date format. DD-MON-YYY is just a format specifier for display and manipluation.
i) Add a column to your table new_date as date datatype.
ii) update this new_column with the values in your number column
eg
update <tablename?
set <new_column> = to_date(<number_column>,'YYYYMMDD');iii) commit the transaction.
iv) drop the old number column
v) rename the new date_column to the old_number column.
Do this on a non-production server first
Added production server warning
Message was edited by:
Keith Jamieson
Similar Messages
-
Hi Friends,
I am getting this error : ORA-00932: inconsistent datatypes: expected DATE got NUMBER at OCI call OCIStmtExecute when I am trying to put the filter condition on the date column.
"Dim-Time"."Day" <= cast(MAX("Dim-Time"."Day") as date) and "Dim-Time"."Day" >= TIMESTAMPADD(SQL_TSI_MONTH, -1,cast(MAX("Dim-Time"."Day") as date).
I have casted the max date but though I am getting the above error. I am thinking max(date) is creating the problem.
Please suggest your on opinion this.
Thanks.Not sure why you need cast in your statement if at all it is required then you need to do as below
cast("Dim-Time"."Day" as date)<= cast(MAX("Dim-Time"."Day") as date) and cast("Dim-Time"."Day" as date) >= TIMESTAMPADD(SQL_TSI_MONTH, -1,cast(MAX("Dim-Time"."Day") as date).
~ http://cool-bi.com -
ORA-00932: inconsistent datatypes: expected DATE got NUMBER --TO_DATE()
ORA-00932: inconsistent datatypes: expected DATE got NUMBER
ORA-06512: at "BDSN.GENERAL", line 272
ORA-06512: at line 73
i have fec_alta="10/10/2007" and hor_alta="15:00:00"
and i am converting to DATE with the TO_DATE function
but when inserting i am having this error ORA-00932
is
fmodif DATE;
fmodif:=TO_DATE(fec_alta||' '||hor_alta,'DD/MM/YYYY HH24:MI:ss');
str:= 'insert into '||v_table||'(AF_NUM_IDENTIF,AF_NUM_ALIAS,AF_TIPO_REGISTRO,AF_NUMBRD,AF_FALTA,AF_COD_USU_A,AF_FMODIF,AF_COD_USU_M,AF_MOTIVO,AF_CONDUCTA,AF_TIPO,AF_NUMSERIE,AF_NUMSERIE_SIMPL,AF_NUMSERIE_FON,AF_MARCA,AF_MODELO,AF_MODELO_SIMPL,AF_CALIBRE,AF_ORG_REC,AF_ENT_INT,AF_TIPO_DOC_ORIG_A,AF_FECHA_DOC_ORIG_A,AF_PROC_JUDICIAL,AF_APROCJUD,AF_REF_POLI,AF_OBSV,AF_NUMBRD_BDSN,AF_FEXPIR,AF_RFID,AF_FOTO,AF_GRUPO) values ( '||num_identif||' , '||num_alias||' , '||tipo_registro||' , 0 , sysdate , '||cod_usu_a||' , '||fmodif||', '||cod_usu_m||' , '||motivo||' , '||conducta||' , '||tipo||' , '||numserie||' , '||numserie_simpl||' , '||numserie_fon||' , '||marca||' , '||modelo||' , '||modelo_simpl||' , '||calibre||' , '||org_rec||' , '||ent_int||' , '||tipo_doc||' , sysdate , '||proc_jud||' , '||aprocjud||' , '||ref_pol||' , '||obsv||' , '||numbrd_bdsn||' , sysdate , ''N'' , ''N'' , ''N'' )';
execute immediate str;
thanksInvalid Month error in PL/SQL
¿what is fec_alta? I suppose is a type date
Modify
fmodif:=TO_DATE(fec_alta||' '||hor_alta,'DD/MM/YYYY HH24:MI:ss');
For
fmodif:=TO_DATE( to_char(fec_alta, 'DD/MM/YYYY') ||' '||hor_alta,'DD/MM/YYYY HH24:MI:ss'); -
Change Value While Uploading data From Excel File
Dear Expert,
Please guide me is it Possible?, if yes then How?
We have one BDC Uploader there After uploading data from Excel File, i want to check one field like this....
if it_f65data-newbs contains any Alphabet.
then user Should be able to change value on the same time while executing Program in table.
Please tell me how i can change value in running program
Regards'
Shelly MalikHi,
What you can probably do is, perform a consistency check on your data in the internal table and segregate all those rows that have inconsistent data (in your case, the field NEWBS containing albhabets) into another temporary internal table. Display the temporary internal table in an editable ALV grid saying that these data have not been inserted to the database, coz they have inconsistent data in the field NEWBS. Allow the user to edit and then save the data which will consequently refresh the internal table contents. -
Send changes of Artical master data from sap to nonsap (idoc outbound prog)
Hi Experts,
I am new to interfaces
I have one requirement in Idocs, i.e the changes of artical master data is send to sap to nonsap system through idoc.
idoc type is ARTMAS05, msg typ is ARTMAS.
I am giving some information for my object.
For article (MATNR) by site (WERKS plant)
If MRP Type (MARC-DISMM) = u201CX0u201D
Then if changes to fields:
MARC-KZAUS Discontinuation ind.
MARC-AUSDT Effective date out
MARC-NFMAT Follow-up article
Then send idoc type ARTMAS05 with the following data
segment E1BPE1MATHEAD
MATERIAL
segment E1BPE1MARCRT
MATERIAL PLANT DISCONTINU
EFF_O_DAY FOLLOW_UP
Systems Referred to:
The planning system for our client is nonsap system. This software requires to be informed of relevant changes on articles in order to start its planning runs. When an article is superseded by another we have to send the replacement article (if any) as well as the discontinuation date.
Dependencies/Prerequisites :
Change pointers for Article master active
Change pointers active for fields:
MARC-KZAUS Discontinuation indicator
MARC-AUSDT Effective date out
MARC-NFMAT Follow-up article
Idoc ARTMAS05 required with reduction in order to only send relevant fields
Filter to only send idocs for materials in the u201CAutomotiveu201D type where MARC-DISMM = u201CX0u201D.
So this is my requirement, please send some sample code or idea how to complete object.
with regards,
gs reddy.Hi,
All the details mentioned seems to be correct.
just change one "automotive" material and check change documents are getting generated.
i hope partner profiles are already in place.
once change docuements are inpalce check RBDMIDOC program is scheduled in back ground or you can manually execute the program for testing.
and check the IDoc generated.
do you want supress some segements?
di your NOn-sap ssytem can accept Idoc?
Suresh -
How do i change datatype to text from number from an excel input file
I have a simple 2 column excel spreadsheet with 29k rows.
The 1st column does contain numbers, but are really text and not to be treated as number, so i selected format cells/text and then saved the file as an excel .xls file.
However whenever i use this data source in crystal, the 1st column/field is always datatype number, and i do not see the text type fields, even if i create a formula totext(datafield)
.How, or what can i do to the original data source to see both columns as text in crystal ? i have tried saving as .csv.
i have crystal 12.3.0.601 sp3Hi John,
In Excel if first value i.e. first record value is a number (even though you format as text) it will consider as number. So, try to make your first record in excel as text field.
Example :
123-- takes as number
'123-- try this --start with a single quote and followed by number.
or
A123--This will make this filed as text.
Thanks,
Sastry -
Using AppleScript To Pull Data From Number & Create Calendar Events
Today I tried running an AppleScript that I created a few years back that works with Number ’09 [version 2.3 (554)]. The script collects information from the active numbers table and creats an event in my calendar for each row of data in the table. For some reason its not working with the current version of number.
Here is the script:
on run
set cr to ASCII character 13
set newline to return
local dName, sName, tName, rowCount, workingCalendar, maintenanceType
-- get general document information like document name, active sheet name, active table name & the number of rows in the active sheet
set {dName, sName, tName, rowCount} to my get_document_information()
-- get information needed to update a calendar in the calendar application like the calendar that needs to be updated and the type of maintenance that will be completed
set {workingCalendar, maintenanceType} to my get_calendar_update_information()
-- update calendar maintenance type so the computer can say it
if maintenanceType = "add" then
set maintenanceTypeChanged to maintenanceType & "ed"
set lastpartofsentence to "to calendar"
else if maintenanceType = "update" then
set maintenanceTypeChanged to maintenanceType & "d"
set lastpartofsentence to "in calendar"
else if maintenanceType = "delete" then
set maintenanceTypeChanged to maintenanceType & "d"
set lastpartofsentence to "from calendar"
end if
say "Events will be" & maintenanceTypeChanged & lastpartofsentence & workingCalendar
--determine if calendar already exists. If it does not create it
tell application "Calendar"
set allCalendarTitles to the title of every calendar
if allCalendarTitles contains workingCalendar then
--do nothing
else
create calendar with name workingCalendar
end if
end tell
set timedifferance to 4
-- get event information for each row in active table
say "table name is " & tName
repeat with rownumber from 1 to rowCount
tell application "Numbers" to tell row rownumber of tName to set {cell04, cell05, cell06, cell07, cell08, cell09, cell10} to {value of cell 4, value of cell 5, value of cell 6, value of cell 7, value of cell 8, value of cell 9, value of cell 10}
set cell07 to SearchReplace(cell07, "|", newline)
tell application "Calendar"
activate
if maintenanceType = "Delete" then
tell calendar workingCalendar to delete (first event whose summary contains cell04 and start date is equal to (cell05 + (timedifferance * hours)))
end if
if maintenanceType = "Update" then
tell calendar workingCalendar to delete (first event whose summary contains cell04 and start date is equal to (cell05 + (timedifferance * hours)))
tell calendar workingCalendar to set test to make new event at the beginning of events with properties {start date:cell05 + (timedifferance * hours), end date:cell06 + (timedifferance * hours), description:cell07, summary:cell04, location:cell10}
end if
if maintenanceType = "Add" then
tell calendar workingCalendar to set test to make new event at the beginning of events with properties {start date:cell05 + (timedifferance * hours), end date:cell06 + (timedifferance * hours), description:cell07, summary:cell04, location:cell10}
end if
end tell
end repeat
say "Events have been " & maintenanceTypeChanged
end run
on get_document_information()
-- Get general document information for later use
local d_name, s_name, selectedTable, t_name, row_count
tell application "Numbers" to tell document 1
-- get document name
set d_name to name
-- get sheet name
set s_name to name of active sheet
-- get table name
tell active sheet
set the selectedTable to (the first table whose class of selection range is range)
end tell
tell selectedTable
set t_name to name
set row_count to row count
end tell
return {d_name, s_name, t_name, row_count}
end tell
end get_document_information
on get_calendar_update_information()
local strCalendarToWorkWith, strMaintenanceType
tell application "Numbers"
activate
tell document 1 to tell sheet "General Information" to tell table "Table 1"
copy value of cell "C9" to strCalenderToWorkWith
copy value of cell "C12" to strMaintenanceType
end tell
return {strCalenderToWorkWith, strMaintenanceType}
end tell
end get_calendar_update_information
on SearchReplace(sourceStr, searchString, replaceString)
-- replace <searchString> with <replaceString> in <sourceStr>
-- return SearchReplace(theString, ".", "<PERIOD>")
set searchStr to (searchString as text)
set replaceStr to (replaceString as text)
set sourceStr to (sourceStr as text)
set saveDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to (searchString)
set theList to (every text item of sourceStr)
set AppleScript's text item delimiters to (replaceString)
set theString to theList as string
set AppleScript's text item delimiters to saveDelims
return theString
end SearchReplace
When running the script in the current version of Numbers [version 3.2 (1861)] I receive the following error message:
Here is what the table looks like:
Can anyone help me correct this error/issue?
Thank you,
BrianThe error ocurs right after it speaks the table name? The error is highlighting the suspect line in the first screenshot.
I think the "T" in the error is coming from the Table name, so try replacing the line in question with this mess
tell application "Numbers"
tell document 1
tell active sheet
tell table tName
set {cell04, cell05, cell06, cell07, cell08, cell09, cell10} to {value of cell 4, value of cell 5, value of cell 6, value of cell 7, value of cell 8, value of cell 9, value of cell 10}
end tell
end tell
end tell
end tell
NB original was
tell application "Numbers" to tell row rownumber of tName to set {cell04, cell05,cell06, cell07, cell08, cell09, cell10} to {value of cell 4, value of cell5, value of cell 6, value of cell 7, value of cell 8, value of cell 9,value of cell 10}
I don't know Numbers & Applescripting so you'll probably need to work on it some more, I gleaned the 'tell document & tell active sheet, tell table' from the script near the bottom.
http://www.macosxautomation.com/applescript/iwork/numbers/table-populate.html
It's a little unclear to me where the 'get document' info comes from, since you are not telling Numbers within that part. -
Updating master data from WEB UI
Hi experts,
Is it possible to change the partner attributes such as e-mail, box no, phone, etc from CRM WEB UI?
I am planning to create an admin to where he can change the partner details in WEB UI. My assumption is the master data/attributes of partner cannot be change in CRM except in HR system. what could be posible. what not. Please suggest me the best.
Thanks
ChandHi Chand,
I am not an expert. But will contribute to your question.
You can use the transaction Launcher concept to tie the transaction of changing the HR Master Data with CRM Web UI. Using this you will be able to call the call the transaction in SAP ECC to change the HR master data from CRM Web UI. Assign this to the required navigation bar profile. This will resolve your issue.
Thanks,
Ravi G -
Create a change request for multiple customers from spreadsheet
Hello Experts,
1.We have a spreadsheet with 100's of Customer data maintained in it , can we create a change request by downloading data from spreadsheet directly instead of manually entering the data in the CR. Also can we create a single change request for multiple Create customers.
2.Can we create CR's automatically , lets say we have 100's of customer data loaded into MDG hub by Data Services using DEBMAS Idoc , can this create automatic CR's , is this possible.
Thanks.Dear Collins,
1.We have a spreadsheet with 100's of Customer data maintained in it , can we create a change request by downloading data from spreadsheet directly instead of manually entering the data in the CR. Also can we create a single change request for multiple Create customers.
Answer:there are various options are available in MDG to process multiple material as shown below
you can down load the customers using file down load funcationality and same change,upload the customers using the file Upload process.
you can create a single CR for muntiple customers options are shown below.
2..Can we create CR's automatically , lets say we have 100's of customer data loaded into MDG hub by Data Services using DEBMAS Idoc , can this create automatic CR's , is this possible.
Answer:Yes you can create CR automatically using DTIMPORT tcode and some configuration needs to be done further reading go to the link SAP Master Data Governance - SAP Library
regards
shankar -
Verizon Changed Our Pre-Order Date
Verizon CHANGED the pre-order date from our original 09/19 confirmation at checkout. Our email confirmation shows 10/07 WHY? What was the point in staying up to 3:AM? We could have went to Apple's site but chose Verizon because of the date of arrival. This is what happens when you're a customer for years.
Apparently, thousands
Sorry, that's not the point. It you're spending money on phone, AND renewing a contract for the umpteenth time, then we at least need answers. You don't pre-order an item , only to have the date changed without even a warning that this may occur. Whether it be a $20.00 or a $400 one.
We can also be quiet about it and accept whatever companies throw our way. No thanks. -
Change column datatype from varchar2 to number(10) and keep existing data
Hi,
I need to change the datatype on a column that already has data in it from a varchar2 to number(10). The data that is already there is not necessarily number data, however I must be able to keep the old data to. We are running 10g. Does anyone have any ideas? Thanks. Here's the current data.
Current Values for From_Value
T
U
T2
K
M
A
T
T1
O
E
S
NSTU
4Example of keeping the data in the current column and adding a new numeric column for numeric data:
SQL> drop table t purge;
Table dropped.
SQL> create table t(i int, x varchar2(10));
Table created.
SQL> insert into t values(1, 'T1');
1 row created.
SQL> insert into t values(2, 2);
1 row created.
SQL> --
SQL> alter table t add (xn number);
Table altered.
SQL> --
SQL> begin
2 for c in (select i, x from t)
3 loop
4 begin
5 update t set xn = to_number(c.x) where i = c.i;
6 exception
7 when invalid_number then null;
8 end;
9 end loop;
10 end;
11 /
PL/SQL procedure successfully completed.
SQL> show errors
No errors.
SQL> select * from t;
I X XN
1 T1
2 2 2 -
Change data type from number(11,6) to number (11,8)
I have a table, which has a million records...I have to change data type of some of the columns from number (11,6) to number (11,8).
I thought of taking the backup of the table , truncating the original table, change the data type and then insert data back.
Is it a safe option considering so many records ?the first number is precision and the second is scale:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14196/schema002.htm#sthref472
so yes, 11,6 can hold larger numbers than 11,8
create table foobar (two number(5,2),
three number(5,3))
insert into foobar values (123.45,12.345);
--works fine
insert into foobar values (123.45,123.45);
--gives error ORA-01438: value larger than specified precision allowed for this column -
Variablize the datatypes in the select of data from XML to Oracle
Hi All,
I'm new to XML to Oracle data integration. I do have clob column that has the XML data and trying to bring it into the Oracle relational tables, as a part of it we are developing PL/SQL procedure that calls this CLOB column, I want to know if we can variablize the data types ( Just like tablename.columnname%type) in the select of the XML data:
select v.instrid, v.endtoendid, v.txid, v.cd, v.ccy,
replace(v.intrbksttlmamt,'.',',') as intrbksttlmamt, v.chrgbr, v.bic1, v.nm1, v.adrline11, v.adrline12, v.ctry1, v.iban1,
v.bic2, v.bic3, v.nm2, v.adrline21, v.adrline22, v.ctry2, v.iban2, v.cdtrref, v.addtlrmtinf
from the_data w,
xmltable(xmlnamespaces(default 'urn:iso:std:iso:20022:tech:xsd:pacs.008.001.01'),
'/Document/pacs.008.001.01/CdtTrfTxInf'
passing xmltype(w.the_column)
columns instrid varchar2(300) path 'PmtId/InstrId',
endtoendid varchar2(150) path 'PmtId/EndToEndId',
txid varchar2(200) path 'PmtId/TxId',
cd varchar2(50) path 'PmtTpInf/SvcLvl/Cd',
) v
As you see above in the bold I do define the data types after every column name , the problem is incase there is change in datatype I do need to manually edit the procedure to change the datatype is there a way I can variablize them something like tablename.columname%type.
Any answers are greatly appreciated.Two questions:
1. Does your database have a version number?
SELECT * FROM v$version;2. Why are you storing XML in a CLOB column rather than one of XMLType? -
How to fetch data from CDHDR Table based on Order Number
Hi,
I need to fetch the data from CDHDR just based on the Order number .I found there is a field called 'OBJECTID' in table 'CDHDR'. But the last part of OBJECTID contains order number.suppose my order number is 90506210 the objectid field contains '51030000090506210'.510 is login client,don't know what 30 is and last part is order number i.e 000090506210.i have to concatenate all and fetch data .i can do it for one order number but here order number is declared as select-options.how do i ?
HERE IS THE CODE FOR ONE ORDER NUMBER.HOW CAN DO FOR RANGE OF ORDER NUMBERS.
PARAMETER : S_OBJECT FOR /BEV1/RBVBAK-AUFNR OBLIGATORY.
DATA : IT_CDHDR TYPE STANDARD TABLE OF CDHDR WITH HEADER LINE,
WA_CDHDR LIKE LINE OF IT_CDHDR,
S_OBJECT1 LIKE CDHDR-OBJECTID.
CONCATENATE sy-mandt '30' S_OBJECT INTO S_OBJECT1.
SELECT * FROM CDHDR INTO TABLE IT_CDHDR WHERE OBJECTID = S_OBJECT1.P838355 wrote:>
> Hi,
> I need to fetch the data from CDHDR just based on the Order number .I found there is a field called 'OBJECTID' in table 'CDHDR'. But the last part of OBJECTID contains order number.suppose my order number is 90506210 the objectid field contains '51030000090506210'.510 is login client,don't know what 30 is and last part is order number i.e 000090506210.i have to concatenate all and fetch data .i can do it for one order number but here order number is declared as select-options.how do i ?
>
> HERE IS THE CODE FOR ONE ORDER NUMBER.HOW CAN DO FOR RANGE OF ORDER NUMBERS.
>
>
> PARAMETER : S_OBJECT FOR /BEV1/RBVBAK-AUFNR OBLIGATORY.
>
> DATA : IT_CDHDR TYPE STANDARD TABLE OF CDHDR WITH HEADER LINE,
> WA_CDHDR LIKE LINE OF IT_CDHDR,
> S_OBJECT1 LIKE CDHDR-OBJECTID.
>
> CONCATENATE sy-mandt '30' S_OBJECT INTO S_OBJECT1.
>
> SELECT * FROM CDHDR INTO TABLE IT_CDHDR WHERE OBJECTID = S_OBJECT1.
You need to loop through the select option and concatenate with required data then select using 'in' instead of equal or select one by one.
or
select sales order numbers from VBAK for the selection into internal table then loop through the internal table and concatenate then select from CDHDR.
for better performance use objectclass in where clause. the value for sales order for objectclass is VERKBELEG.
in my system the object id is just an order number there is no other additions to it but in CDPOS the tabkey contains the order number with client and other information also.
the 30 may be your item number... check it
go ahead and change sales order and see what you can find in CDHDR
Good luck
Edited by: Sampath Kumar on Oct 21, 2009 9:02 AM -
How do you Change time from number format(ie. 3.50 hours) to regular time format( ie.3:30)
I performed the following function in order to get my report to view the information the way that I wanted to see it:
put this formula across from the caption âu20ACu0153Display Stringâu20AC within the âu20ACu0153Format Fieldâu20AC window for description.Â
whileprintingrecords;
MonthName(tonumber(Mid({CartonHistory.DateTimeStamp},5,2)),true) & Mid({CartonHistory.DateTimeStamp},7,2) & ", " & Mid({CartonHistory.DateTimeStamp},1,4)Â & " " & Mid({CartonHistory.DateTimeStamp},9,2) & ":" & Mid({CartonHistory.DateTimeStamp},11,2) & "." & Mid({CartonHistory.DateTimeStamp},13,2)
It converts dates from: 20061212102311xx to: Dec12, 2006 10:23.11.
Maybe you are looking for
-
Crash report aplication what is that ? When shut the computer this Message appeared The application crash repórter Dont Let shut down the computer
-
How to register the same schema with same URL
I'm getting ORA-31085 error when try to register the same schema with same URl. My requirement is that I should be able to reregister the same schema with the same URL . I'm using the following function : PROCEDURE validateXmlSchema(inp_xmlMsg IN VAR
-
I have a wireless HP printer and I am hooked up to the network set up by ATT but the printer is not responding. What do I do?
-
Hi there, I have a straight forward form in that requires the user to enter a date in one box and then a script automatically fills in a second box with an new date 10 day further on. The script I'm using is var strStart = this.getField("DateStart1")
-
Hi! Oas 9.0.4. We load files on WEBDAV . In table wwdoc_document$, last_updated is correct time. OS RH3, time is correct. on client webdav time is not correct, it is more on +12 hours, Thank, Natali.