Help in Query to copy same records
Hi, I want to copy same records TEN times. How I can do from query.
Select * from travel_info
Code1 Code2 Code3 Code4 Code5 Code 6
TR Y N Y N TR
/*Desired output - Record should be copied exactly same 10th times*/
Code1 Code2 Code3 Code4 Code5 Code 6
TR Y N Y N TR
TR Y N Y N TR
TR Y N Y N TR
TR Y N Y N TR
TR Y N Y N TR
TR Y N Y N TR
TR Y N Y N TR
TR Y N Y N TR
TR Y N Y N TR
TR Y N Y N TR
Thanks.
>> Hi, I want to copy same records [sic] TEN times. How I can do from query. <<
One the
many ways a row is not like a record is that a row has to have a key. The
goal of all databases is to remove redundancy. You want to create redundancy and destroy any possible key! WHY? You also do not know that a query cannot create new rows; that would require an INSERT INTO statement.
What are you trying to do?
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL
Similar Messages
-
Help with querying a 200 million record table
Hi ,
I need to query a 200 million record table which is partitioned by monthly activity.
But my problem is I need to see how many activities occured on one account in a time frame.
If there are 200 partitions, I need to go into all the partitions, get the activities of the account in the partition and at the end give the number of activities.
Fortunately, only activity is expected for an account in the partition which may be present or absent.
if this table had 100 records, i would use this..
select account_no, count(*)
from Acct_actvy
group by account_no;Must stress that it is critical that you not write code (SQL or PL/SQL) that uses hardcoded partition names to find data.
That approach is very risk, prone to runtime errors, difficult to maintain and does not scale. It is not worth it.
From the developer's side, there should be total ignorance to the fact that a table is partitioned. A developer must treat a partition table no different than any other table.
To give you an idea.. this a copy-and-paste from a SQL*Plus session doing what you want to do. Against a partitioned table at least 3x bigger than yours. It covers about a 12 month period. There's a partition per day - and empty daily partitions for the next 2 years. The SQL aggregation is monthly. I selected a random network address to illustrate.
SQL> select count(*) from x25_calls;
COUNT(*)
619491919
Elapsed: 00:00:19.68
SQL>
SQL> select TRUNC(callendtime,'MM') AS MONTH, sourcenetworkaddress, count(*) from x25_calls where sourcenetworkaddress = '3103165962'
2 group by TRUNC(callendtime,'MM'), sourcenetworkaddress;
MONTH SOURCENETWORKADDRESS COUNT(*)
2005/09/01 00:00:00 3103165962 3599
2005/10/01 00:00:00 3103165962 1184
2005/12/01 00:00:00 3103165962 4
2005/06/01 00:00:00 3103165962 1
2005/04/01 00:00:00 3103165962 560
2005/08/01 00:00:00 3103165962 101
2005/03/01 00:00:00 3103165962 3330
7 rows selected.
Elapsed: 00:00:19.72As you can see - not a single reference to any partitioning. Excellent performance, despite running on an old K-class HP server.
The reason for the performance is simple. A correctly designed and implemented partitioning scheme that caters for most of the queries against the table. Correctly designed and implemented indexes - especially local bitmap indexes. Without any hacks like partition names and the like... -
Hi,
I am Having Condition record for Pricing (PR00) with Key combination as sales org/ Customer/ Material.
Now I want to copy same Record for another customer with same materials
How to do this?
I tried In VK11 in with ref. to option in which i given previous records's ref. system is copying but in this i want to
change customer code but that field is in Grey I m not able to change customer code for the same materials.
regards,
akshayHi
Just make previous record invalid
Just go to VK12 and give the validity date of today.
From 01.12.2008
Valid to 31.12.9999 (21.07.2009)
So from today onwards this condition type will be invalid
Just create the new condition record in VK11 for your different customer.
Now just create new record sales org/ Customer/ Material
1000 / 594944 / M10
New condition record valid.
Regards
Adi -
Select Query Fetching same records multiple time
Hi ABAPers,
I have an issue where the select query is fetching the same records more than one time for particular sale order.
Kindly help to solve the issue.
Thanks in advance..
Here is the Select Query:-
SELECT VBAK~VKORG VBAK~VTWEG VBAK~VBELN VBAK~KUNNR
VBAK~ERDAT VBAK~LIFSK VBKD~INCO1 VBKD~INCO2
VBAP~MATNR VBAP~ARKTX VBAP~MATKL VBAK~BSTNK
VBAK~BSTDK VBAK~KNUMV VBAP~UEPOS VBAP~POSNR
VBAP~KWMENG VBAK~VDATU VBAP~VRKME VBAK~ERNAM VBAK~WAERK
INTO CORRESPONDING FIELDS OF TABLE IT_PENDING FROM VBAK
INNER JOIN VBAP ON VBAK~VBELN = VBAP~VBELN
INNER JOIN VBKD ON VBAK~VBELN = VBKD~VBELN
WHERE
VBAK~VBELN IN SO_VBELN AND
VBAK~ERDAT IN SO_ERDAT AND
( AUART EQ 'OR' OR AUART EQ 'ZEO' OR AUART EQ 'TA' OR AUART EQ 'LP' OR AUART EQ 'ZFOC' ) AND
VKORG IN SO_VKORG AND
VTWEG IN SO_VTWEG AND
SPART IN SO_SPART AND
KUNNR IN SO_KUNNR AND
MATNR IN SO_MATNR AND
MATKL IN SO_MATKL AND
ABGRU EQ '' AND LIFSK <> '35'.
Edited by: Suhas Saha on Jan 14, 2012 3:42 PMHello Suhale,
On retrospection, I found the query in my above response STILL HAS ONE ISSUE. When we are making a left outer join on vbkdposnr = vbapposnr we are only fetching vbkdinco1 and vbkdinco2 values where item level entries exist in VBKD which match with vbkdposnr = vbapposnr.
Actually we should bring inco1 and inco2 from vbkd when a matching entry exists in vbkd where vbkdposnr = vbapposnr and if there is no entry matching vbkdposnr = vbapposnr, then we should fetch inc01 and inco2 from VBKD where posnr = '000000' (i.e., from header).
This is how SAP behaves when you open an item in VA03 and look at inco1 and inco2. They come from the item if an entry corresponding to that item exists in VBKD otherwise they come from VBKD header record (where vbkd~posnr = '000000')
We can't use VBKD in the joins and still be able to do the above. So we need to fetch inco1, inco2 from VBKD separately like below.
FIELD-SYMBOLS: <fs_pending> LIKE LINE OF it_pending.
SELECT vbak~vkorg vbak~vtweg vbak~vbeln vbak~kunnr
vbak~erdat vbak~lifsk "vbkd~inco1 vbkd~inco2
vbap~matnr vbap~arktx vbap~matkl vbak~bstnk
vbak~bstdk vbak~knumv vbap~uepos vbap~posnr
vbap~kwmeng vbak~vdatu vbap~vrkme vbak~ernam vbak~waerk
INTO CORRESPONDING FIELDS OF TABLE it_pending
FROM vbak INNER JOIN vbap
ON vbak~vbeln = vbap~vbeln
WHERE vbak~vbeln IN so_vbeln AND
vbak~erdat IN so_erdat AND
( vbak~auart EQ 'OR' OR vbak~auart EQ 'ZEO' OR
vbak~auart EQ 'TA' OR vbak~auart EQ 'LP' OR
vbak~auart EQ 'ZFOC' ) AND
vbak~vkorg IN so_vkorg AND
vbak~vtweg IN so_vtweg AND
vbak~spart IN so_spart AND
vbak~kunnr IN so_kunnr AND
vbap~matnr IN so_matnr AND
vbap~matkl IN so_matkl AND
vbap~abgru EQ '' AND
vbak~lifsk NE '35'.
LOOP AT it_pending ASSIGNING <fs_pending>.
SELECT SINGLE inco1 inco2
FROM vbkd
INTO (<fs_pending>-inco1,<fs_pending>-inco2)
WHERE vbkd~vbeln = <fs_pending>-vbeln AND
vbkd~posnr = <fs_pending>-posnr.
IF sy-subrc NE 0.
SELECT SINGLE inco1 inco2
FROM vbkd
INTO (<fs_pending>-inco1, <fs_pending>-inco2)
WHERE vbkd~vbeln = <fs_pending>-vbeln AND
vbkd~posnr = '000000'.
ENDIF.
ENDLOOP.
Best regards,
Vishnu Tallapragada. -
When we click on the copy botton record with same name should not be saved
Hi,
Copy button will copy the record with the same name and will save it.our requirement is when we click on the copy botton ,record with same name should not be saved
we are performing this task in custom object 12 and exposed Opportunity Name in the layout.
Records with same Opportunity Name should not save ..when we copy the record
Can we perform any field validation on Opportunity Name field?
Please help
please email me @ [email protected]
Thanks
Srinivas MeruguOpportunities that are assoicated to the same account cannot have the same name. You cannot make this unique for your whole instance. The only way that you could do this would be to create a webservice application that checks this before you save the record.
What about defaulting the name each time this could make the record unique? -
Query to get the records with same last name
I need to write a single sql query to get all records with duplicate last_name's. For example, if tab1 has 4 records:
10 Amit Kumar
20 Kishore Kumar
30 Sachin Gupta
40 Peter Gabriel
then the query should return
10 Amit Kumar
20 Kishore Kumar
id, name,L_name being the 3 columns in table
Apprecite you help.
Thank you
MarySQL> create table mytable (id,name,l_name)
2 as
3 select 10, 'Amit', 'Kumar' from dual union all
4 select 20, 'Kishore', 'Kumar' from dual union all
5 select 30, 'Sachin', 'Gupta' from dual union all
6 select 40, 'Peter', 'Gabriel' from dual
7 /
Table created.
SQL> select id
2 , name
3 , l_name
4 from ( select t.*
5 , count(*) over (partition by l_name) cnt
6 from mytable t
7 )
8 where cnt > 1
9 /
ID NAME L_NAME
10 Amit Kumar
20 Kishore Kumar
2 rows selected.Regards,
Rob. -
Copy all records in a tabular block into another block..
hi guys,
i am in a situation and have to solve it as early as possible.
I have created 2 tabular blocks on my form. Lets say i have created emp block with table emp and emp1 block with the same table emp. I have 2 blocks with same fields. I have execute query in block 1 that is emp and now i want to copy all records of emp block in emp1 block.
i have to do this thru code.
pliz help how to copy records in another block with same fields.
its urgent.
regards, Imran BaigTry with the following code.
If it works let me know.
Regards,
shalauddin.
from Bangladesh.
begin
GO_BLOCK('B2');
first_record;
LOOP
GO_BLOCK('B1');
LAST_RECORD;
IF :SYSTEM.LAST_RECORD='TRUE' THEN
NEXT_RECORD;
:B1.ID:=:B2.ID;
NEXT_RECORD;
GO_BLOCK('B2');
ELSE
:B1.ID:=:B2.ID;
NEXT_RECORD;
GO_BLOCK('B2');
END IF;
IF (:SYSTEM.last_record='TRUE') THEN
EXIT;
ELSE
NEXT_RECORD;
END IF;
END LOOP;
GO_BLOCK('B1');
END; -
Select query for every 1000 records
Hi all ,
Please help me in the issue . I am using select query Select * from table up to 1000 rows for acheving the records but i want this process to retrigger once the process of 1000 records is compleded again it needs to fetch the next 1000 records and process the same . I am changing the status of the processed records once it is processed . Can can one tell me how to retrigger the select query once the 1000 records are processes.
Thanks in advance,Hi Eric,
After selecting the 1000 records, find the key value of the last record. Build up the range as GT. Again use the select query.
For example,
Select * into table lt_data from ztab
where key in r_key
up to 1000 rows.
regards,
Niyaz -
Plz. Help in query. (Urgnet)
Hi, I have a table in which records are as follows
Invoice Nbr. Item Rate Amount
946862 Bis-20 735 2940
946862 Bis-20 504 5040
I want to wirte the query to display the records like
Invoice Nbr. Item Rate Amount Rate Amount946862 CAR20 735 2940 504 5040
Means If same item exists with different rates in same invoice they should display like above
How possible with SQL only
Thanks
HassanHi all,
I am replying this for your information. I used analytical functions and create an in line view. the query gave me the required results. This would help a lot of you. And if there is an error in my query i also would like to correct that.
select a.invoice_id, a.titem_id,
sum(decode(a.seq_no,1,rate_charged,0)) rate1, sum(decode(a.seq_no,1,amount,0)) amount1,
sum(decode(a.seq_no,2,rate_charged,0)) rate2, sum(decode(a.seq_no,2,amount,0)) amount2,
sum(decode(a.seq_no,3,rate_charged,0)) rate3, sum(decode(a.seq_no,3,amount,0)) amount3 ,
sum(decode(a.seq_no,4,rate_charged,0)) rate4, sum(decode(a.seq_no,4,amount,0)) amount4,
sum(decode(a.seq_no,5,rate_charged,0)) rate5, sum(decode(a.seq_no,5,amount,0)) amount5
from (
select invoice_id, ii.titem_id,ii.rate_charged,amount,
row_number() over(partition by equse_gkey order by ii.trate_rate ) seq_no
from invoice_detail ii
where ii.invoice_id in (947753)
and ii.titem_id in (select Id from rates where tserv_id='BIS-20')) a
group by a.invoice_id, a.titem_id
Thanks -
Help with query to do with aggregating for MIN(DATE)
Say i have the following table of data:
Table: TEST
ID TDATE CLIENT VAL
1A 1/10/2005 client1 10
2A 2/10/2005 client1 30
3A 3/11/2005 client2 22
4A 5/10/2005 client2 43
5A 5/10/2005 client2 3
6A 6/10/2005 client3 5
7A 7/10/2005 client3 76
I want to create a query that will retrieve a distinct list of the CLIENT column (ie. in the above table I want only 3 records retrieved in the query as there are only 3 clients) and the corresponding ID and VAL for the client record with the MIN(DATE). In the case where 2 dates are the same, I dont care which record is selected as long as the ID and VAL columns belong to the same record.
For example in the above data I would expect the following returned in the query:
ID CLIENT VAL
1A client1 10
4A client2 43 <- this record could also be 5A, client2, 3
6A client3 5
Please help.Hi Joshua,
You didn't post your Oracle version but I hope it supports analytic functions.
Try as follows:
SQL> select id,
2 tdate,
3 client,
4 val
5 from (select t.*,
6 row_number() over
7 (partition by client order by tdate) rn
8 from test t)
9 where rn = 1;
ID TDATE CLIENT VAL
1A 01/10/2005 client1 10
4A 05/10/2005 client2 43
6A 06/10/2005 client3 5Regards. -
Filter same record in Repeat Region
I would like to know how to filter same record in repeat
region so that it only display once. I hv a table use repeat region
to display 3 fields (title, date, time). My first page only display
title field and when user click on the record at title field, it
will pass URL parameter to second page which will display title and
date filed and when user click on the record under date field it
will again pass URL parameter to third page which display all
field. I want same date in the date field only display once. I try
to use GROUP by date, it works but i cant click the date to pass
URL parameter. Any help would be appreciated.<cfoutput query = "yourQuery" group = "Date">
#Date#
<cfoutput>
#OtherField#
</cfoutput?
</cfoutput> -
Analytic query to select next record
Hi all,
I would like to query the below two table match to ouput.
1.dev_wt 2.dev_map 3.Output Result
To help more clearance please see this image link : http://lh6.ggpht.com/_xL6eBqjW6Yo/TEqnSvlF_FI/AAAAAAAAB0U/i2sclnnaj6g/Untitled-3.jpg
1. dev_wt
PMS_COMP PMS_I PMS_PERF_D PMS_WT PMS_CREATION_D
BBOARD GICEQGROSS 04/01/2001 30 04/05/2001
BBOARD GICST_B 04/01/2001 5 04/05/2001
BBOARD SBGS_B 04/01/2001 65 04/05/2001
BBOARD GICEQGROSS 04/11/2001 30 04/15/2001
BBOARD GICST_B 04/11/2001 5 04/15/2001
BBOARD SBGS_B 04/11/2001 65 04/15/20012. dev_map
GS_CODE GS_I_CODE GS_I_ID MD_ID GS_START_DT GS_END_DT
GICEQGROSS CIWL 304 15 01/04/1998 31/03/2004
GICEQGROSS CIWL 304 2 01/04/2004 31/03/9998
GICST_B GICST_B 3707 15 01/04/2000 31/12/9998
SBGS_B SBGS_B 2231 15 01/04/1992 30/09/2003
SBGS_B SBGS_B 564 15 01/10/2003 31/12/9998I would like to match PMS_I = GS_CODE to retrieve GS_I_CODE and using analytic
query to find next record.
Because I need to select GICEQGROSS record of PMS_PERF_D date and next
GICEQGROSS record of PMS_PERF_D from dev_wt table and put GS_WT_FR and GS_WT_TO of Output result.
***Date is change to YYYYMMDD format
***PMS_WT is devided by 100
*3. Output Result*
GS_I_ID PMS_COMP GS_I_CODE GS_WT_FR GS_WT_TO GS_I_CALC
304 BBOARD CIWL 20010401 20010410 0.3
3707 BBOARD GICST_B 20010401 20010410 0.05
5209 BBOARD SBGS_B 20010401 20010410 0.65PMS_COMP is from dev_wt table
GS_I_CODE is from dev_map table join with dev_wt
GS_WT_FR is from dev_wt table of GS_START_DT
GS_WT_TO is from dev_wt table of next record GS_START_DT where PMS_I ='GICEQGROSS'
Now my difficulty is to select next record of PMS_PERF_D using analytic query. Below
is my query...
SELECT GS_I_ID, PMS_COMP, GS_I_CODE, GS_WT_FR, GS_WT_TO, GS_I_CALC
FROM dev_wt (
SELECT lead(PMS_PERF_D) over(partition by PMS_I order by PMS_PERF_D) as GS_WT_TO
FROM dev_wt where PMS_I ='GICEQGROSS')
left join dev_map on PMS_I = GS_CODE ;Thanks
Edited by: WinZone on Jul 24, 2010 4:46 PM
Edited by: WinZone on Jul 24, 2010 4:50 PMHi,
This query should be fine:
SELECT DISTINCT t2.gs_i_id, pms_comp, t2.gs_i_code,
TO_CHAR
(MIN (pms_perf_d) OVER (PARTITION BY pms_comp, pms_i),
'yyyymmdd'
) gs_wt_fr,
TO_CHAR
(MAX (pms_perf_d) OVER (PARTITION BY pms_comp, pms_i) - 1,
'yyyymmdd'
) gs_wt_to,
pms_wt / 100 gs_i_calc
FROM dev_wt t1, dev_map t2
WHERE t2.gs_code = t1.pms_iREM Same remark as odie: should be "2231" instead ... -
How to find out query for the deleted record.
Hi Guys,
We are using Oracle9i release 1. We are about 5 employees who are working on the same application. All Employee are connected to the same Schema (User)
User: Employee/web
Now one of the user have deleted like 200,000 records from a table. We just want to trace out the query by which these records were deleted.
From which file i can get the log of executed queries so that i can recover the data.
Just want to know the query executed for this deletion of records?
we are using windows server.
Regards,
Imran BaigIf you do not need an exact query, but only the way you can reconstruct the data, LogMiner can be solution for you. Below I have put a simple example you can review it if you want.
[email protected]> create table t201 as select object_id , object_name from all_objects where rownum < 10;
Table created.
[email protected]> select * from t201;
OBJECT_ID OBJECT_NAME
17918 /1005bd30_LnkdConstant
7540 /10076b23_OraCustomDatumClosur
23355 /10297c91_SAXAttrList
14204 /103a2e73_DefaultEditorKitEndP
22920 /1048734f_DefaultFolder
10154 /10501902_BasicFileChooserUINe
23566 /105072e7_HttpSessionBindingEv
23621 /106ba0a5_ArrayEnumeration
9830 /106faabc_BasicTreeUIKeyHandle
9 rows selected.
[email protected]> delete t201 where object_id < 10000;
2 rows deleted.
[email protected]> commit;
Commit complete.
[email protected]> alter system switch logfile;
System altered.
[email protected]> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
1 1 41 10485760 2 YES ACTIVE 58320830 25-MAR-06
2 1 42 10485760 1 NO CURRENT 58348006 25-MAR-06
3 1 40 10485760 1 YES INACTIVE 58293190 25-MAR-06
[email protected]> select * from v$archived_log where sequence# = 41;
RECID STAMP
NAME
DEST_ID THREAD# SEQUENCE# RESETLOGS_CHANGE# RESETLOGS FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME BLOCKS
ARC APP
DEL S COMPLETIO DIC DIC END BACKUP_COUNT ARCHIVAL_THREAD# ACTIVATION#
86 585998848
C:\ORACLE\ORADATA\MOB92\ARCH\ARC00041.001
1 1 41 57407039 20-MAR-06 58320830 25-MAR-06 58348006 25-MAR-06 20282
YES NO
NO A 25-MAR-06 NO NO NO 0 1 2555135919
[email protected]> exec dbms_logmnr.add_logfile('C:\ORACLE\ORADATA\MOB92\ARCH\ARC00041.001',dbms_logmnr.new)
PL/SQL procedure successfully completed.
[email protected]> exec dbms_logmnr.start_logmnr(options => dbms_logmnr.dict_from_online_catalog)
PL/SQL procedure successfully completed.
[email protected]> l
1 select sql_undo, sql_redo
2 from v$logmnr_contents
3 where username = 'MOB' and timestamp > sysdate - 1
4* order by timestamp
insert into "MOB"."T201"("OBJECT_ID","OBJECT_NAME") values ('7540','/10076b23_OraCustomDatumClosur');
delete from "MOB"."T201" where "OBJECT_ID" = '7540' and "OBJECT_NAME" = '/10076b23_OraCustomDatumClosur' and ROWID = 'AAAIE2AAXAAAFVaAAB';
insert into "MOB"."T201"("OBJECT_ID","OBJECT_NAME") values ('9830','/106faabc_BasicTreeUIKeyHandle');
delete from "MOB"."T201" where "OBJECT_ID" = '9830' and "OBJECT_NAME" = '/106faabc_BasicTreeUIKeyHandle' and ROWID = 'AAAIE2AAXAAAFVaAAI';
Best Regards
Krystian Zieja / mob -
Return to same record on previous page after using form
Hi,
I have an application that contains a table with tasks and subtasks (which are linked to a task), and for every task, there is a 'add subtask' link, which links to a form where I can create new subtasks for that task.
My problem is that when I have created a new subtask, and return to the previous page (with the overview of tasks and their subtasks) automatically by clicking the 'create'-button, that the report starts again at line 1. I would like it to go back to the same task for which I just added a subtask.
In my search for the answer, I came across these two discussions on this forum:
Re: navigate to previous record
after edit, return to the table where the record is at the same position
I tried to implement the solution they came up with in those discussions, but it didn't work for me.
The reason of this might be:
- It are old discussions, maybe some things have changed
- I use a standard report with custom template, they do not
- My link is on a field that has the same value for all records, being just a text item 'Add subtask', in the other discussions they made the link on an actual DB-field, in my case this would be for example task_id.
When I try to implement the solution on the second forum exactly (well, not exactly, I did of course adapt this to my situation), there is one step which doesn't work for me. It's the very last step:
"With these values: #LINK_&P2_EMPNO."
When I put the # in there, the button deletes all the information about the link when I click 'Apply changes'. When I don't use the # (just LINK_&P2_EMPNO.) he doesn't delete the information, but the link to the same record doesn't work.
This is how I implemented it:
Source page (overview of tasks and subtasks):
Link attributes: LINK_#TASK_ID#
Target: Page in this application Page: 4 (form)
Item 1: Name: P4_TASK_ID, Value: #TASK_ID#
Item 2 (not important for returning to the source page): Name: P4_YEAR, Value: #YEAR#
Item 3 (not important for returning to the source page): Name: P4_TEAM, Value: #TEAM#
Target (form):
Action when button clicked: Redirect to page in this application
Page: 3 (source page)
With these values: LINK_&P4_TASK_ID.
It doesn't return to the correct record, but the task_id is included in the link as follows (when I tried to create a new subtask for task 02.01.08 and returned to the source page) f?p=37080:3:5503066190863::NO:::LINK_02.01.08 which is almost the same as they say in the discussion: f?p=&APP_ID.:1:&SESSION.::&DEBUG.:2::#LINK_&P2_EMPNO. (missing the '#'-sign and 1 less ':' before the link-item though).
Why isn't it working for me? How can I solve the problem?
Could I get some help with this please? It would be a very useful functionality in my application as there are a lot of records.
Thank you.
Kind regards,
NDGI'm new on Jdev, I'm Pl/sql developer learning Jdev ....
I need to do this on the Task Flow Right? can you give me some stesp to follow?
thank you -
Suggestion for not picking up the same record
Hi All,
I have a plsql procedure that picks up the records from the same table from multiple threads. Different threads should not pick up the same record.
Current Logic:
I am locking the row that has been picked up the current thread and the next thread should pick up the next row but unfortunately i have a problem here, The inner query will pick up the same record until the status of that particular row is changed since I am picking them up in a FIFO order.
I am not able to add the lock row in the inner query since oracle does not support it. Is there any other way to do it simpler?
XXRM_ARM_HEADER
header_id
service_id
XXRM_ARM_LINES
line_id
header_id
status
Query
SELECT dl.header_id, dl.line_id
FROM xxrm_arm_header dh, xxrm_arm_lines dl
WHERE dh.header_id = dl.header_id
AND dh.service_id = 4
AND dl.status = 'REQUEST_RECEIVED'
AND dl.line_id = (SELECT LINE_ID
FROM ( SELECT dl.line_id
FROM xxrm_arm_lines dl,
xxrm_arm_header dh
WHERE dh.header_id = dl.header_id
AND dl.status = 'REQUEST_RECEIVED'
AND dh.service_id = 4
ORDER BY dl.line_id ASC)
WHERE ROWNUM = 1)
FOR UPDATE OF dl.status NOWAIT SKIP LOCKEDRobert Angel wrote:
forgive me if I am naive, but why wouldn't each thread updating its selected rows with a nowait and if exception pick the next range mechanism work?It is not that simple. You can get race conditions between threads as they process the same rows in the same order attempting to "beat" one another by being the first to lock it. The more threads there are, the potentially worse this situation.
There's also the issue of performance. The thread concept (aka parallel processing) in this respect has a single primary aim. Increase performance and scalability. But does it?
How is I/O reduced when 50% or more of the reads done by the thread (to find a row to process) is wasted I/O as rows being read have already been locked by other processes/threads?
The fact remains that if you give the same set of rows to a bunch of threads (e.g. DBMS_JOB processes) for processing, they will contend for the same rows. There will be overheads. There will be wasted I/O.
So what I am suggesting is each thread; -
1. Look for rows unprocessed, I usually use atribute field in e-Business suite for this purpose
2. Attempt to update them with nowait, to INPROCESS
3. If 2 fails, try the next range - repeat until 2 is possible or end of rangeAnd step 3 is the one that will waste I/O and waste time - as the time it spend looking for a row to process could have been spend on actually processing a row.
4. You could also improve this by specialising each thread to have its own preferences, if there exists a mechanism that would mean fair distribution between the threads..Yes, and this is a key factor to removing contention between threads, reducing their I/O overheads and reducing their time being spend on finding unprocessed rows to lock and process.
Then there's Oracle technical issues. On 11gr2 for example, despite using skip locked or nowait (that cannot be used together in a single clause like in 10g), I'm seeing deadlocks when threads contend for the same rows. Same code works fine in 10g without deadlocks. So the approach one chooses need careful testing on that specific Oracle version to ensure it behaves as expected and meets the performance requirements.
Bottom line is that parallel processing is not as straight forward as simply slapping a nowait clause onto a select statement in order to skip locked rows.
Maybe you are looking for
-
Print on Safari set to A4 and I must reset each time ... other applications are ok, how can set US letter as default??
-
Which accessory will work best?
I posted on here less than a month ago asking about the 30-pin to lightning adapter for the iPhone 5, seeing if it would work with my '08 Volkswagen Jettas iPod Adapter. Sadly to say, I should have listened to my gut feeling (but I appreciate the eff
-
Link is disabled in ESS/MSS Overview pages
Anybody has any idea how a link in the overview page is disabled? I have created a service and assigned it to a sub area and it is disabled. The disable checkbox is not checked. Only the "Quick Link" checkbox is checked.
-
Safari crashes while starting under 10.5.1
I just installed Leopard and the 10.5.1 update. Safari doesn't seem to want to start. The icon bounces in the dock for a bit and then the problem report dialog pops up. I tried deleting the preferences file and restarting but the end result i still t
-
Select options : period restriction
Hi, I have one select option Inventory period(S_INVPRD) in my selection screen. I want to restrict the date range to one year period. i.e the user should not be allowed to enter the date range which is more than one year. Could you please help on thi