How to update precision value in number datatype
hello all
i hava a database containing data in that there is a table which contan a number datatype
that is number(10)
the table contain large amount of data
now i need the precision value 2
that is number(10,2)
how i can update is
i try alter command the do this bu the error is there the table contain data
so please suggest the solution
thanks in advance
The number of columsn has nothing to do with it. The number of rows has nothing to do with it.
Here is a step-by-step example to address your problem. I will change DATA_OBJECT_ID from NUMBER to NUMBER(10,2) even though there are thousands of rows in the table, the column is "in the middle " of the table, and there are many rows with non-null values in that column.
07:02:43 > create table t3 as select * from all_objects;
Table created.
Elapsed: 00:00:06.22
07:04:08 > desc t3
Name Null? Type
OWNER NOT NULL VARCHAR2(30)
OBJECT_NAME NOT NULL VARCHAR2(30)
SUBOBJECT_NAME VARCHAR2(30)
OBJECT_ID NOT NULL NUMBER
DATA_OBJECT_ID NUMBER
OBJECT_TYPE VARCHAR2(19)
CREATED NOT NULL DATE
LAST_DDL_TIME NOT NULL DATE
TIMESTAMP VARCHAR2(19)
STATUS VARCHAR2(7)
TEMPORARY VARCHAR2(1)
GENERATED VARCHAR2(1)
SECONDARY VARCHAR2(1)
NAMESPACE NOT NULL NUMBER
EDITION_NAME VARCHAR2(30)
07:04:12 > alter table t3 modify (data_object_id number(10));
alter table t3 modify (data_object_id number(10))
ERROR at line 1:
ORA-01440: column to be modified must be empty to decrease precision or scale
Elapsed: 00:00:00.98
07:08:05 > select count(*), min(data_object_id), max(data_object_id), count(distinct data_object_id), count(data_object_id)
07:09:06 2 from t3;
COUNT(*) MIN(DATA_OBJECT_ID) MAX(DATA_OBJECT_ID) COUNT(DISTINCTDATA_OBJECT_ID) COUNT(DATA_OBJECT_ID)
184456 0 1526320 12225 70092
1 row selected.
Elapsed: 00:00:00.11
07:09:41 > alter table t3 add (temp_data_object_id number(10,2));
Table altered.
Elapsed: 00:00:00.07
07:10:27 > update t3 set temp_data_object_id = data_object_id, data_object_id = null;
184456 rows updated.
Elapsed: 00:00:04.49Notice that our column of interest is now entirely null, so the restriction against reducing its scale or precision will not longer impact us.
07:11:00 >
07:11:17 > select count(*), min(data_object_id), max(data_object_id), count(distinct data_object_id), count(data_object_id) from t3;
COUNT(*) MIN(DATA_OBJECT_ID) MAX(DATA_OBJECT_ID) COUNT(DISTINCTDATA_OBJECT_ID) COUNT(DATA_OBJECT_ID)
184456 0 0
1 row selected.
Elapsed: 00:00:00.04
07:11:51 > alter table t3 modify (data_object_id number(10,2))
07:12:33 > /
Table altered.
Elapsed: 00:00:00.07
07:12:35 > update t3 set data_object_id=temp_data_object_id;
184456 rows updated.
Elapsed: 00:00:04.01
07:14:40 > select count(*), min(data_object_id), max(data_object_id), count(distinct data_object_id), count(data_object_id) from t3;
COUNT(*) MIN(DATA_OBJECT_ID) MAX(DATA_OBJECT_ID) COUNT(DISTINCTDATA_OBJECT_ID) COUNT(DATA_OBJECT_ID)
184456 0 1526320 12225 70092
1 row selected.
Elapsed: 00:00:00.09
07:14:49 > alter table t3 drop column temp_data_object_id;
Table altered.
Elapsed: 00:00:02.40
07:15:11 > desc t3
Name Null? Type
OWNER NOT NULL VARCHAR2(30)
OBJECT_NAME NOT NULL VARCHAR2(30)
SUBOBJECT_NAME VARCHAR2(30)
OBJECT_ID NOT NULL NUMBER
DATA_OBJECT_ID NUMBER(10,2)
OBJECT_TYPE VARCHAR2(19)
CREATED NOT NULL DATE
LAST_DDL_TIME NOT NULL DATE
TIMESTAMP VARCHAR2(19)
STATUS VARCHAR2(7)
TEMPORARY VARCHAR2(1)
GENERATED VARCHAR2(1)
SECONDARY VARCHAR2(1)
NAMESPACE NOT NULL NUMBER
EDITION_NAME VARCHAR2(30)
07:15:15 >
Similar Messages
-
How to update field values in a database table using module pool prg?
hi
how to update field values in a database table using module pool prg?
we created a customized table, and we put 2 push buttons in screen painter update and display.
but update is not working?
data is enter into screen fields and to internal table, but it is not updated in database table.
thanks in adv
vidyaHI,
we already used the update statement. but its not working.
plz check this.
*& Module Pool ZCUST_CALL_REC
PROGRAM ZCUST_CALL_REC.
TABLES: ZCUST_CALL_REC,ZREMARKS.
data: v_kun_low like ZCUST_CALL_REC-kunnr ,
v_kun_high like ZCUST_CALL_REC-kunnr,
v_bud_low like ZCUST_CALL_REC-budat,
v_bud_high like ZCUST_CALL_REC-budat.
ranges r_kunnr for ZCUST_CALL_REC-kunnr .
ranges r_budat for zcust_call_rec-budat.
DATA: ITAB TYPE STANDARD TABLE OF ZCUST_CALL_REC WITH HEADER LINE,
JTAB TYPE STANDARD TABLE OF ZREMARKS WITH HEADER LINE.
*data:begin of itab occurs 0,
MANDT LIKE ZCUST_CALL_REC-MANDT,
kunnr like ZCUST_CALL_REC-kunnr,
budat like ZCUST_CALL_REC-budat,
code like ZCUST_CALL_REC-code,
remarks like ZCUST_CALL_REC-remarks,
end of itab.
*data:begin of Jtab occurs 0,
MANDT LIKE ZCUST_CALL_REC-MANDT,
kunnr like ZCUST_CALL_REC-kunnr,
budat like ZCUST_CALL_REC-budat,
code like ZCUST_CALL_REC-code,
remarks like ZCUST_CALL_REC-remarks,
end of Jtab.
CONTROLS:vcontrol TYPE TABLEVIEW USING SCREEN '9001'.
CONTROLS:vcontrol1 TYPE TABLEVIEW USING SCREEN '9002'.
*start-of-selection.
*& Module USER_COMMAND_9000 INPUT
text
MODULE USER_COMMAND_9000 INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
SET SCREEN 0.
LEAVE SCREEN.
CLEAR sy-ucomm.
WHEN 'ENQUIRY'.
perform multiple_selection.
perform append_CUSTOMER_code.
PERFORM SELECT_DATA.
call screen '9001'.
WHEN 'UPDATE'.
perform append_CUSTOMER_code.
PERFORM SELECT_DATA.
call screen '9002'.
perform update on commit.
WHEN 'DELETE'.
perform append_CUSTOMER_code.
PERFORM SELECT_DATA.
call screen '9002'.
ENDCASE.
ENDMODULE. " USER_COMMAND_9000 INPUT
*& Module STATUS_9000 OUTPUT
text
MODULE STATUS_9000 OUTPUT.
SET PF-STATUS 'ZCUSTOMER'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_9000 OUTPUT
*& Module USER_COMMAND_9001 INPUT
text
MODULE USER_COMMAND_9001 INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
SET SCREEN 0.
LEAVE SCREEN.
CLEAR sy-ucomm.
endcase.
ENDMODULE. " USER_COMMAND_9001 INPUT
*& Module STATUS_9001 OUTPUT
text
MODULE STATUS_9001 OUTPUT.
SET PF-STATUS 'ZCUSTOMER'.
SET TITLEBAR 'xxx'.
move itab-MANDT to zcust_call_rec-MANDT.
move itab-kunnr to zcust_call_rec-kunnr.
move itab-budat to zcust_call_rec-budat.
move itab-code to zcust_call_rec-code.
move itab-remarks to zcust_call_rec-remarks.
vcontrol-lines = sy-dbcnt.
ENDMODULE. " STATUS_9001 OUTPUT
*& Module USER_COMMAND_9002 INPUT
text
module USER_COMMAND_9002 input.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
SET SCREEN 0.
LEAVE SCREEN.
CLEAR sy-ucomm.
WHEN 'UPDATE'.
perform move_data.
UPDATE ZCUST_CALL_REC FROM TABLE ITAB.
IF SY-SUBRC = 0.
MESSAGE I000(0) WITH 'RECORDS ARE UPDATED'.
ELSE.
MESSAGE E001(0) WITH 'RECORDS ARE NOT UPDATED'.
ENDIF.
WHEN 'DELETE'.
perform move_data.
DELETE ZCUST_CALL_REC FROM TABLE ITAB.
IF SY-SUBRC = 0.
MESSAGE I000(0) WITH 'RECORDS ARE DELETED'.
ELSE.
MESSAGE E001(0) WITH 'RECORDS ARE NOT DELETED'.
ENDIF.
endcase.
endmodule. " USER_COMMAND_9002 INPUT
*& Module STATUS_9002 OUTPUT
text
module STATUS_9002 output.
SET PF-STATUS 'ZCUSTOMER1'.
SET TITLEBAR 'xxx'.
endmodule. " STATUS_9002 OUTPUT
*& Module update_table OUTPUT
text
module update_table output.
move itab-MANDT to zcust_call_rec-MANDT.
move itab-kunnr to zcust_call_rec-kunnr.
move itab-budat to zcust_call_rec-budat.
move itab-code to zcust_call_rec-code.
move itab-remarks to zcust_call_rec-remarks.
vcontrol-lines = sy-dbcnt.
endmodule. " update_table OUTPUT
***Selection Data
FORM SELECT_DATA.
SELECT mandt kunnr budat code remarks FROM zcust_call_rec INTO
table itab
WHERE kunnr IN r_kunnr AND BUDAT IN R_BUDAT.
ENDFORM.
****append vendor code
FORM APPEND_CUSTOMER_CODE.
clear r_kunnr.
clear itab.
clear r_budat.
refresh r_kunnr.
refresh itab.
refresh r_kunnr.
IF r_kunnr IS INITIAL
AND NOT v_kun_low IS INITIAL
AND NOT v_kun_high IS INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_kun_low
IMPORTING
OUTPUT = r_kunnr-low.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_kun_high
IMPORTING
OUTPUT = r_kunnr-high.
r_kunnr-option = 'BT'.
r_kunnr-sign = 'I'.
append r_kunnr.
PERFORM V_BUDAT.
ELSEIF r_kunnr IS INITIAL
AND NOT v_kun_low IS INITIAL
AND v_kun_high IS INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_kun_low
IMPORTING
OUTPUT = r_kunnr-low.
r_kunnr-SIGN = 'I'.
r_kunnr-OPTION = 'EQ'.
APPEND r_kunnr.
PERFORM V_BUDAT.
ELSEIF r_kunnr IS INITIAL
AND v_kun_low IS INITIAL
AND NOT v_kun_high IS INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_kun_low
IMPORTING
OUTPUT = r_kunnr-low.
r_kunnr-SIGN = 'I'.
r_kunnr-OPTION = 'EQ'.
APPEND r_kunnr.
PERFORM V_BUDAT.
ELSEIF r_kunnr IS INITIAL
AND v_kun_low IS INITIAL
AND v_kun_high IS INITIAL.
IF SY-SUBRC = 0.
MESSAGE I003(0) WITH 'ENTER CUSTOMER NUMBER'.
CALL SCREEN '9000'.
ENDIF.
PERFORM V_BUDAT.
ENDIF.
ENDFORM.
FORM V_BUDAT.
IF R_BUDAT IS INITIAL
AND NOT v_BUD_low IS INITIAL
AND NOT v_BUD_high IS INITIAL.
r_budat-low = v_bud_low.
r_budat-high = v_bud_high.
r_budat-option = 'BT'.
r_budat-sign = 'I'.
append r_budat.
ELSEIF R_BUDAT IS INITIAL
AND NOT v_BUD_low IS INITIAL
AND v_BUD_high IS INITIAL.
r_budat-low = v_bud_low.
r_budat-high = v_bud_high.
r_budat-option = 'EQ'.
r_budat-sign = 'I'.
append r_budat.
ELSEIF R_BUDAT IS INITIAL
AND v_BUD_low IS INITIAL
AND NOT v_BUD_high IS INITIAL.
r_budat-HIGH = v_bud_HIGH.
r_budat-option = 'EQ'.
r_budat-sign = 'I'.
append r_budat.
ELSEIF R_BUDAT IS INITIAL
AND v_BUD_low IS INITIAL
AND v_BUD_high IS INITIAL.
IF SY-SUBRC = 0.
MESSAGE I002(0) WITH 'ENTER POSTING DATE'.
CALL SCREEN '9000'.
r_budat-low = ''.
r_budat-option = ''.
r_budat-sign = ''.
ENDIF.
ENDIF.
ENDFORM.
*& Form update
text
--> p1 text
<-- p2 text
form update .
commit work.
endform. " update
*& Form move_data
text
--> p1 text
<-- p2 text
form move_data .
clear itab.
refresh itab.
move-corresponding zcust_call_rec to itab.
MOVE ZCUST_CALL_REC-MANDT TO ITAB-MANDT.
MOVE ZCUST_CALL_REC-KUNNR TO ITAB-KUNNR.
MOVE ZCUST_CALL_REC-BUDAT TO ITAB-BUDAT.
MOVE ZCUST_CALL_REC-CODE TO ITAB-CODE.
MOVE ZCUST_CALL_REC-REMARKS TO ITAB-REMARKS.
APPEND ITAB.
delete itab where kunnr is initial.
endform. " move_data
thanks in adv
vidya -
SOP: How to update ratio values
Hi everyone,
I have defined an Information Structure with some characteristics and ratios, all of them associated to some ZTable fields.
Well, I would be very grateful whether someone could tell how to update ratio values in my Information Structure. I mean I would like to know which are the steps I have to follow in order to update tha value of my ratios everytime its associated ZField changes its value.
I have the idea of using this Information Structure in a "Level-by-Level" planning type using Product Groups.
Thanks in advance and best regards.
Ben.Hi again,
Actually I have already created my planning type with some macro instructions and I have checked that they work properly in MC94. I have also created a planning hierarchy as you requested.
But my problem doesn't deal with this. The key figures that I have included in my structure represent values in SAP (i.e. Sold units, Security stocks...).
What I need to do is update the value of that key figures in my structure for all the combinations of my characteristics.
I hope my explanation is quite better this time.
Thanks. -
How to update my new phone number after my U-verse phone service is disconnected?
How to update my new phone number for forwarding after my U-verse phone service is cancelled/ disconnected?
I did call them. They said once the phone service is disconnected, there's nothing they can do about it. The thing is that when I called them to cancel the U-verse service yesterday, they did not offer me the opportunity to update the new phone #. This is so frustrating!
-
How to remove precision value in oracle table
Hi,
I have created one table ,that table contains 40 million records and some of the columns containing precision values and the columns are of datatype is NUMBER...
I need to remove precision values of those columns for 40 millions records which ever contains ,If I use update truncate scripts it's taking so long time to update ( for .eg. more than 2 weak to update --- update table_name set transaction_id=trunc(transaction_id) ).Is there any other way...
so can you please suggest ....
Thanks,
vidhyahi marcopb,
Below I have mentioned some columns in bold, which i am updating . yes it's taking to update more than 2 weak not yet finished...
My update script is Update Inv.Mtl_Material_Transactions Set Transaction_Id=Trunc(Transaction_Id),Transaction_Action_Id=Trunc(Transaction_Action_Id),
Transaction_Source_Id=Trunc(Transaction_Source_Id),Rcv_Transaction_Id =Trunc(Rcv_Transaction_Id );
describe mtl_material_transactions;
Name Null Type
TRANSACTION_ID NOT NULL NUMBER
LAST_UPDATE_DATE NOT NULL DATE
LAST_UPDATED_BY NOT NULL NUMBER
CREATION_DATE NOT NULL DATE
CREATED_BY NOT NULL NUMBER
LAST_UPDATE_LOGIN NUMBER
REQUEST_ID NUMBER
PROGRAM_APPLICATION_ID NUMBER
PROGRAM_ID NUMBER
PROGRAM_UPDATE_DATE DATE
INVENTORY_ITEM_ID NOT NULL NUMBER
REVISION VARCHAR2(3)
ORGANIZATION_ID NOT NULL NUMBER
SUBINVENTORY_CODE VARCHAR2(10)
LOCATOR_ID NUMBER
TRANSACTION_TYPE_ID NOT NULL NUMBER
TRANSACTION_ACTION_ID NOT NULL NUMBER
TRANSACTION_SOURCE_TYPE_ID NOT NULL NUMBER
TRANSACTION_SOURCE_ID NUMBER
TRANSACTION_SOURCE_NAME VARCHAR2(30)
TRANSACTION_QUANTITY NOT NULL NUMBER
TRANSACTION_UOM NOT NULL VARCHAR2(3)
PRIMARY_QUANTITY NOT NULL NUMBER
TRANSACTION_DATE NOT NULL DATE
VARIANCE_AMOUNT NUMBER
ACCT_PERIOD_ID NUMBER
TRANSACTION_REFERENCE VARCHAR2(240)
REASON_ID NUMBER
DISTRIBUTION_ACCOUNT_ID NUMBER
ENCUMBRANCE_ACCOUNT NUMBER
ENCUMBRANCE_AMOUNT NUMBER
COST_UPDATE_ID NUMBER
COSTED_FLAG VARCHAR2(1)
INVOICED_FLAG VARCHAR2(1)
ACTUAL_COST NUMBER
TRANSACTION_COST NUMBER
PRIOR_COST NUMBER
NEW_COST NUMBER
CURRENCY_CODE VARCHAR2(10)
CURRENCY_CONVERSION_RATE NUMBER
CURRENCY_CONVERSION_TYPE VARCHAR2(30)
CURRENCY_CONVERSION_DATE DATE
USSGL_TRANSACTION_CODE VARCHAR2(30)
QUANTITY_ADJUSTED NUMBER
EMPLOYEE_CODE VARCHAR2(10)
DEPARTMENT_ID NUMBER
OPERATION_SEQ_NUM NUMBER
MASTER_SCHEDULE_UPDATE_CODE VARCHAR2(10)
RECEIVING_DOCUMENT VARCHAR2(10)
PICKING_LINE_ID NUMBER
TRX_SOURCE_LINE_ID NUMBER
TRX_SOURCE_DELIVERY_ID NUMBER
REPETITIVE_LINE_ID NUMBER
PHYSICAL_ADJUSTMENT_ID NUMBER
CYCLE_COUNT_ID NUMBER
RMA_LINE_ID NUMBER
TRANSFER_TRANSACTION_ID NUMBER
TRANSACTION_SET_ID NUMBER
RCV_TRANSACTION_ID NUMBER
MOVE_TRANSACTION_ID NUMBER
COMPLETION_TRANSACTION_ID NUMBER
SOURCE_CODE VARCHAR2(30)
SOURCE_LINE_ID NUMBER
VENDOR_LOT_NUMBER VARCHAR2(30)
TRANSFER_ORGANIZATION_ID NUMBER
TRANSFER_SUBINVENTORY VARCHAR2(10)
TRANSFER_LOCATOR_ID NUMBER
SHIPMENT_NUMBER VARCHAR2(30)
TRANSFER_COST NUMBER
TRANSPORTATION_DIST_ACCOUNT NUMBER
TRANSPORTATION_COST NUMBER
TRANSFER_COST_DIST_ACCOUNT NUMBER
WAYBILL_AIRBILL VARCHAR2(20)
FREIGHT_CODE VARCHAR2(30)
NUMBER_OF_CONTAINERS NUMBER
VALUE_CHANGE NUMBER
PERCENTAGE_CHANGE NUMBER
ATTRIBUTE_CATEGORY VARCHAR2(30)
ATTRIBUTE1 VARCHAR2(150)
ATTRIBUTE2 VARCHAR2(150)
ATTRIBUTE3 VARCHAR2(150)
ATTRIBUTE4 VARCHAR2(150)
ATTRIBUTE5 VARCHAR2(150)
ATTRIBUTE6 VARCHAR2(150)
ATTRIBUTE7 VARCHAR2(150)
ATTRIBUTE8 VARCHAR2(150)
ATTRIBUTE9 VARCHAR2(150)
ATTRIBUTE10 VARCHAR2(150)
ATTRIBUTE11 VARCHAR2(150)
ATTRIBUTE12 VARCHAR2(150)
ATTRIBUTE13 VARCHAR2(150)
ATTRIBUTE14 VARCHAR2(150)
ATTRIBUTE15 VARCHAR2(150)
MOVEMENT_ID NUMBER
TRANSACTION_GROUP_ID NUMBER
TASK_ID NUMBER(15)
TO_TASK_ID NUMBER(15)
Thanks,
vidhya -
User_sdo_geom_metadata - how to update tolerance value
Hello,
I need to update my tolerance values within the DIMINFO field of the user_sdo_geom_metadata table. I'm new to updating "objects" via sql.
Could someone provide an SQL example of how to update the tolerance value(s).
Thanks very much,
David HagemannI need to query points at a certain distance from the interstate.
This is my query
=======================
select objectid
from Table_points , interstates
where highway = 'I 95'
and mdsys.sdo_within_distance (
Table_points.shape, interstates.geom,
'distance=2.5 layer_gtype=POINT') = 'TRUE';
=======================
This is the error I got
ERROR at line 1:
ORA-13285: Geometry coordinate transformation error
ORA-29400: data cartridge error
ORA-22060: argument [2] is an invalid or uninitialized number
ORA-06512: at "MDSYS.SDO_3GL", line 160
ORA-06512: at "MDSYS.SDO_3GL", line 266
ORA-06512: at line 1
=========================
Anyone has an idea where I am wrong
Thanks
Tan -
Reg:How to update VC values using BAPI_SALESORDER_CREATEFROMDAT2
Hi,
We are creating sales order using the BAPI_SALESORDER_CREATEFROMDAT2 FM but we also want to update variant configuration values in those sales orders. I'm passing these tables (ORDER_CFGS_REF, ORDER_CFGS_INST, ORDER_CFGS_VALUE) to the FM.'
The sales order is been created but the VC characteristics are not getting updated.
After the FM I am calling the commit also..
Am I missing anything..Please guide me how to update the VC values..hi,
use swo1 for uploading BAPIs
regards,
uttam. -
How to update the value inside a field symbol ?
ASSIGN COMPONENT 'MENGE' OF STRUCTURE <fs_line> TO <fs_field>.
<fs_field> = itab_stpo-menge.
COLLECT <fs_line> INTO <fs_table>.
.processing some code......
ASSIGN COMPONENT 'MENGE' OF STRUCTURE <fs_line> TO <fs_field>.
<fs_field> = ( itab_stpo-menge * itab_plpo-vgw03 ).
COLLECT <fs_line> INTO <fs_table>.
Hi, guys,
May i know is there a way to update the value in inside a field symbol?
I feel hard to figure out the way to solve this situation. Kindly give me some help or perhaos tell me other altenative way to do it also can.
Thanks in advance.
Edited by: Jiansi Lim on Apr 25, 2008 8:09 PMhi check this...
For a structured data object s, you can use the statement
ASSIGN COMPONENT comp OF STRUCTURE s TO FS.
Here the comp is the component name or its index number in the structure.
Find the following sample code -
DATA: BEGIN OF LINE,
COL1 TYPE I VALUE '11',
COL2 TYPE I VALUE '22',
COL3 TYPE I VALUE '33',
END OF LINE.
DATA COMP(5) VALUE 'COL3'.
FIELD-SYMBOLS: <F1>, <F2>, <F3>.
ASSIGN LINE TO <F1>.
ASSIGN COMP TO <F2>.
DO 3 TIMES.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE <F1> TO <F3>.
WRITE <F3>.
ENDDO.
ASSIGN COMPONENT <F2> OF STRUCTURE <F1> TO <F3>.
WRITE / <F3>.
The output is:
11 22 33
33
I need to update one field in Internal table
regards,
venkat -
How to update Elements value inside existing xml file
Hi Gurus,
Am somehow new to java and working on xml with java, i have a scenario where i want to update the elements of my existing xml file, i know its possible as i have posted one code on this forum which updates the values of the arrtibutes of existing xml file. Ref :
http://forum.java.sun.com/thread.jsp?forum=34&thread=186091&start=15&range=15&hilite=false&q=
But am not able to use the same code to update the vlaues of the attribute.
if i have this xml file :
<?xml version="1.0"?>
<RootElement>
<Transaction>
<Task9>
<TaskID>Task9</TaskID>
<Description>My Test Case</Description>
<Time>12/12/2004</Time>
</Task9>
</Transaction>
<Transaction>
<Task2>
<TaskID>Task2</TaskID>
<Description>Testing my xml</Description>
<Time>12/12/2004</Time>
</Task2>
</Transaction>
</RootElemen>
Now i want to update teh </Description> and </Time> field using the code that i have given above in the link.
If any one can help me ill really appreciate.The value of an element is stored in a child node of that element. For example, let's say that "e" references the node <Description> then:
e.getFirstChild().getNodeValue() => "My Test Case" -
How to update the value in xml file using transformer after setNodeValue
Hi,
This is my code
I want to set update the values in xml file using transformer..
Any one can help me
This is my Xml file
<?xml version="1.0" encoding="UTF-8"?>
<place>
<name>chennai</name>
</place>
Jsp Page
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ page import="javax.xml.parsers.DocumentBuilderFactory,
javax.xml.parsers.DocumentBuilder,org.w3c.dom.*,org.w3c.dom.Element"
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<% String str="";
String str1="";
try
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse("http://localhost:8084/XmlApplication1/sss.xml");
out.println("Before change");
NodeList n11 = doc.getElementsByTagName("name");
Node n22= n11.item(0).getFirstChild();
str1 = n22.getNodeValue();
out.println(str1);
out.println("After change");
String name = "Banglore";
NodeList nlst = doc.getElementsByTagName("name");
Node node= nlst.item(0).getFirstChild();
node.setNodeValue(name);
NodeList n1 = doc.getElementsByTagName("name");
Node n2= n1.item(0).getFirstChild();
str = n2.getNodeValue();
out.println(str);
catch(Exception e)
out.println(e) ;
%>
<h1><%=str%></h1>
<%--
This example uses JSTL, uncomment the taglib directive above.
To test, display the page like this: index.jsp?sayHello=true&name=Murphy
--%>
<%--
<c:if test="${param.sayHello}">
<!-- Let's welcome the user ${param.name} -->
Hello ${param.name}!
</c:if>
--%>
</body>
</html>hi check this exit...
IWO10012 -
How to update the value of setter and getter..!!
Hii all i am developing an portal application in which i display the metadata information related to a document(Stored in UCM) in a popup in my application...
The user can also update the information through the application.
in my popup i have a trh : table layout in which i have a Select Onechoice field as
<trh:cellFormat id="xcfcSecurityGrp">
<af:selectOneChoice value="#{MetaDataFields.DSecurityGroup}" id="ddldSecurityGroup" showRequired="false"
autoSubmit="true"
immediate="true">
<f:selectItems value="#{ContentDataBean.TSecurityGrpList}" id="si1"/>
</af:selectOneChoice>
</trh:cellFormat>
The MetaDataFields.DSecurityGroup show the current security group on document
and
ContentDataBean.TSecurityGrpList provide the user with the list of security group to update.
The current security group i am getting through a map which consist of metadata information for a document :-
public void setDSecurityGroup(String dSecurityGroup) {
this.dSecurityGroup = dSecurityGroup;
public String getDSecurityGroup() throws IdcClientException, IOException {
Map<String,String> mapValue=ep.getDocumentPropertiesSystem();
dSecurityGroup=mapValue.get("dSecurityGroup");
return dSecurityGroup;
The problem is that whenever i am updating the value for the security group, i am getting the old value, the problem is that i have to every time get value from the map only as it consist metadata information for the current selected document..
Is there is any way through which i can update the value for this field..??
Thanks
JDeveloper - 11.1.1.6.0Hi,
Try binding ValueChangeListener on the selectList. Also set autoSumit property to true.
Thanks,
Pandu -
How to update column value dynamically
Hi All,
I have created a simple mapping and selected insert/update on target table. In target table there is one column record_type which will hold either 'NEW' (if new record is inserting) or 'UPDATED'(if existing record is updating) value. Please let me know how can I do this using OWB PL/SQL map?
Thanks
BhushanHi Sanjaya,
Thank you for your reply.
I like your approch but i think there is need to pass 'UPDATED' when intersect is being used and 'NEW' when minus is being used.
I have developed an OWB map as mentioned in below steps.
1. Chose source (TableA) and target (TableB) as source using table operator.
2. Joined TableA to TableB on col1 using left outer join using joined operator.
3. In expression operator I have calculated value for TableB.col3 using below logic.
CASE WHEN TableB.col1 IS NULL THEN 'NEW' ELSE 'UPDATED' END
4. Mapped columns from expression operator to target table.
I would like to know you comments on above approch. My OWB map has generated below merge statement.
MERGE INTO TableB
USING(SELECT MERGESQL.col1,MERGESQL.col2, CASE WHEN MERGESQL.col3 is null then 'NEW' else 'UPDATED' END col3
FROM (SELECT TableA.col1, TableA.col2,TableB.col1 AS col3
FROM TableA
LEFT OUTER JOIN TableB
ON (TableA.col1 = TableB.col1)) MERGESQL
ON (col1 = MERGESQL.col1)
WHEN NOT MATCHED THEN INSERT(col1,col2,col3) VALUES(MERGESQL.col1,MERGESQL.col2,MERGESQL.col3)
WHEN MATCHED THEN
UPDATE SET col2 = MERGESQL.col2,
col3 = MERGESQL.col3; -
I want to update the unique values, if they are not inserted... Please help in this regard
CREATE OR REPLACE PROCEDURE PR IS
lv_operator VARCHAR2(1) := 'N';
TYPE subset_rt IS RECORD
ltt_whse_loc oe_sales_ord_commit.whse_loc%TYPE,
ltt_shape oe_sales_ord_commit.shape%TYPE,
ltt_isize oe_sales_ord_commit.isize%TYPE,
ltt_grade oe_sales_ord_commit.grade%TYPE,
ltt_length oe_sales_ord_commit.length%TYPE,
ltt_pieces NUMBER,
ltt_inv_lbs_commit oe_sales_ord_commit.inv_lbs_commit%TYPE,
ltt_roll_lbs_commit oe_sales_ord_commit.roll_lbs_commit%TYPE,
ltt_ishcom_lbs oe_sales_ord_commit.ishcom_lbs%TYPE);
TYPE subset_aat IS TABLE OF subset_rt
INDEX BY PLS_INTEGER;
aa_subset subset_aat;
errors NUMBER;
dml_errors EXCEPTION;
PRAGMA EXCEPTION_INIT(dml_errors, -24381);
BEGIN
lv_operator := sy_checkpriv(USER,
'SY_OPERATIONS');
SELECT whse_loc,
shape,
isize,
grade,
length,
0,
inv_lbs_commit,
roll_lbs_commit,
ishcom_lbs
BULK COLLECT INTO aa_subset
FROM oe_sales_ord_commit_temp
WHERE processed_datetime IS NULL
AND username = decode(lv_operator,
'Y',
username,
USER);
BEGIN
FORALL indx IN 1 .. aa_subset.COUNT SAVE EXCEPTIONS
INSERT INTO
(SELECT loc,
shape,
isize,
grade,
length,
pieces,
inv_lbs_commit,
roll_lbs_commit,
ishcom_lbs FROM oe_inventory_temp)
VALUES
aa_subset(indx);
EXCEPTION
WHEN OTHERS THEN
*+<<Trap the rows that have failed due to dup_val_on_index exception and update the inv_lbs_commit,+*
*+roll_lbs_commit, ishcom_lbs columns in oe_inventory_temp table>>+*
-- loc,shape, isize,grade, length, pieces are composite primary keys.
errors := SQL%BULK_EXCEPTIONS.COUNT;
DBMS_OUTPUT.PUT_LINE('Number of statements that failed: ' || errors);
FOR i IN 1..errors LOOP
DBMS_OUTPUT.PUT_LINE('Error #' || i || ' occurred during '||
'iteration #' || SQL%BULK_EXCEPTIONS(i).ERROR_INDEX);
DBMS_OUTPUT.PUT_LINE('Error message is ' ||
SQLERRM(-SQL%BULK_EXCEPTIONS(i).ERROR_CODE));
DBMS_OUTPUT.PUT_LINE(aa_subset(SQL%BULK_EXCEPTIONS(i).ERROR_INDEX));
END LOOP;
END;
END PR;
/Due to the following restriction a number of simple collections is used instead of the collection of records.
[FORALL Statement|http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/forall_statement.htm#sthref2742]: You cannot refer to individual record fields within DML statements called by a FORALL statement. Instead, you can specify the entire record with the SET ROW clause in an UPDATE statement, or the VALUES clause in an INSERT statement.
10g syntax of FORALL statement is used:
SQL> select * from a;
INT DT STR
1 10.02.2009 123
2 11.02.2009 567
SQL> desc a
Name Null? Type
INT NOT NULL NUMBER(38)
DT DATE
STR VARCHAR2(20)
SQL> select * from a;
INT DT STR
1 10.02.2009 123
2 11.02.2009 567
SQL> DECLARE
2 TYPE T_Int_List IS TABLE OF A.Int%TYPE INDEX BY PLS_INTEGER;
3 TYPE T_Dt_List IS TABLE OF A.Dt%TYPE INDEX BY PLS_INTEGER;
4 TYPE T_Str_List IS TABLE OF A.Str%TYPE INDEX BY PLS_INTEGER;
5
6 vInts T_Int_List;
7 vDts T_Dt_List;
8 vStrs T_Str_List;
9
10 eBulk_Error EXCEPTION;
11 PRAGMA EXCEPTION_INIT(eBulk_Error, -24381);
12 BEGIN
13 vInts(1) := 2;
14 vDts(1) := sysdate - 1;
15 vStrs(1) := '888';
16
17 vInts(2) := 3;
18 vDts(2) := sysdate - 22;
19 vStrs(2) := '0000';
20
21 BEGIN
22 FORALL indx IN INDICES OF vInts SAVE EXCEPTIONS
23 INSERT INTO A(Int, Dt, Str)
24 VALUES(vInts(indx), vDts(indx), vStrs(indx));
25 EXCEPTION
26 WHEN eBulk_Error THEN
27 DECLARE
28 vErr_Count INTEGER;
29 vErr_Message VARCHAR2(2000);
30 vErr_Indices T_Int_List;
31 BEGIN
32 vErr_Count := SQL%BULK_EXCEPTIONS.COUNT;
33 -- Getting the indices of rows with duplicate key
34 -- FOR vI IN 1 .. SQL%BULK_EXCEPTIONS.COUNT LOOP - Doesn't work for some reason on 10.2.0.1.0
35 FOR vI IN 1 .. vErr_Count LOOP
36 IF SQL%BULK_EXCEPTIONS(vI).Error_Code <> 1 THEN
37 -- Error other that duplicate key is reraised
38 vErr_Message := SQLERRM(-SQL%BULK_EXCEPTIONS(vI).Error_Code);
39 Raise_Application_Error(-20001, vErr_Message);
40 END IF;
41 vErr_Indices(SQL%BULK_EXCEPTIONS(vI).ERROR_INDEX) := SQL%BULK_EXCEPTIONS(vI).ERROR_INDEX;
42 END LOOP;
43
44 -- Bulk update
45 FORALL vI IN INDICES OF vErr_Indices
46 UPDATE A SET
47 Dt = vDts(vI),
48 Str = vStrs(vI)
49 WHERE Int = vInts(vI);
50 END;
51 END;
52 END;
53 /
PL/SQL procedure successfully completed.
SQL> select * from a;
INT DT STR
1 10.02.2009 123
2 09.02.2009 888
3 19.01.2009 0000Regards,
Dima
Edited by: DimaCit on Feb 10, 2009 10:39 AM -
How to update the value of a column when a row is deleted
Hi,
My requirement is basically i have a table .Below is a sample data along with sample data
Column A Column B ColumnC
1 SAM 0
2 RAM 0
Now if i run a delete statement saying
delete from Table where ColumnA =1 then i want to see the value of ColumnC to be updated as 1.The row shouldnt be deleted however the value of ColumnC should be changed to 1.
Can someone please help me with any suggestions? I can create a trigger but i havent worked with triggers so not sure on how to use it.
Please let me know if i am unclear or if you need any details.
ThanksAs I understand what you need is an INSTEAD OF DELETE trigger like below
CREATE TRIGGER Trg_TableName
ON TableName
INSTEAD OF DELETE
AS
BEGIN
UPDATE t
SET ColumnC = 1
FROM TableName t
WHERE EXISTS (SELECT 1
FROM DELETED
WHERE ColumnA = t.ColumnA
END
this will set ColumnC to 1 and will not do an actual delete of the row.
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page -
I have road sections modelled with x,y and m values. The m values are evenly spread along the shape. The road topography is at times mountainous, and so these interpolated measure values are not a good representation of the actual measures.
I now have actual driven measure values every 10m and want to update the geometry spatial array with these. I therefore have about 1 million measures to update and have two questions:
1. What is the SQL to update just the measures of an SDO_ORDINATE_ARRAY?
2. What is the best way to update this many records?Phil,
1. There is no simple SQL statement to update an M value. But it would be a rather simple thing to create a procedure to do so, imputing a geometry, the vertex to modify, and the new value, getting the revised geometry back.
2. If you are going to update multiple vertices's per geometry, it might be best to send the procedure a vertex number / value pair list, and have it update each geometry as a whole.
A good place to start is to look at the 3D to 2D conversion routine:
Re: 3-D conversion to 2-D
Bryan
Maybe you are looking for
-
Dear All; l have setup the Content server in Windows 2003 Standard Edition using the filesystem storage (not the MaxDB database), and the size of the document could be approximately 80GB (for the next few years), l didn't setup the Cache server. All
-
Error generating report - Program was terminated by signal 11
Hi All, I am very new to XML Publisher reports and I am facing the following issue in a report - Program was terminated by signal 11 I created the data model in RDF and for this I created the corresponding RTF file. When I see the preview of this RTF
-
Showing and deleted hidden files?
I am trying to do a software update on my Blu-Ray DVD player. I downloaded the software from the manufacturer's website (Sharp), and placed the single file (which ends in .RVP) onto an empty USB memory stick. I am unable to perform the update on the
-
Illustrator CS6 Dual License?
I want to download illustrator cs6 for my two computers - one windows and one mac. Is it possible to buy a dual license?
-
HT3275 How to restore functionality
How to restore functionality when the follow Time Machine error message appears: The backup disk image "/Volumes/S.Time Caps/ MacBook Air.sparsebundle" is already in use. It was working fine until yesterday. Many thanks,