mission_id, mission_type_id, security_level and code_name.
What i have to do is get the 10 most recent missions and change their security level to the highest one in their mission_type_id but ONLY if code_name length is >7
So far I have this, the problem is that the oracle moans about the order and wants me to close the bracket before the order
sql
UPDATE missions m
SET m.security_level = (
SELECT max(m2.security_level)
FROM missions m2
WHERE m2.mission_type_id = m.mission_type_id
AND length(m2.code_name) > 7
)
WHERE m.mission_ID IN (
Select m3.mission_id
From missions m3
ORDER BY m3.mission_id desc)
i have to display the 10 most costly missions. but if the 11th record has the same cost then it needs to display 11 records instead of 10. how can i do this?
My solution to the following question update 10 rows. It should update only 6 records. Create a copy of the missions table called AM_X_442_2. For missions on this table that meet the following criteria:
1. within the 10 most recent missions 2. length of the first word of the mission code_name exceeds 7 characters
Change the security level to the highest security level found in missions of the same type.
UPDATE AM_X_442_2 am SET am.SECURITY_LEVEL = ( SELECT MAX(amx.SECURITY_LEVEL) FROM AM_X_442_2 am INNER JOIN AM_X_442_2 amx [code]....
I need to return 1 row for each ID1 value - and only the ID2 value of 24 and only the most recently dated record for the multiple ID2 values - query would return:
1246/1/2006410 2247/1/2007360
I have worked and worked on this and I am still stumped (part of the problem may be I am also trying to make this work in Crystal Reports but that is for another day). I need to make this work in Oracle first.
SELECT * FROM ( SELECT 1 ORDR_ID, TO_DATE('01-JAN-2012', 'DD-MON-YYYY') INWD_DATE, 5 SIZE_, 'APD' Colr_CD FROM DUAL UNION ALL SELECT 1 ORDR_ID, TO_DATE('15-JAN-2012', 'DD-MON-YYYY') INWD_DATE, NULL SIZE_, 'KPD' Colr_CD FROM DUAL UNION ALL SELECT 1 ORDR_ID, TO_DATE('16-JAN-2012', 'DD-MON-YYYY') INWD_DATE, NULL SIZE_, 'ALD' Colr_CD FROM DUAL UNION ALL SELECT 2 ORDR_ID, TO_DATE('02-JAN-2012', 'DD-MON-YYYY') INWD_DATE, 9 SIZE_, 'APD' Colr_CD FROM DUAL UNION ALL SELECT 2 ORDR_ID, TO_DATE('05-JAN-2012', 'DD-MON-YYYY') INWD_DATE, 10 SIZE_, '' Colr_CD FROM DUAL UNION ALL
[code]....
Where every first row is the initial entry for an order and following rows are the changes done to the order with modification date
I encountered error ORA-00338 while performing incomplete database recovery:
ORA-00283: recovery session canceled due to errors ORA-00338: log 3 of thread 1 is more recent than control file ORA-00312: online log 3 thread 1: '+DG_REDO/dbase/onlinelog/group_3.267.814820795' Recovery Manager complete.
I performed this recovery on oracle 10g, ASM database.
1. What are possible causes behind this error ORA-00338 ?
2. This error occurs at the start of media recovery, while RMAN is applying archived logs. So does RMAN apply "online REDO" logs after applying "archived" logs required for recovery or before them ?
3. How does rman come to know that online log 3 is more recent than control file ? How can I get scn of online log & control file in my environment ?
Following are few details related to checkpoint scn/change# info. I found in my environment..Before recovery:
I would like to update the complete flag of all the rows of a table except the most recent two rows of each category.
The table has fields like: category - string, item - string, creation_date - string ('YYYYMMDDHHMI'), complete_flag - boolean, etc.
Each category does not have the same amount of records with the same creation_date so I do not want to filter by creation_date. Is there a way to accomplish this?
I have a sub query (already dervived from several other tables) that has a list of children in with the date they started their course (tableofchildren). Child IDs may be duplicated in this query but each record will have unique start dates per child ID.
I have a second sub query which lists workers involved with the children in the first query (tableofworkers). A worker may be responsible for more than one child but has the unique child in the record to identify involvement with the child.
I need to join these queries together to return the child's record with the WorkerName and the AllocatedStartDate of the worker who was most recently involved with the child prior to the date (EnteredCourseDate) the child started their course (OutputWanted) - the worker associated with the child when they started their course.
A couple of points - I need to deploy this into another reporting application that doesn't support cursors etc or the 'With' operator. Also, I tend to join tables/queries in the Where clause so if it's possible that way that would be great.
The controlfiles were corrupted due to some issue. So, I had to restore the recent backed up control file and then restore the database.
The weird thing which I have noticed is that. I tried backing up Yesterday's Control file. So, I would say that the backup pieces it should pick should be from yesterday. however, the backup pieces are getting restored from last week's backup.
I'm not really sure why oracle is not finding my Foreing Key, I'm creating an easy set of table for a company and I'm declaring all Primary keys and foreing keys as necessary and this is my
How can i come to know that which current alert log file is being used for database? Is their a command at database level to find out the current alert log file to which database is using ?
I have read and used the AWR script (mentioned in the page Finding unused index for finding unused customised (Z) indexes in our SAP system using oracle 10.2.0.2 as the SAP database.
But this returns no rows. Is there any precondition? I want to know how much / many times the indexes are used...We are smelling that lot of unused index are there in the database.
i have table with name, count, flag with dublicate records
example
with swayam name , counts are 3, 4 with ramana name, counts are 5,5 with reddy name, counts are 1,2,3
i want to update the flag
if count are same then update one of record (flag='A') and other should be flag='R' if count are different then update the max count (flag='A') and other should be reject remaing (flag='R'). use below quires
CREATE TABLE TEST_DUB ( NAME VARCHAR2(99), V_COUNT NUMBER, FLAG VARCHAR2(1));
Insert into TEST_DUB (NAME, V_COUNT) Values ('SWAYAM', 3); Insert into TEST_DUB (NAME, V_COUNT) Values
Version : Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
I have a source which is of datatype RAW(1). Basic requirement is to convert it into binary, and then lookup the value of the 4th and 6th bit. Is this possible using simple SQL ?
Eg.
DataBinary ----- ------- EF1110 1111
From this binary output, i need to find the value of 4th and 5th bit. So if the 4th bit is 1, I need to perform some operations if 0 then some other.
Create table test_hex_to_bin (col1 raw(1));
INSERT into test_hex_to_bin values ('99'); INSERT into test_hex_to_bin values ('EF'); INSERT into test_hex_to_bin values ('AB');
I am reading Section 4-8 (page 42/216) in the Oracle Database 2-day Developer Guide from here:
[Code]....
It reads:
Suppose that you want to select every employee whose last name has a double vowel(two adjacent occurrences of the same vowel).
Example 4.9 shows how you can do this.
The regular expression ([AEIOU]) represents any vowel. The metacharacter 1 represents the first (and in this case, only) regular expression. The third function parameter, 'i', specifies that the match is case-insensitive.
Example 4.9 Selecting All Employees Whose Last Names Have Double Vowels
SELECT FIRST_NAME, LAST_NAME FROM EMPLOYEES WHERE REGEXP_LIKE(LAST_NAME, '([AEIOU])1', 'i');
Result is similar to:
FIRST_NAME LAST_NAME -------------------- ------------------------- Harrison Bloom Lex De Haan Kevin Feeney Ki Gee Nancy Greenberg Danielle Greene Alexander Khoo David Lee
8 rows selected.
I don't understand how [AEIOU])1 would find a double vowel(two adjacent occurrences of the same vowel).
I am using oracle 10g, i want to know the cost of query. In the explain plan and by auto trace am able to get some query cost, but i dont know how to calculate the query cost.
How i will know the query is costly and take more time..? But i know about the hash table and nested tables in the explain plan. Other than this how to calculate the query cost..?
I have inserted through frontend which is ORACLE ADF and if i want to see those inserted data's in a table then how to check it when i dont know the table names and if there are large number of tables available.. Its I need a solution in this way as i know the values of fields so by giving values alone I want to fetch the table and column names as wherever this values are present...I am already aware about user_tab_columns and user_tables or all_tables .. So i want to try through fetching of tables or column names though values or data's as reference ...