Code to update a table using sqlldr
Hi all,
can anybody give the code to update a table using sqlldr with an example
thank you
You want add the new line and modified the existing line (based on empno) from file e:\scripts\sql\emp2_ext.dat into table emp2 :
7782,CLARK,MANAGER,7839,09/06/81,80000,,10
8000,ORACLE,DATABASE,,11/02/07,99999,,20Then :
SQL> conn system/mypwd
Connected.
SQL>
SQL> create directory my_dir as 'e:\scripts\sql';
Directory created.
SQL>
SQL> grant read,write on directory my_dir to scott;
Grant succeeded.
SQL>
SQL> conn scott/mypwd
Connected.
SQL> create table emp2_ext
2 (EMPNO NUMBER(4),
3 ENAME VARCHAR2(10),
4 JOB VARCHAR2(9),
5 MGR NUMBER(4),
6 HIREDATE DATE,
7 SAL NUMBER(7,2),
8 COMM NUMBER(7,2),
9 DEPTNO NUMBER(2)
10 )
11 ORGANIZATION EXTERNAL
12 ( TYPE ORACLE_LOADER
13 DEFAULT DIRECTORY my_dir
14 ACCESS PARAMETERS
15 ( records delimited by newline
16 badfile my_dir:'emp2_ext.bad'
17 logfile my_dir:'emp2_ext.log'
18 fields terminated by ','
19 missing field values are null
20 ( empno, ename, job, mgr, hiredate char date_format date mask "dd/mm/yy",
21 sal, comm, deptno
22 )
23 ) LOCATION ('emp2_ext.dat')
24 ) ;
Table created.
SQL>
SQL> select * from emp2_ext;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7782 CLARK MANAGER 7839 09/06/81 80000 10
8000 ORACLE DATABASE 11/02/07 99999 20
SQL> select * from emp2;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7782 CLARK MANAGER 7839 09/06/81 24500 10
7839 KING PRESIDENT 17/11/81 50000 10
7934 MILLER CLERK 7782 23/01/82 13000 10
SQL> merge into emp2 a
2 using (select * from emp2_ext) b
3 on (a.empno=b.empno)
4 when matched then update set a.ename=b.ename,
5 a.job=b.job,
6 a.mgr=b.mgr,
7 a.hiredate=b.hiredate,
8 a.sal=b.sal,
9 a.comm=b.comm,
10 a.deptno=b.deptno
11 when not matched then insert (a.empno, a.ename, a.job, a.mgr, a.hiredate, a.sal, a.comm, a.deptno)
12 values (b.empno, b.ename, b.job, b.mgr, b.hiredate, b.sal, b.comm, b.deptno);
2 rows merged.
SQL>
SQL> select * from emp2;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7782 CLARK MANAGER 7839 09/06/81 80000 10 --modified line
7839 KING PRESIDENT 17/11/81 50000 10
7934 MILLER CLERK 7782 23/01/82 13000 10
8000 ORACLE DATABASE 11/02/07 99999 20 --added line
SQL> HTH,
Nicolas.
Well, Hans has already give good explanation with docs links...
Message was edited by:
N. Gasparotto
Similar Messages
-
How to Update crmd_customer_h TABLE Using CRMV_EVENT Through Funtion Module
Hi
How we can update customer_h table using the CRMV_EVENT Where i implemented logic below in the Funtion Module.
data: lt_doc_flow TYPE crmt_doc_flow_wrkt,
lw_cust_h_com TYPE crmt_customer_h_com,
lw_input_field_names TYPE crmt_input_field_names,
lt_input_field_names TYPE crmt_input_field_names_tab,
lt_objects_to_save TYPE crmt_object_guid_tab,
lw_guid TYPE CRMT_OBJECT_GUID.
DATA : lv_process_type TYPE crmt_process_type.
data: wa_doc_flow type CRMT_DOC_FLOW_WRK.
data: wa_customer_h type crmd_customer_h.
* Function module for retriving the Process type.
CALL FUNCTION 'CRM_ORDERADM_H_READ_OW'
EXPORTING
iv_orderadm_h_guid = iv_header_guid
IMPORTING
ev_process_type = lv_process_type
EXCEPTIONS
admin_header_not_found = 1
OTHERS = 2.
if lv_process_type eq 'ZG01'.
CALL FUNCTION 'CRM_DOC_FLOW_READ_OB'
EXPORTING
IV_HEADER_GUID = iv_header_guid
IMPORTING
ET_DOC_FLOW_WRK = lt_doc_flow.
read table lt_doc_flow with key objtype_a = 'BUS2000116' INTO wa_doc_flow. "gc_object_type-service.
if sy-subrc eq 0. "set flag for service order
lw_cust_h_com-ref_guid = wa_doc_flow-objkey_a.
lw_cust_h_com-ZZTRAIL_FLAG = 'X'.
lw_cust_h_com-mode = 'A'.
lw_cust_h_com-ref_handle = '0000000001'.
lw_guid = wa_doc_flow-objkey_a.
INSERT lw_guid INTO TABLE lt_objects_to_save.
endif.
lw_input_field_names-fieldname = 'REF_GUID'.
lw_input_field_names-fieldname = 'ZZTRAIL_FLAG'.
lw_input_field_names-changeable = ' '.
INSERT lw_input_field_names INTO TABLE lt_input_field_names.
Maintain Customer H
CALL FUNCTION 'CRM_CUSTOMER_H_MAINTAIN_OW'
EXPORTING
is_customer_h_com = lw_cust_h_com
CHANGING
ct_input_field_names = lt_input_field_names
EXCEPTIONS
header_change_error = 1
header_create_error = 2
error_occurred = 3.
ENDIF.
*endif.
*Clearing local variables
clear: lv_process_type,
lw_cust_h_com,
lw_input_field_names.
*Free internal tables
free: lt_doc_flow,
lt_input_field_names.Hi Faisal
I think your not clear with what i am saying anyhow i will again explain you my requirement
As per my requirement
1)in the service order search report i need to add a field called "Has trail order with No Follow up" with values "Yes" & "Blank"
For above Field i added using the structure CRMST_QUERY_SRVO_BTIL and through configuration i am able to display the field in webui as per (Attachement Pic 1)
2)When i search with search criteria as "Has trail order with No Follow up" with "Yes"
Then in result list i need to show the service order those having follow up as trail orders(sales order) only.if for next document trail order having any follow up then those service orders dont want to show in result list.
For above requirement i implemented F.M using CRMV_EVENT & I configured for BUS2000115 And BEFORE_SAVE The Order
The FM Will get trigger when i save the service order and for that service order if create any follow up and try to save the trail order then This FM Will trigger and in this i am doing validations.
3)Add one AET Trail Flag field is added under CUSTOMER_H Table.
4)in the FM I am validating for if the trail order having the preceding document as service order then i need to make flag as "X" For that service order in customer_h
if suppose when i delete trail order from the service order then that flag must need to be "unset" from the CUSTOMER_H.
Why bcoz we are doing above process is do show records in result list based on Flag values
these flag checks are validating in the BADI Which we implemented for search logic.
Please refer below Login for my requirement:-
Proposal to have a custom “flag” field (background at table level,
crmd_customer_h) linked to service order which gets flagged whenever at
least one Trial order is created and saved from the Service Order.
The flag value should be cleared when all the trial orders created and
saved as follow up transactions are deleted from the system.
Similarly for Trial Orders will use the same custom “flag” field
which gets activated when at least one follow up is created and saved from Trial Order.
The flag value should be cleared when all the follow up transactions from
the Trial Order are deleted from the system.
When the above search criteria “Has Trial order with no follow up”
“is” “Yes” is applied then the logic derives all the service
orders which satisfy additional search criteria applied in the search and
for these Service orders checks if the custom flag field is checked to
derive all Service orders which have Trial order. The custom flag values
values are derived from crmd_customer_h table in CRM.
4 )Further for all the Trial Orders determined in Step 3
check if the Trial Order has a follow up by checking if the custom flag field
is checked. The custom flag values are derived from crmd_customer_h table in
CRM.
5) If step 4 is not met populate the preceding Service
Orders in the Result list -
Load Multiple Table using SQLLDR
Hi,
We are trying to Load Multiple Table using SQLLDR in same loading session.
Here's a snippet of our script:
LOAD DATA INFILE '/u07/dd/yyyy_mm_dd.dat'
append INTO TABLE table1
WHEN STORE_NO != ' '
STORE_NO position(1:5) ,
TR_DATE position(6:27) DATE "mm/dd/yy
truncate INTO TABLE table2
WHEN STORE_NO != ' '
STORE_NO position(1:5) ,
TR_DATE position(6:27) DATE "mm/dd/yy
Now upon execution this gives an error saying truncate shouldn't be present before 2nd INTO Clause. The script runs fine if we do same operation say Append / Replcae / Truncate on both tables. My Question here is can we have SQLLDR perform two diff operations (Append & Truncate in our case) in one session?
Thanks
Chinmay
PS: Referred to http://www.orafaq.com/wiki/SQL*Loader_FAQ#Can_one_load_data_from_multiple_files.2F_into_multiple_tables_at_once.3F alreadyNo.
did you read the syntax diagram and the paragraph below:
"When you are loading a table, you can use the INTO TABLE clause to specify a table-specific loading method (INSERT, APPEND, REPLACE, or TRUNCATE) that applies only to that table. That method overrides the global table-loading method. The global table-loading method is INSERT, by default, unless a different method was specified before any INTO TABLE clauses." -
Updating EKKO table using E1BPPAREX
Hi all,
My requirement is to update ekko table using E1BPPAREX segement. I have gone through so many posts regarding this.
In my case, PO number is not yet created. I am using BAPI_PO_CREATE1 for creating this . From PI side, if they pass the custom field value in the appropriate postion of VALUEPART field of E1BPPAREX, will it get updated to the ekko table automatically.
Regards,
SajithHi Sajith,
you have to do is populate structure extensionin. You'll have to implement the fm DDIF_NAMETAB_GET to look for the right place (offset) in order to add the field on the structure extension in.
Example:
CALL FUNCTION 'DDIF_NAMETAB_GET'
EXPORTING
tabname = c_ext_table --> ''BAPI_TE_MEPOHEADER
TABLES
dfies_tab = lt_tab
EXCEPTIONS
not_found = 1
OTHERS = 2.
CLEAR l_offset.
LOOP AT lt_tab.
CASE lt_tab-fieldname.
WHEN c_yourfield.
w_extin-valuepart1+l_offset = p_yourfield.
ENDCASE.
ADD lt_tab-leng TO l_offset.
ENDLOOP.
MOVE c_ext_table TO w_extin-structure.
APPEND w_extin TO p_i_extin.
Regards,
Carlos. -
Updating multiple tables using JDBC Adapter
Hi,
I am trying to insert/update multiple tables using one message via JDBC adapter. The following is the message being posted. However, only the first statement was executed. Anything wrong?
Thanks in advance!
Hart
<?xml version="1.0" encoding="UTF-8"?>
<ns0:DeliveryDBUpdate xmlns:ns0="http://test.com/r3_integration"><DeliveryData><DelHeader action="UPDATE_INSERT"><table>DelHeader</table><access><DelNo>0080000230</DelNo><DelType>LF</DelType><XOverwrite>X</XOverwrite><ShipTo>0000000026</ShipTo><SoldTo>0000000026</SoldTo><Priority>00</Priority><DocDate>02/17/2007</DocDate><GText>CIF Test</GText><DelDate>02/20/2007</DelDate><PickDate>02/20/2007</PickDate><ShipPoint>NO02</ShipPoint><PackCount>00000</PackCount></access><key><DelNo>0080000230</DelNo></key></DelHeader>
<DelItem action="INSERT"><table>DelItem</table><access><DelNo>0080000230</DelNo><ItemNo>000010</ItemNo><GText>10# GRAN-GREAT VALUE</GText><Material>G04410G611</Material><Plant>6005</Plant><SLoc>6005</SLoc><RefDoc>mmenon32</RefDoc><RefItem>00000000</RefItem><DelQty>5.000</DelQty><UOM>BL</UOM></access><access><DelNo>0080000230</DelNo><ItemNo>000020</ItemNo><GText>25# GRAN- GREAT VALUE</GText><Material>G04025G611</Material><Plant>6005</Plant><SLoc>6005</SLoc><RefDoc>mmenon32</RefDoc><RefItem>00000000</RefItem><DelQty>5.000</DelQty><UOM>BG</UOM></access></DelItem></DeliveryData></ns0:DeliveryDBUpdate>Hi,
You need 2 STATEMENT level tags,
<?xml version="1.0" encoding="UTF-8"?>
<ns0:DeliveryDBUpdate xmlns:ns0="http://test.com/r3_integration">
<b><DeliveryData1></b>
<DelHeader action="UPDATE_INSERT">
<table>DelHeader</table>
<access>
<DelNo>0080000230</DelNo>
<DelType>LF</DelType>
<XOverwrite>X</XOverwrite>
<ShipTo>0000000026</ShipTo>
<SoldTo>0000000026</SoldTo>
<Priority>00</Priority>
<DocDate>02/17/2007</DocDate>
<GText>CIF est</GText>
<DelDate>02/20/2007</DelDate>
<PickDate>02/20/2007</PickDate>
<ShipPoint>NO02</ShipPoint>
<PackCount>00000</PackCount>
</access>
<key>
<DelNo>0080000230</DelNo>
</key>
</DelHeader>
<b><DeliveryData1></b>
<b><DeliveryData2></b>
<DelItem action="INSERT">
<table>DelItem</table>
<access>
<DelNo>0080000230</DelNo>
<ItemNo>000010</ItemNo>
<GText>10# GRAN-GREAT VALUE</GText>
<Material>G04410G611</Material>
<Plant>6005</Plant>
<SLoc>6005</SLoc>
<RefDoc>mmenon32</RefDoc>
<RefItem>00000000</RefItem>
<DelQty>5.000</DelQty>
<UOM>BL</UOM>
</access>
<access>
<DelNo>0080000230</DelNo>
<ItemNo>000020</ItemNo>
<GText>25# GRAN- GREAT VALUE</GText>
<Material>G04025G611</Material>
<Plant>6005</Plant>
<SLoc>6005</SLoc>
<RefDoc>mmenon32</RefDoc>
<RefItem>00000000</RefItem>
<DelQty>5.000</DelQty>
<UOM>BG</UOM>
</access>
</DelItem>
<b></DeliveryData2></b>
</ns0:DeliveryDBUpdate>
Try with such a strcuture and let us know if it works.
Regards
Bhavesh -
Hi,
We need your help.
We want to update a table using the MODIFY command but it does not delete the previous entries instead it INSERTs a new entry.
Scenario:
1. Upon calling the Screen for Editing the entry, the previous entry must be deleted
2. When SAVEd, the new entry must replace the previous entry.Make sure that in the definition or your table you have specified the key. Otherwise, the system may "think" that all the fields are part of the key, therefore all lines are different.
This is a extract from SAP's documentation:
"The line to be changed is determined by the fact that the content of the table key matches the content of the corresponding components in the wa work area. For tables with a key that is not unique, the first entry that is found is changed. "
Regards. -
T-Code to update condition table for delivery & transport scheduling to SCM
Hello,
Could you tell the T-code to update condition table for delivery & transport scheduling to SCM system
These are the some SAP fileds
/SAPCN1/KOTABNR (Condition Table)
/SAPCND/KAPPL(Application)
/SAPCND/KSCHL(Condition type)
/SAPCND/KOLNR(Access sequence)
Thanks in Advance
RK
Edited by: RK on Jun 9, 2009 5:58 PMHI
The TCODE for this is /SAPAPO/ATP_GCM.
Regards
Anurag. -
Update sap table using a function module call by php code
Hello,
I m trying to update the table VBAP using a function module ZZ_SET_DISTANCE call by a php code.
But I have this problem:
the saprfc seems to work well but when I look to the table VBAP the fields have not been update.
I tried the function module in debug mode and it work good. The fields are update.
I also handle the saprfc call function and the return SAPRFC_OK
This are the function module ZZ_SET_DISTANCE, and the php code
//PHP CODE
$fce = saprfc_function_discover($sap,"ZZ_SET_DISTANCE");
if (! $fce ) {echo "Echec d'ouverture du module fonction "; exit;}
saprfc_import ($fce,"COMMANDE", '0000001998');
saprfc_table_init($fce,"TBLE_CMDE");
$val=array();
$val['NUM_POST']='000030';
$val['HN_EXP']='';
$val['ST_EXP']='';
$val['PC_EXP']='';
$val['CI_EXP']='';
$val['CO_EXP']='';
$val['HN_REC']='';
$val['ST_REC']='';
$val['PC_REC']='';
$val['CI_REC']='';
$val['CO_REC']='';
$val['DIST']='popo';
saprfc_table_append ($fce,"TBLE_CMDE", $val);
$rfc_rc = saprfc_call_and_receive ($fce);
echo "\n".$rfc_rc;
if ($rfc_rc != SAPRFC_OK) { if ($sap == SAPRFC_EXCEPTION ) echo ("Exception raised: ".saprfc_exception($fce)); else echo (saprfc_error($fce)); }else{echo '/execution de la function ;}
saprfc_function_free($fce);
//FUNCTION MODULE ZZ_SET_DISTANCE
FUNCTION ZZ_SET_DISTANCE.
""Local Interface:
*" IMPORTING
*" VALUE(COMMANDE) TYPE VBELN
*" TABLES
*" TBLE_CMDE STRUCTURE ZADD_COM_LOXAN
DATA : NUMC TYPE VBELN.
NUMC = COMMANDE .
WHILE STRLEN( NUMC ) < 10 .
CONCATENATE '0' NUMC INTO NUMC .
ENDWHILE .
DATA tble_addrcomm LIKE LINE OF TBLE_CMDE .
LOOP AT TBLE_CMDE INTO tble_addrcomm.
DATA : NUMP TYPE POSNR.
NUMP = tble_addrcomm-NUM_POST.
WHILE STRLEN( NUMP ) < 6 .
CONCATENATE '0' NUMP INTO NUMP .
ENDWHILE .
UPDATE VBAP SET ARKTX = tble_addrcomm-DIST
WHERE VBELN EQ COMMANDE
AND POSNR EQ NUMP.
ENDLOOP.
ENDFUNCTION.
Is anybody can help me?
thank.Marie, create a Blog please, about more details for dummies....
1) how to connect to sap system?
2) you run the php code where? in a webserver or where?
3) wich is the url for run the FM: ZZ_SET_DISTANCE
4) you placed some dlls files on the web server?
please is interesting this...
Thanks -
Help on Updating master table using SAP NetWeaver 2004s
Dear BSP ians,
I need to edit,modify multiple records and has to be updated in the master table using MVC. We are using SAP NetWeaver 2004s.
We have gone through the sample codings which is present in the forum already, and we have worked out using Pages with Flow Logic on ECC 6.0 and those are not getting exexcuted for "SAP NetWeaver 2004s".
Help me in this issue.
Points will be rewarded for helpful infos.
Gokul.NMy issue is, the sample codes present alreaady in the forums works in ECC 6.0
But we are using "SAP Netweaver 2004s" -
Try to update a table using resultset and nothing happens
I am trying to update a table in my database.
I already know the row I want to update by the reporttrikid in the where clause.
Nothing happens when I run this code. It does not fail but my table never gets updated.
I have done inserts and selects with no problem, but I must be doing something wrong when it comes to an update.
Can someone please help?
try
conn = XCConfig.getInstance().getConnection();
logger.debug("connection: " + conn);
sql = "UPDATE " + REPORTTABLE + " SET " + REPORTTRKMISC + "=?" +
" WHERE " + REPORTTRKID + "=?" ;
logger.debug(sql);
stmt = conn.prepareStatement(sql);
logger.debug("sql TRKID: " + "");
Iterator it = List.iterator();
while (it.hasNext()){
XCDocPriceFilter filter = (XCDocPriceFilter) it.next();
//filterTrkId = filter.getTRKId();
//trkid = Integer.parseInt(filterTrkId);
trkid = filter.getTRKId();
logger.debug("Update trkid: " + trkid);
stmt.setString(1,trkMisc);
stmt.setInt(2,trkid);
rs = stmt.executeQuery();
}//end iterator
rc = true;
}I am still not getting anything updated.
I am using the following code.
int updateCount = stmt.executeUpdate();
logger.debug(updateCount + " records were updated!");
The logger says it has been updated, when I go to the
table the table has not changed.Is your connection in auto-commit mode? Maybe it hasn't committed it (yet). Did you also remember to close your JDBC resources (rs, stmt, conn)? -
UPDATE a table using COUNT(*)
I was wondering if there's a way to write the following code using a single stmt:
FOR update_rec IN ( SELECT CODE, COUNT(APPOINTMENT) TOT FROM TEST GROUP BY CODE )
LOOP
UPDATE TEST
SET TOT_APPOINTMENT = update_rec.TOT
WHERE CODE = update_rec.CODE;
END LOOP;Regards.Or use MERGE
SQL> create table t as
2 select 'A' code, 1 appointment, 0 tot_appointment from dual union all
3 select 'A' code, 1 appointment, to_number(null) tot_appointment from dual union all
4 select 'B' code, 1 appointment, to_number(null) tot_appointment from dual union all
5 select 'B' code, 1 appointment, to_number(null) tot_appointment from dual union all
6 select 'B' code, 1 appointment, to_number(null) tot_appointment from dual;
Table created.
SQL> select * from t;
C APPOINTMENT TOT_APPOINTMENT
A 1 0
A 1
B 1
B 1
B 1
5 rows selected.
SQL> merge into t
2 using ( select code
3 , count(*) numrecs
4 from t
5 group by code
6 ) c
7 on (c.code = t.code)
8 when matched then update set t.tot_appointment = c.numrecs;
5 rows merged.
SQL> select * from t;
C APPOINTMENT TOT_APPOINTMENT
A 1 2
A 1 2
B 1 3
B 1 3
B 1 3
5 rows selected.
SQL> -
Update a table using same variable name as the column
I am not able to update a table column using a local variable which is having same name as the table column. Example of the function is as follows:
create or replace function trial return integer as
column1 integer:=99;
BEGIN
update firsttable set column1=column1 where column2='john';
return 0;
END;
Existing data in firsttable:
COLUMN1 COLUMN2
123 xyz
123 abcd
101 johnUnfortunately table aliasing won't help... Although specifying the procedure will. Somewhat academic I know, since if you can prefix the procedure name on the variable you can just as easily rename it, unless you happen to have a bunch of other code calling it using named notation possibly.
SQL> select ename, comm from emp where empno = 7934;
ENAME COMM
MILLER
SQL> create or replace procedure new_comm
2 (empno in number, comm in number)
3 is
4 begin
5 update emp e
6 set e.comm = new_comm.comm
7 where e.empno = new_comm.empno;
8 dbms_output.put_line('updated '||sql%rowcount||' rows!');
9 end;
10 /
Procedure created.
SQL> exec new_comm (7934, 100)
updated 1 rows!
PL/SQL procedure successfully completed.
SQL> select ename, comm from emp where empno = 7934;
ENAME COMM
MILLER 100Message was edited by:
3360
Colin beat me to it -
Dear All
How to update SAP Table (Any single or multiple tables) through Java code using JCO. Can any body provide sample code regarding this...
Thanks&Regards
mgreddyHi,
I think for that anyway you will have to use JCO as the middleware to connect to SAP R/3.
So what you can to do is to write three RFCs and call them through JCO from your JAVA application.
1. First BAPI for reading the dictionary information about an SAP table.
2. Second to read data from the table.
3. And, third to write data to that table.
But if you want to edit any table (and not a specific table) then your program will become even more complex since then you will have to pass the table name and information dynamically to the BAPIs.
Best regards,
Guru. -
Updating custom table using call transaction
How to update a custom table using Call Transaction method. How can we use Table control (Module Pool) for this purpose).
Vignesh,
Create a table maintenance transaction for ur custom tables. Check this link for ref...
http://allaboutsap.blogspot.com/2007/04/table-maintenance-in-sap-step-by-step.html
And create a BDC recording and code a program accordingly...
regards,
karthik -
Updating a table using cursor is taking long time in oracle
Hi,
I am working on the oracle database 11gR2. I am trying update a table column which is newly added through cursor. below is the cursor.
BEGIN
FOR lcur_tab IN (select l.LOGIN_ID as login_id, lt.ERROR_CODE as error_code from LOGIN l INNER JOIN LOGIN_TASK lt ON (l.LAST_LOGIN_TASK_ID = lt.LOGIN_TASK_ID) )
LOOP
UPDATE ACCOUNT SET LOGIN_ERROR_CODE = lcur_tab.error_code where ACCOUNT_ID IN (SELECT ACCOUNT_ID FROM LOGIN_ACCOUNT where LOGIN_ID = lcur_tab.login_id ) ;
end LOOP;
commit;
END;
In the cursor we are trying to copy the Login table error_code value to LOGIN_ERROR_CODE of ACCOUNT Table, for the accounts associated with that Login. Here newly added column is LOGIN_ERROR_CODE in account table. this account table have 11million rows in it. when i used the above cursor it took 3hours and still running. So we stopped after that. Is there any way i can change this cursor syntax to update those column values. How can we do this type of updates?
Also i am planning to run thus update in the background . I don't have much knowledge on the PL/SQL stuff. So please help on this.
Thanks in advance.
Edited by: Hari on Mar 21, 2012 10:06 PMIs there a reason that you don't want to do this with a single `UPDATE` statement? That should be quite a bit more efficient.
Something like
UPDATE account a
SET login_error_code = (
select lt.error_code
from login_task lt
join login l on (l.last_login_task_id = lt.login_task_id)
join login_account la on (la.login_id = l.login_id)
where la.account_id = a.account_id )
WHERE EXISTS (
select 1
from login_task lt
join login l on (l.last_login_task_id = lt.login_task_id)
join login_account la on (la.login_id = l.login_id)
where la.account_id = a.account_id );Justin
Maybe you are looking for
-
RE-FX and FM/BCS integration
When trying to post a funds reservation via a lease in contract I get error Message no. FMEF009 - Entry in field Unlimited not allowed; check the field control Has anyone implemented RE-FX with Public Sector and committed via contracts
-
Renaming and renumbering files in order of selection
Lets say I have 99 frames I want to rename in a project (which may have more pictures). I want to rename them in order they were shot and that's how they're displayed. I'm using Batch Change and using a Version Name Format which I created <Custom Nam
-
I have problem in downloading files
when i click download, it asks target folder to save the file,. but the file is not getting downloaded ultimately.
-
Air drop don't work on 4 yr old macbook pro's
I just downloaded Lion on my 4 yr old macbook pro and air drop is one of the features that wont work because my mac is to old in the computer world. I am trying to now find out what else am I gonna not get out of this and why didnt they say that kind
-
Is there a way to outdent the first sentence in a paragraph in Pages?
Is there a way to outdent the first sentence in a paragraph in Pages? The essay is finished and I am just adding some finishing touches to the piece and i Just want to outdent the first sentence in the paragraph but I cant find a way to do this. Can