Help delete statement
Hi allWe have the following text:
create table tt1 (c1 varchar2(10), c2 varchar2(10));
insert into tt1 values('AA','11');
insert into tt1 values('AA','11');
insert into tt1 values('AA','11');
insert into tt1 values('AA','11');
insert into tt1 values('AA','11');
insert into tt1 values('BB','22');
insert into tt1 values('BB','22');
insert into tt1 values('BB','22');
insert into tt1 values('BB','22');
I want to remove expandable lines... If the output should be:AA 11
BB 22
and other lines to remove. We don't have a singularity.
Any ideas?
Version: 10g
Thanks in advance,
Bahchevanov.
There are several methods:
AskTom: Duplicate deletion of records
AskTom: Duplicate deletion of records without using rowid, and rownum
AskTom: to remove duplicate records
Tags: Database
Similar Questions
-
Need help to set a DELETE statement.
I have a table that contains the records of files. Files come in a bouquet each week. So, we need to delete records from a table to the corresponding fields and load the table with up-to-date data.
In doing so, the DELETE statement takes a long time. Need help with this setting.
Here are the details.
(1) total number of records in the table: 23 million records.
(2) approximate records deleted each time: 500 K to 1.5 million.
(3) table is partitioned on a PERIOD key. That is, each partition will have the data for a given period.
(4) table is not indexed
(5) removal occurs on a combination of 2 fields (PERIOD + BATCH).
Here is the query and the plan:
===========================================================
SQL > EXPLAIN PLAN SET STATEMENT_ID = 'TSH' FOR
2 REMOVE / * + PARALLEL(DETAIL_UNKNOWN,10) * / u DETAIL_UNKNOWN
3 WHERE u.FLBATCHID = 'PCAFRINTERMAR1105' AND u.N_PER6 = 201214
4;
He explained.
SQL > SET LINESIZE 130
SQL > SELECT * FROM TABLE (DBMS_XPLAN. DISPLAY ('PLAN_TABLE', 'TSH', 'ALL'));
PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------
Hash value of plan: 2400300449
----------------------------------------------------------------------------------------------------
| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time | Pstart. Pstop |
----------------------------------------------------------------------------------------------------
| 0 | DELETE STATEMENT. 596K | 12 M | 838 (9) | 00:00:12 |
| 1. REMOVE | DETAIL_UNKNOWN |
| 2. SIMPLE HASH PARTITION | 596K | 12 M | 838 (9) | 00:00:12 | 6. 6.
|* 3 | TABLE ACCESS FULL | DETAIL_UNKNOWN | 596K | 12 M | 838 (9) | 00:00:12 |
----------------------------------------------------------------------------------------------------
PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------
Name of the query block / Alias object (identified by the operation identity card):
-------------------------------------------------------------
1 LED$ 1
3 LED$ 1 / U@DEL$1
Information of predicates (identified by the operation identity card):
---------------------------------------------------
3 - filter("U".") FLBATCHID '= 'PCAFRINTERMAR1105' AND 'U'." N_PER6 "= 201214)
PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------
Projection of the column information (identified by the operation identity card):
-----------------------------------------------------------
2 - (cmp = 2, 3) "U". ROWID [ROWID, 10], "U". "N_PER6" [NO.22], 'U' "." " FLBATCHID ' [VARCHAR2, 20].
3 - « U ». ROWID [ROWID, 10], "U". "N_PER6" [NO.22], 'U' "." " FLBATCHID ' [VARCHAR2, 20].
27 selected lines.
===========================================================
Need your suggestions on how the query / table can be tuned.Hi Anand,
I wanted to check why your tkprof Watch report two executions of the statement:
call count cpu elapsed disk query current rows ------- ------ -------- ---------- ---------- ---------- ---------- ---------- Execute 2 2315.71 2480.17 0 3351 624489 611765
In fact, it there was only a single execution of the DELETE statement. The trace file begins with a call EXEC of any statement without call analysis
*** TRACE DUMP CONTINUED FROM FILE XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX_ora_241708.trc *** EXEC #1:c=20000,e=13996,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=0,tim=32472879711702 ===================== PARSING IN CURSOR #2 len=68 dep=0 uid=72 oct=42 lid=72 tim=32472883567994 hv=740818757 ad='0' ...
TKProf aggregates this EXEC call with call EXEC of the DELETE statement because they have the same location of cursor (#1), he thinks it was the same cursor.
PARSING IN CURSOR #1 len=93 dep=0 uid=72 oct=7 lid=72 tim=32472889974030 hv=1242910589 ad='e5979d80' DELETE from detail_unknown where n_per6 = 201214 and FLBATCHID = 'PCAFRINTERMAR1105' END OF STMT PARSE #1:c=0,e=11462,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=1,tim=32472889974024 ... EXEC #1:c=2315710000,e=2480213492,p=0,cr=3691,cu=624489,mis=0,r=611765,dep=0,og=1,tim=32475370187626
So, the question about two executions is closed - there was only a single run.
The performance - 2315,71 seconds of time processor is absolutely huge for such amount of work. It looks like a bug.
First, I propose to check the time without compression. If your environment allows this kind of testing try to decompress the partition and re - run on unpacking data DELETION.
10.2 find the name of the partitionselect partition_name from dba_tab_partitions where table_name = 'DETAIL_UNKNOWN' and partition_position = 6
After that
alter table DETAIL_UNKNOWN modify partition
nocompress; alter table DETAIL_UNKNOWN move partition ; and run again the button DELETE.
What is the operating system on the server?
-
Hi all
In the table of audit_organizations_test, I want to delete all records except those returned returned in the following select statement:
How can I dial a delete statement to do this?select * from audit_organizations_test ao where last_updt_date >= '01-jan-2008' union select * from (select * from audit_organizations_test ao where org_id not in (select aoo.org_id from audit_organizations_test aoo where aoo.last_updt_date >= '01-jan-2008') ) x where x.last_updt_date = (select max(ao1.last_updt_date) from audit_organizations_test ao1 where x.org_id = ao1.org_id
Thank you.Hello
delete from audit_organizations_test where rowid not in (select rowid from audit_organizations_test ao where last_updt_date >= '01-jan-2008' union select * from (select * from audit_organizations_test ao where org_id not in (select aoo.org_id from audit_organizations_test aoo where aoo.last_updt_date >= '01-jan-2008') ) x where x.last_updt_date = (select max(ao1.last_updt_date) from audit_organizations_test ao1 where x.org_id = ao1.org_id )
Concerning
Anurag -
I need help deleting a folder named, Windows Live Safety\HistoryStore,
I need help deleting a folder named Windows Live Safety\HistoryStore, I am running windows XP with service Pack 3, this particular file is read-only and hidden also can you help me please.
Joseph Borg.
I think that you need to uninstall the family safety program, take a look at this web page under XP: -.
http://Windows.Microsoft.com/en-us/Windows-Live/Family-Safety-remove-uninstall-FAQ
It will be useful.
-
I need help deleting these accounts quickly because I'm not going to use the most.
Cancel/delete email
Hello look at these emails I created just a mess.
I need help deleting these accounts quickly because I'm not going to use the most.
I want just all my information wiped out of these emails
& When they are removed and all of my information are wiped out, I want these emails to become available and new to others for their use.
E-mail address is removed from the privacy *.
E-mail address is removed from the privacy *.
E-mail address is removed from the privacy *.
E-mail address is removed from the privacy *.
E-mail address is removed from the privacy *.
E-mail address is removed from the privacy *.
E-mail address is removed from the privacy *.
E-mail address is removed from the privacy *.
E-mail address is removed from the privacy *.
E-mail address is removed from the privacy *.
E-mail address is removed from the privacy *.
E-mail address is removed from the privacy *.
E-mail address is removed from the privacy *.
E-mail address is removed from the privacy *.
E-mail address is removed from the privacy *.
Please thank you.
It is just a JOKESTER, but you're talking about Hotmail accounts? If so, please ask here.
Windows Live Solution Center Hotmail Forum
http://windowslivehelp.com/forums.aspx?ProductID=1 -
[CORRECTION] Optional clause in the DELETE statements.
Hello
I have always used the FROM clause in a delete statement.
Delete * from TableName.
Now I'm confused, is optional FROM?
Delete TableName is equivalent to Delete * from Tablename?user12022313 wrote:
HelloI have always used the FROM clause in a delete statement.
Delete * from TableName.
Now I'm confused, is optional FROM?
Yes, it is not compulsory.
>Delete TableName is equivalent to Delete * from Tablename?
It is equivalent, but would be better coded as
TRUNCATE TABLE TableName
-
Delete statement does not work properly
Hello
The following delete statement does not work correctly.
If I press DELETE will delete everything in the table of categories
I don't know whats wrong with it.
-Delete category line if there is not the infrastructure to support-
IF: P12_DFCY_SEQNO4 IS NOT NULL AND: P12_DFCY_CATG_C = "7" THEN
REMOVE FROM DFCY_CATG
IF NOT EXISTS (SELECT I.DFCY_SEQNO
OF DFCY_CATG C, DFCY_CATG_INFRSTRCTR I
WHERE C.DFCY_SEQNO = I.DFCY_SEQNO
AND: P12_DFCY_SEQNO4 = I.DFCY_SEQNO);
end if;
Thank you
MaryYou probably the where more clause:
DELETE FROM DFCY_CATG WHERE C.DFCY_SEQNO = :P12_DFCY_SEQNO4 AND NOT EXISTS(SELECT I.DFCY_SEQNO FROM DFCY_CATG C, DFCY_CATG_INFRSTRCTR I WHERE C.DFCY_SEQNO = I.DFCY_SEQNO AND :P12_DFCY_SEQNO4 = I.DFCY_SEQNO);
Not sure if this is the exact name of your column in the table, but that limit the scope of deleting just a record that you control.
Hope it will be useful,
Aaron
-
DEADLOCK DETECTED - DELETE statement - how/why he expects in SHARING mode?
Hello
I wonder if anyone can advise here. The environment is:
Microsoft Windows 2003 Server
Standard Oracle 10.2.0.4 Edition
We had a deadlock detected in our application on a customer site - I enclose the corresponding part of the trace file below. While we think we have found the reason for the deadlock (looks like it is due to a foreign key in cascade), I'm confused as the lock mode that is requested.
Here is the track information:
It seems to me like session * 481 * trying to do a deletion when the block is raised:Deadlock graph: ---------Blocker(s)-------- ---------Waiter(s)--------- Resource Name process session holds waits process session holds waits TX-00120012-00003b59 28 475 X 29 481 S TX-000a0029-0003508b 29 481 X 28 475 X session 475: DID 0001-001C-000F96B0 session 481: DID 0001-001D-00000079 session 481: DID 0001-001D-00000079 session 475: DID 0001-001C-000F96B0 Rows waited on: Session 481: no row Session 475: obj - rowid = 00014625 - AAAUYlAAIAAAAawAAo (dictionary objn - 83493, file - 8, block - 1712, slot - 40) Information on the OTHER waiting sessions: Session 481: pid=29 serial=18261 audsid=202192707 user: 51/info O/S info: user: SYSTEM, term: our_term, ospid: 5244:940, machine: our_machine program: our_exe.exe client info: GUI application name: app, hash value=3864155245 action name: our_action, hash value=3631189430 Current SQL Statement: DELETE FROM TABLE_1 T WHERE T.T_ID = :B1 End of information on OTHER waiting sessions. Current SQL statement for this session: UPDATE TABLE_1 T SET T.STATUS_ID = :B2 WHERE T.T_ID = :B1
and ask which mode (dynamique31) S .DELETE FROM TABLE_1 T WHERE T.T_ID = :B1
(also the 'no line' for lines didn't wait)---------Blocker(s)-------- ---------Waiter(s)--------- Resource Name process session holds waits process session holds waits TX-00120012-00003b59 28 475 X 29 481 S
I thought it would be in mode (e) X (clusive) (for the line being deleted). Actually Yes, I set up a test of fast and simple locking and mode (e) X (is) expected the final delete .Session 481: no row
So, am I misinterpreted the tracing information, or is the DELETE statement requesting the lock in mode S (Hare)? If this is the case, I'd appreciate a quick explanation of how/why it's...
Kind regards
ADOSI think we have almost the same reason to wait in S mode as in [single key application | http://books.google.pl/books?id=14OmJzfCfXMC&dq=oracle+wait+interface+practical+guide&q=unique+key+enforcement].
If two sessions want to insert the same key value, the other must wait, because the outcome depends on a commit / rollback of the first session. In the case of validation, session 2 must generate an error in case of cancellation, it must insert his record.In the test provided by ADOS, at session 1 there is an insert in session 2 - delete. The result of the delete operation depends, once again, commit or rollback in the first session. In the case of validation, it must remove, and cancellations, there is nothing to remove.
If the insert in session 1 has been replaced by the Update, there is no S lock but 'normal' eXclusive
Bartek
-
simple help with a delete statement
Hello guys
I have a table like this
with these valuesCREATE TABLE FWENCUM ( "FWENCUM_FUND" VARCHAR2(6 BYTE), "FWENCUM_GRNT" VARCHAR2(9 BYTE), "FWENCUM_ORG" VARCHAR2(6 BYTE), "FWENCUM_PROG" VARCHAR2(6 BYTE), "FWENCUM_ACCT" VARCHAR2(6 BYTE), "FWENCUM_ACTV" VARCHAR2(6 BYTE), "FWENCUM_LOCN" VARCHAR2(6 BYTE), "FWENCUM_INDCOST_BUDGET" NUMBER(17,2), "FWENCUM_GRANT_TOTAL" NUMBER(17,2), "FWENCUM_FUND_TOTAL" NUMBER(17,2), "FWENCUM_BUDGET_FUND" NUMBER(17,2), "FWENCUM_YTD_FUND" NUMBER(17,2), "FWENCUM_INDCOST_YTD" NUMBER(17,2), "FWENCUM_INDCOST_COMM" NUMBER(17,2), "FWENCUM_ERROR" VARCHAR2(2 BYTE), "FWENCUM_AMOUNT_ENCUMBER" NUMBER(17,2) )
Basically, I want to delete all the lines where the amount ofREM INSERTING into FWENCUM Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('240051','240051','07171','01','7623',' ',' ',131635,34865.08,96873.92,-104,null,null,null,null,-104); Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420461','420420','04720','02','7623',' ',' ',15600,12287.6,0,124783.52,null,null,null,null,3312.4); Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420462','420420','04330','02','7623',' ',' ',15600,7372.56,0,124783.52,null,null,null,null,8227.44); Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420456','420420','23040','02','7623',' ',' ',26000,5810.01,0,124783.52,null,null,null,null,20189.99); Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420421','420420','04100','02','7623',' ',' ',15600,12287.6,0,124783.52,null,null,null,null,3312.4); Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420422','420420','06370','02','7623',' ',' ',31200,27066.52,0,124783.52,null,null,null,null,4133.48); Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420423','420420','23050','02','7623',' ',' ',15600,10171.91,0,124783.52,null,null,null,null,5428.09); Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420424','420420','04340','02','7623',' ',' ',15600,0,0,124783.52,null,null,null,null,15600); Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420451','420420','23050','02','7623',' ',' ',26000,24078.7,0,124783.52,null,null,null,null,1921.3); Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420452','420420','22070','02','7623',' ',' ',26000,4050.97,0,124783.52,null,null,null,null,21949.03); Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420453','420420','18350','02','7623',' ',' ',26000,9502.1,0,124783.52,null,null,null,null,16497.9); Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420454','420420','04340','02','7623',' ',' ',26000,426.38,0,124783.52,null,null,null,null,25573.62); Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420455','420420','09060','02','7623',' ',' ',26000,1561.25,0,124783.52,null,null,null,null,24438.75); Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420460','420420','04310','02','7623',' ',' ',15600,12287.6,0,124783.52,null,null,null,null,3312.4); Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420458','420420','05690','02','7623',' ',' ',26000,0,0,124783.52,null,null,null,null,26000); Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420457','420420','18110','02','7623',' ',' ',26000,3543.58,0,124783.52,null,null,null,null,22456.42);
more then the unique value underfwencum_amount_ecumber
by grant code in other words the expected output should be delete 15 ranks.fwencum_grant_total for that grant
because the sum of fwencum_Amount_encumber granting 420420 would be higher then the 124,783.52 under the fwencum_grant_Total
I tried to do this, but I keep getting errors I get a little advice.
Here is my poor attempt
Published by: mlov83 on Sep 22, 2011 19:24DELETE fwencum WHERE (select sum(f.fwencum_amount_encumber) from fwencum f) > (SELECT DISTINCT FWENCUM_GRANT_TOTAL FROM fwencum F, FWENCUM F2 WHERE F.fwencum_grnt=F2.FWENCUM_GRNT);
Hello
Thanks for posting the CREATE TABLE and INSERT statemnts; It is very useful.
It seems that only 3 columns play no role in this issue. If so, why you send messages 16 colummns?What you want (if I understand the problem) is to do a correlated subquery , where the subquery refers to something in the main charge and (potentially) so does something different for each line of the main declaration, like this:
DELETE fwencum m -- m is for main WHERE fwencum_grant_total < ( SELECT SUM (fwencum_amount_encumber) FROM fwencum WHERE fwencum_grnt = m.fwencum_grnt ) ;
-
Help deleting photos in album and 'Photos' in the Apple photo software?
I want to remove the file from the photo of an album created, but also removed it from my 'Photos' / 'All the Photos' (sometimes described as unicameral roll) on my library of MacBook Pro Photos without having to go through the button remove the process twice. Someone knows a shortcut?
My approach:
I download my photos from my camera and then divide them into 'Albums' I really hate the film. It's like having 17 000 photos in a big shoebox by date order. Its incredibly difficult to see all the pictures of a season of baseball and football, etc. because they are scattered in several weeks/months. I take all the pictures belonging to an 'event' (birthday, baseball, football season) and create an album date/name for it. Now that my photos are well ranked in "events" I can look and throw the bad ones. However, when I remove the album, the picture always ends in the film. I want it completely removed from my laptop that I don't want the clutter and the need to preserve space. I then have to go again in the "Photos / camera roll" or "All Photos" and find the photos I just delete the album and then delete them again. It is very hard and heavy. Can I use a Smart Album query and search for all photos Non-Album. If I made my picture original assignments album properly, all the photos I removed from said album should show in the query. If I can do a delete everything in this smart album.
I want just a simpler method to remove/take a photo from an album that he has permanently removed from my laptop.
Is it possible that I can choose to have a question pop up when deleting which States "do you want this / these photos deleted from the album only or moved to the recently deleted zone? Or y at - it a solution I'm missing?
MacBookPro, OS X El Capitan, version 10.11.1, Version 1.2 (340.4.0) Photos
Thank you!!
Remove Photos from a photo 1.2 library
1. regardless where you are in the library, i.e. Moments, collections, albums, smart albums or projects, select the photos you want to remove, use the command + delete keyboard shortcut to move the photos to the recently deleted smart album.
2 - Click on the albums smart recently deleted in the sidebar.
3. in the recently deleted album, you can opt to leave the photo automatically delete after the 30-day waiting period is in place, remove them immediately or restore them in the library.
NOTE: deleting a photo from an album, slideshow, book, etc., only the delete key only deletes this picture of this element. Removal of a photo of a Moment or the Collection removes ALL occurrences of this photo in the library.
-
Hello everyine,.
I'm working on a state machine. I saw a few videos of the same thing and I need help.
I have attached the code below.
My problem is that I can not jump since the first case at the last.
After the execution of the first case I want LabVIEW to check fot the Boolean control attached to the function select. I used an operator oux during the operation. If the condition of "TERMINATE" is satisfied that I want him to be the last case of local variable is used to turn off the START light.
at the moment I can't go to the latter case. I want the code to keep control of the State, and whenever the user presses the button END the LED should turn off little matter the time of execution.
PL suggest ways to accomplish a task... am still a beginner
Concerning
Jalashwa
Hi Sindhurakshak,
You are welcome. I think that the problem still resides on the Structure of the event to the State "WBS". I can suggest the following (say that everything always ends by WBS what I understand of your current code):
Remove select it and create a new case event for Boolean switch «end». Location of the enum to cancel in this case, as shown below:
The above change means that if the value of "end" Boolean switch is changed (assuming that this will change to true), the case of the event will be held event 'end', which will then the enum value 'End' to the transition of change. Let's say that if the Boolean key 'end' has not changed (which means that has not been pressed), it should run the rest as shown below:
I'll leave the enum value 'WBS' in the time-out period, assuming you want the State to always run the "WBS" idle state, unless you press the key 'end' to trigger the transition "Terminate".
It may be useful
Warm greetings,
Lennard.C
-
Missing parenthesis on a delete statement
Hi all, I have a problem, this script does not work (I changed the names of tables and fields to my company privacy):
Start
delete from TABLE1
WHEN THERE IS)
Select G.FIELD1
, lpad (cm.c001, 6,' ') LIKE Field2
cm.c002 AS field3
cm.c003 AS FIELD4
m.codart AS sphere5
cm.c005 AS case FIELD6
cm.c006 AS FIELD7
nvl(cm.c007,0) AS FIELD8
of apex_collections cm
Join TABLE2 on c.FIELD2 = lpad c (cm.c001, 6,' ')
Join TABLE3 g on g.FIELD2 = lpad (cm.c001, 6,' ')
Join table 4 m on m.FIELD0 = rpad (cm.c004, 32,' ')
where g.FIELD10 = 'C '.
and g.FIELD2 = lpad (cm.c001, 6,' ')
and collection_name = "COLLECTION1.
order of seq_id
);
APEX_COLLECTION. CREATE_OR_TRUNCATE_COLLECTION ("COLLECTION1");
end;
because it gives me the error:
Report error-
ORA-06550: line 20, column 3:
PL/SQL: ORA-00907: lack the right parenthesis
ORA-06550: line 3, column 1:
PL/SQL: SQL statement ignored
06550 00000 - "line %s, column % s:\n%s".
* Cause: Usually a PL/SQL compilation error.
* Action:
I do not understand where is the missing parenthesis...
Now, then you should do something like:
delete from TABLE1
WHERE (column, column, column, column, column, column, column, column))
Select G.FIELD1
, lpad (cm.c001, 6,' ') AS Field2
cm.c002 AS field3
cm.c003 AS FIELD4
m.codart AS sphere5
cm.c005 AS case FIELD6
cm.c006 AS FIELD7
nvl(cm.c007,0) AS FIELD8
of apex_collections cm
Join TABLE2 on c.FIELD2 = lpad(cm.c001,6) c
Join TABLE3 g on g.FIELD2 = lpad(cm.c001,6)
Table 4 m on m.FIELD0 = rpad(cm.c004,32) join
where g.FIELD10 = 'C '.
and cm.collection_name = 'COLLECTION1.
);
or
remove table 1 t
WHEN THERE IS)
Select null
of apex_collections cm
Join TABLE2 on c.FIELD2 = lpad(cm.c001,6) c
Join TABLE3 g on g.FIELD2 = lpad(cm.c001,6)
Table 4 m on m.FIELD0 = rpad(cm.c004,32) join
where g.FIELD10 = 'C '.
and cm.collection_name = 'COLLECTION1.
and t.key1 = g.field1
and t.key2 = lpad(cm.c001,6)
...
);
HTH
-
Difference between DELETE statements
Hello
What is the difference between these statements to delete
a. DELETE TABLE_NAME WHERE COLUMN_NAME =: B1
and
b. DELETE FROM TABLE_NAME WHERE COLUMN_NAME =: B1
Is there any problem with the performance?
Thank you
SKWelcome to the forum!
Whenever you post, provide your Oracle version 4-digit.
>
What is the difference between these statements to deletea. DELETE TABLE_NAME WHERE COLUMN_NAME =: B1
and
b. DELETE FROM TABLE_NAME WHERE COLUMN_NAME =: B1Is there any problem with the performance?
>
No difference. They are a single statement.It is probably more common to use the delete FROM statement, but Oracle itself doesn't care that one you use.
If you look at the diagram of the syntax in the SQL language Doc, you'll see that the word FROM is optional
http://docs.Oracle.com/CD/E11882_01/server.112/e26088/statements_8005.htm#i2112830 -
In bulk FORALL delete statement it requires a lot of time
Hello
When I run block FORALL delete instruction it requires much time even to 10 lines deletion.so how to avoid this problem? I checked SGA_TARGET and max_size and PGA_TARGET cureent_size are the same for both. Is there is problem of memory?
Thanks in advance
VaibhavPlease look at this:
http://psoug.org/definition/limit.htm
If you add the LIMIT 100 part to your query to collect your bulk / construction forall will treat 100 records per part.
This will avoid to fill with undo tablespace / PGA in memory.There is also a weather of discussion to use 100 LIMIT or LIMIT 1000 (or MORE).
It depends on what your system can handle, if it is a declaration of production occupied, I would stick to a value of 100.
Reason for this, is that your request will not be a huge amount of PGA.DECLARE TYPE t_id_tab IS TABLE OF test.c1%TYPE; l_id_tab t_id_tab := t_id_tab(); Begin dbms_output.put_line(DBMS_UTILITY.get_time); select c1 bulk collect into l_id_tab from TEST where c1<=150000 LIMIT 100; FORALL i IN l_id_tab.first .. l_id_tab.last delete from TEST where c1= l_id_tab(i); commit; dbms_output.put_line(DBMS_UTILITY.get_time); End;
We use this construction to load data into our warehouse and pushed the LIMIT 100 part during the test.
He did speed things up considerably.(Risky!) something else is to do:
-- exclude table from archivelogging ALTER TABLE TEST NOLOGGING; -- execute plsql block
-- enable logging on the table ALTER TABLE TEST LOGGING; The risky part, is that you get incompatible in this way archivelogging because your losses are not recorded.
When you perform a restore of backup and want to roll forward until the last change in your archive logs, you won't miss these deletions, and your table is not consistent with the rest of your database.In our warehouse situation that we don't mind, the data gets updated every night.
I hope this helps!
Robin
-
Nesting help DECODE statements
Hello. I'm writing a sql script to generate the data for payments report. I need to integrate specific to the field of ADDRESS VACUUM lines to REMOVE conditions. I'm using Address_Line1, Address_Line2, Address_Line3, most CITY, STATE, ZIP as Address_Line4. If all fields are empty, I need to remove the blank line and back up the other lines.
Here is my if, THEN, ELSE conditions. There are 9 possible scenarios that I have identified. Can you please help me write this in SQL with the DECODE function?
IF CITY||STATE||ZIP IS NULL THEN AD1='12115 Rainbow Road', AD2='Hartford Heights, MO 60226' ELSE IF ADDRESS_LINE1 IS NULL IF ADDRESS_LINE2 IS NULL IF ADDRESS_LINE3 IS NULL THEN USE HOME ADDRESS ELSE vAD1=ADDRESS_LINE3, vAD2=CITY||STATE||ZIP ENDIF ELSE IF ADDRESS_LINE3 IS NULL THEN vAD1=ADDRESS_LINE2, vAD2 = CITY||STATE||ZIP ELSE vAD1=ADDRESS_LINE2, vAD2=ADDRESS_LINE3, vAD3=CITY||STATE||ZIP ENDIF ENDIF ELSE IF ADDRESS_LINE2 IS NULL IF ADDRESS_LINE3 IS NULL THEN vAD1=ADDRESS_LINE1, vAD2=CITY||STATE||ZIP ELSE vAD1=ADDRESS_LINE1, vAD2=ADDRESS_LINE3, vAD3=CITY||STATE||ZIP ENDIF ELSE IF ADDRESS_LINE3 IS NULL THEN vAD1=ADDRESS_LINE1, vAD2=ADDRESS_LINE2, vAD3=CITY||STATE||ZIP ELSE vAD1=ADDRESS_LINE1, vAD2=ADDRESS_LINE2, vAD3=ADDRESS_LINE3, vAD4=CITY||STATE||ZIP ENDIF ENDIF ENDIF ENDIF
This what I've got so far... DECLARE vADR1 vADR2 vADR3 vADR4 BEGIN SELECT DECODE( END; /
Hello
Interplay says:
...
Here's the script:WITH got_delimited_list AS ( SELECT address_line1 || ' +' || address_line2 || ' +' || address_line3 || ' +' || ...
This is equivalent to
SELECT (address_line1 || ' ') || '+' || (address_line2 || ' ') || '+' || (address_line3 || ' ') || '+' || ...
You are guaranteeing to all areas will result in a space, and therefore may not be NULL.
Lose the spaces before the signs +:SELECT address_line1 || '+' || address_line2 || '+' || address_line3 || '+' || ...
Published by: Frank Kulash on Feb 3, 2010 10:04
Sorry, my fault. My original post had this error.
Maybe you are looking for
-
How can I get Google or bing instead of ask?
How can I get rear window?
-
'Facebook' pop-up window crashes Safari on iPhone
iPhone 5 s. IOS older. IPhone woman. Safari opens and is blocked by a window that pretends to "you have been selected for a special offer" and completely blocks use Safari except when we click to override the window. It's from a source of 'Facebook'
-
Outlook express 6 in windows xp slow at the reception of the mail how to fix
my outlook express 6 in windows xp is very slow in receving mail. It seems to take up to an hour to receive messages, that I even go to the icon that says send/receive, and then click on that and it shows a little fill a box, then when it is filled w
-
SM BUS controller installation
i've got trouble installing driver SM BUS controller for my laptop HP 655 . Please someone show me how to do this.
-
Hello! My T42 is running XP and the Wired internet connection works great, but I can't seem to find the correct drivers or something else so he can pick up wireless connections (and my Linksys router). It is a portable alternative to my father's Of