Retention of records based on the end of the calendar year
Content using WebCenter 11 g and Records Management, I'm looking for a way to create a rule of provision based on the end of a calendar year. For example, the rule might wait two years after the end of the calendar year in which the content item has been published. Does anyone know how to do this? I'm looking for something that is easy to maintain, but right now my best option is to create a metadata field to end of calendar year and then do a little iDoc script to set point which is archived for each content. I would really like to avoid this if possible. Any ideas?
I think what you're trying to do is to "synchronize on the period start date. It is part of the definition of the trigger.
http://docs.oracle.com/cd/E21764_01/doc.1111/e10640/e01_interface.htm#RMDSG620.
Assuming that the trigger is based on the release date:
-An item is activated in June 30, 2016.
-After the date of recording, wait two years. This makes the eligible trigger on June 30, 2018.
- But you want to wait until the end of 2018 to make available.
-Check the above mentioned framework would force alienation to fire on January 1, 2019, instead of June 30, 2018.
Tags: Fusion Middleware
Similar Questions
-
Delete records based on the foreign keys of oracle 11 g
I have a requirement to remove the records from the tables in the order according to
the existing foreign keys.
I for example, the following tables and the pk, fk constraints:
create table one
(aa number (1),)
descr varchar2 (20));
ALTER table one
Add constraint a_pk key (aa) primary;
create table b
(aa number (1),)
descr varchar2 (20));
ALTER table b
Add constraint b_pk key (aa) primary;
create table c
(aa number (1),)
descr varchar2 (20));
ALTER table c
Add constraint c_pk key (aa) primary;
create table a2
(aa number (2),)
id_aa number (1).
descr varchar2 (20));
ALTER table a2
Add constraint a2_pk key (aa) primary;
ALTER table a2
Add constraint a2_fk foreign key (id_aa)
references a (aa);
create table b2
(aa number (2),)
id_aa number (1).
descr varchar2 (20));
ALTER table b2
Add constraint b2_pk key (aa) primary;
ALTER table b2
Add constraint b2_fk foreign key (id_aa)
references b (aa);
create table z
(aa number (3),)
id_aa number (1).
id_bb number (1).
descr varchar (20));
ALTER table z
Add constraint z_pk key (aa) primary;
ALTER table z
Add constraint z_fk1 foreign key (id_aa)
references a (aa);
ALTER table z
Add constraint z_fk2 foreign key (id_bb)
references b (aa);
So, I want to choose the names of the tables in such an order so as
deleting records will succeed...
I built the following sql query (using the recursive subquery factoring):
[p]
with q (r_constraint_name, table_name, constraint_name, lvl) as
(select table_name, constraint_name, r_constraint_name 1 lvl
from user_constraints one
where a.constraint_type = 'P '.
Union of all the
Select b.table_name b.constraint_name, b.r_constraint_name, q.lvl + 1 lvl
from user_constraints b
Join q
on (q.constraint_name = b.r_constraint_name)
where b.constraint_type = 'R '.
)
Select f.table_name, f.constraint_name, f.r_constraint_name, f.lvl
q f
[/ p]
I want the results as the following list:
Table-name
----------------
B2
A2
Z
A
B
C
The table - B2, A2, Z - (in any order) must first referred in the list
because they are based on the other three tables - A, B, C. Thus, in order to remove the
A, B, C table records the B2, A2, table Z records must be beleted first.
The query I posted above has the problem that it displays tables A2, B2 twice
(1 because they have a pk and 2 because they have fk referring A, B relatively tables).
Is there a solution for this problem?
Note: I use db11g v2
I wrote not all relationships of tables user_constraints (only argument constraint_name = r_constraint_name)
Thank you
SIM
I have a requirement to remove the records from the tables in the order according to
the existing foreign keys.
. . .
The table - B2, A2, Z - (in any order) must first referred in the list
because they are based on the other three tables - A, B, C. Thus, in order to remove the
A, B, C table records the B2, A2, table Z records must be beleted first.
Is there a solution for this problem?
Yes - the 'solution' is to use ON DELETE CASCADE, as appropriate or write a procedure that removes tables in the proper order.
The solution is NOT to try to use dynamic sql statements to do so.
You already know the good parent/child relationships. Simply create a procedure that uses the correct order.
Analyses are necessary in any case to determine the proper order AND press the appropriate values to use to remove the appropriate lines
Your DDL for tables and constraints must be in a version control system
Update the procedure when / if new constraints or tables are added to the application
IMHO, you must use dynamic SQL NOT to try to adjust automatically if a new constraint appears. New constraints should not appear by accident - they appear ONLY as part of a well planned release.
-
Poller DB to select records based on the timestamp
Hi all
I want select records from the coloumn timestamp where the timestamp is older than an hour. Is it possible to do this through poller db? I tried but unable to pass the dynamic value (currently - 1 hr)
Thanks in advance!
Eventually create a view based on the timestamp and singled out the dbpoller view.
-
Need to set the attribute of the current record based on the value of the next record
With the help of forms 6, I have a form that displays the list of folders. There may be multiple records with the same ID, but with different expiration dates. I need set attributes for hilite only the record with the latest expiration date. The current list points of interest reviews of future expiration dates - but we found that, sometimes, the subscription is renewed before the expiration date has been reached, causing two records with the same ID with expiry dates in the future.
I can (and do) sort the records by date of expiry and the identification for the record with the latest expiration date is always the last to this ID, so what I want to do is to check the next record to see whether or not it has a different ID. If the current record is the last expiration date, & must be hilited. Because I might want to hilite the current record, I can't simply navigate to another record, according to the description I found, what makes the next_record builtin. Anyone know how I can check for a value in the next record without making the current record?
Thank you.What I would do:
-Create a DB view based on your table and including the function call DRIVE as a separate column.
-Base that block you on this point of view
-If the block is modifiable, set the DML target for the block to your database table. -
unique several record based on the date record selection
Hi experts,
I have a table that contains multiple records for unique identification number now, I select the single record that contains the most recent date.
Here is the structure
Name of Type Null
------ ---- ------------
NUMBER OF ID_P
NAME_P VARCHAR2 (12)
DATE_P TIMESTAMP (6)
Reviews
---------------------
1 loosi 22 August 13 01.27.48.000000000 PM
1 hahahaha August 26, 13 01.28.10.000000000 PM
KK 2 22 August 13 01.28.26.000000000 PM
Emmeline 2 26 August 13 01.28.42.000000000 PM
now I have to select below 2 lines how to write select qurie for this?
1 loosi 26 August 13 01.27.48.000000000 PM
Emmeline 2 26 August 13 01.28.42.000000000 PM
Hello
You can use the ROW_NUMBER analytic function.
I don't have a copy of your table, so I'll use scott.emp to illustrate. In scott.emp, there may be several lines for a single job. To display only 1 row per job, hiredate line with the most recent:
WITH got_r_num AS
(
SELECT empno, hiredate-, deptno, job or whatever columns you want
ROW_NUMBER () taken OVER (PARTITION OF work
ORDER BY hiredate DESC
) AS r_num
FROM scott.emp
-WHERE--if you need a filter put it here
)
SELECT *- or the list of all columns except r_num
OF got_r_num
WHERE r_num = 1
;
What results do you want in the case of links? Depending on your needs, you can add expressions of tiebreaker to the analytical ORDER BY clause or the use of RANK instead of ROW_NUMBER.
I hope that answers your question.
If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.
Point where the above query is to produce erroneous results, and explain, using specific examples, how you get the right results from data provided in these places.
If you change the query at all, post your modified version.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).See the FAQ forum: https://forums.oracle.com/message/9362002
-
Deleting record based on the ID of the main table
Hello
I am trying to remove the news that are published before 2012, but the tables in detail consists the notebook of the child based on the news_id has been. Request certainly simple deletion will not workSQL> desc news Name Null? Type ----------------------------------------- -------- ---------------------------- NEWS_ID NOT NULL NUMBER(14) NEWS_DATE TIMESTAMP(0) SL_ID NUMBER(2) HEADING VARCHAR2(3120) DESCRIPTION VARCHAR2(3900) SQL> desc news_location Name Null? Type ----------------------------------------- -------- ---------------------------- NEWS_ID NUMBER(14) COUNTRY VARCHAR2(32) REGION NUMBER(2) SQL> desc news_product Name Null? Type ----------------------------------------- -------- ---------------------------- NEWS_ID NUMBER(14) PRODUCT_CATEGORY_ID NOT NULL NUMBER(14) PRODUCT VARCHAR2(27) SQL> desc news_service Name Null? Type ----------------------------------------- -------- ---------------------------- NEWS_ID NUMBER(14) SERVICE_ID NOT NULL NUMBER(14) SRVIS VARCHAR2(16) SQL> desc news_info Name Null? Type ----------------------------------------- -------- ---------------------------- NEWS_ID NUMBER(14) SOURCE VARCHAR2(203) ORIGIONAL_NEWS VARCHAR2(3900) HEADING VARCHAR2(3110) SQL> select count(*) from news where TO_CHAR(news_date,'YYYY') < 2012; COUNT(*) ---------- 8759
Please advise and thank you in advanceOnce again, I tell you, do not need ON DELETE CASCADE in the Delete query.
Just use the Delete query like: -.
delete from news where TO_CHAR(news_date,'YYYY') < 2008;
And the child tables are deleted as a result.
-
Restrict the records based on the condition
Select * from EMP where deptno = 10;
O/P:
7782 CLARK MANAGER 7839 JUNE 9, 81 2450 10 7839 KING PRESIDENT NOVEMBER 17, 81 5000 10 7934 MILLER CLERK 7782 JANUARY 23, 82 1300 10 But I need 1 sheet with as described in condition.
If JOB = 'MANAGER' pick this record
If is not available, then choose JOB = 'PRESIDENT' record
If is not available, then choose JOB = ' ' record
A way
Select * from)
Select
EmpNo
ename
work
Manager
hire_date
salary
deptno
, rank() over (stopped in case of job when = "MANAGER", 1).
When job = 'PRESIDENT' then 2
When job = 'CLERK' then 3
4 something else
end
) rnk
from EMP
where deptno = 10
)
where rnk = 1
If there is more than a Manager for example, the result would be more than one line.
If you don't want that one line in these cases use row_number instead of rank.
In this case, you want to refine the order by clause probably.
-
Select records based on the monthly anniversary date
Hello
I have a table with a field of date_added and I want to select records from monthly birthday of this field.
for example. ID, Date_added
1, DECEMBER 10, 2012
2, 11 NOVEMBER 2012
3, 10 MARCH 2012
4, FEBRUARY 28, 2012
5, 30 DECEMBER 2012
So for January 10, 2013, I would like to return the documents 1 and 3 only
I started watching the extract function, but this little falls down to the records at the end of the month. For example, on 28 February, I also include records where 29, 30 or 31 is the day of date_added. So, in the above table, I won't return documents 4 and 5, but retrieves only returns 4.
Is there a simple function to make the request of birthday this month - have I missed something very obvious? Or I have to write a query to explicitly dates at the end of the month? So far I have not found a reasonable solution!
I use 11g
Thank youuser11259857 wrote:
Hi Al,.No I don't think that there is a flaw. For example, the 30 Jan is not the last day of the month, but is June 30. Thus, on 30 January I want only to interrogate all the dates falling on the 30th - 28 February, after already being interrogated on the 28 Jan. However, on 30 June, I would query the 30th of each month, as well as the 31 January, March, may, July, Aug, Oct, dec. February is a special case, being both shorter and a leap year
Thank you
Richard
Hi Richard,
so, we can assume that your needs are:
If the day is the last day of that month, interview the day of the other months being > = day of the current month.
That is to say:
Jan-30 = query only 30 other months
Jan-31 = query only 31 of the other monthsFeb-28 (non-leap years) = question 28, 29, 30 and 31 other months
29 February (leap year) = query 29,30,31 to other monthsMar-30 = query only 30 other months
Apr-30 = query 30 and 31 other monthsThis hypothesis is correct?
If so, then something like this should work:
WITH mydates(id, date_added) AS ( SELECT 1, TO_DATE('10-DEC-2012', 'DD-MON-YYYY') FROM DUAL UNION ALL SELECT 2, TO_DATE('11-NOV-2012', 'DD-MON-YYYY') FROM DUAL UNION ALL SELECT 3, TO_DATE('10-MAR-2012', 'DD-MON-YYYY') FROM DUAL UNION ALL SELECT 4, TO_DATE('28-FEB-2012', 'DD-MON-YYYY') FROM DUAL UNION ALL SELECT 5, TO_DATE('30-DEC-2012', 'DD-MON-YYYY') FROM DUAL ) SELECT id, date_added FROM mydates WHERE (:input_date = LAST_DAY(:input_date) AND TO_CHAR(:input_date,'DD') <= TO_CHAR(date_added, 'DD')) OR TO_CHAR(:input_date,'DD') = TO_CHAR(date_added, 'DD'); with input_date = 28/02/2013 id date_added 4 28/02/2012 5 30/12/2012
Kind regards.
AlPublished by: Alberto Faenza on 10 January 2013 15:21
Added example -
Audio recorder based on the Web in Flash
I need to create a web-based audio recorder. I want to record and play audio data in GSM format (for telephony).
I created the TI in JavaFX that require Java Runtime on the client side
But Flash is preferred as Flash is everywhere and widely used.
Is there a way to do this in Flash?
You should not use FMS. The shared link earlier was one of the examples and you give an idea that is possible through flash. As I said earlier, take a look at the microphone and FileReferece APIs in AS3. Once you are familiar with these and then the following library might be useful for you to reuse or edit them directly: http://www.bytearray.org/?p=1858
-
Filter records based on the selection in adf 11.6
Hello
I have page, on the top section af:table displayed and tabs (af:showdetaiItem), in the section displayed below each tab having slumped workflow as a region (each workflow with the table)
After selecting any line on table top, then should filter the corresponding records on table region taskflow I am able to get the selected value to the region through input parameters task flow.
I have question concern, how to run the workflow after the selection of each row in the table? (see communication of the region)
Please suggest good approach, as appropriate
Thank you
you are correct. by passage of parameter is an approach. Another approach is contextual event...
-
Selection of records based on the flag
Hi all
I have records as follows:
Program name Effective_Date Valid_Flag
N 10/02/2012 ABCD
N 14/02/2012 ABCD
ABCD 20/02/2012 Y
N 01/03/2012 ABCD
N 10/03/2012 ABCD
ABCD 14/03/2012 Y
N 25/03/2012 ABCD
N 26/03/2012 ABCD
N 27/03/2012 ABCD
N 28/03/2012 ABCD
N 29/03/2012 ABCD
ABCD 25/04/2012 Y
I have to write a select statement to keep the first record and then only pull records when the Valid_Flag has changed. The result set should be as below.
Program name Effective_Date Valid_Flag
ABCD 10/02/2012 N - I kept the first record
20/02/2012 ABCD is - Valid_Flag chages to a Y for the first time and so on.
N 01/03/2012 ABCD
ABCD 14/03/2012 Y
N 25/03/2012 ABCD
ABCD 25/04/2012 Y
If there is no change in the flag, I don't have to draw from this record. Please help with suggestions of SQL. Thanks for your time and your help.ssk1974 wrote:
Hi allI have records as follows:
Program name Effective_Date Valid_Flag
N 10/02/2012 ABCD
N 14/02/2012 ABCD
ABCD 20/02/2012 Y
N 01/03/2012 ABCD
N 10/03/2012 ABCD
ABCD 14/03/2012 Y
N 25/03/2012 ABCD
N 26/03/2012 ABCD
N 27/03/2012 ABCD
N 28/03/2012 ABCD
N 29/03/2012 ABCD
ABCD 25/04/2012 YI have to write a select statement to keep the first record and then only pull records when the Valid_Flag has changed. The result set should be as below.
Program name Effective_Date Valid_Flag
ABCD 10/02/2012 N - I kept the first record
20/02/2012 ABCD is - Valid_Flag chages to a Y for the first time and so on.
N 01/03/2012 ABCD
ABCD 14/03/2012 Y
N 25/03/2012 ABCD
ABCD 25/04/2012 YIf there is no change in the flag, I don't have to draw from this record. Please help with suggestions of SQL. Thanks for your time and your help.
In the future, it would be nice if you could provide the sample data as below, I created.
ME_XE?with data as 2 ( 3 select 'ABCD' as col1, to_date('2/10/2012', 'mm/dd/yyyy') as col2, 'N' as col3 from dual union all 4 select 'ABCD' as col1, to_date('2/14/2012', 'mm/dd/yyyy') as col2, 'N' as col3 from dual union all 5 select 'ABCD' as col1, to_date('2/20/2012', 'mm/dd/yyyy') as col2, 'Y' as col3 from dual union all 6 select 'ABCD' as col1, to_date('3/01/2012', 'mm/dd/yyyy') as col2, 'N' as col3 from dual union all 7 select 'ABCD' as col1, to_date('3/10/2012', 'mm/dd/yyyy') as col2, 'N' as col3 from dual union all 8 select 'ABCD' as col1, to_date('3/14/2012', 'mm/dd/yyyy') as col2, 'Y' as col3 from dual union all 9 select 'ABCD' as col1, to_date('3/25/2012', 'mm/dd/yyyy') as col2, 'N' as col3 from dual union all 10 select 'ABCD' as col1, to_date('3/26/2012', 'mm/dd/yyyy') as col2, 'N' as col3 from dual union all 11 select 'ABCD' as col1, to_date('3/27/2012', 'mm/dd/yyyy') as col2, 'N' as col3 from dual union all 12 select 'ABCD' as col1, to_date('3/28/2012', 'mm/dd/yyyy') as col2, 'N' as col3 from dual union all 13 select 'ABCD' as col1, to_date('3/29/2012', 'mm/dd/yyyy') as col2, 'N' as col3 from dual union all 14 select 'ABCD' as col1, to_date('4/25/2012', 'mm/dd/yyyy') as col2, 'Y' as col3 from dual 15 ) 16 select * 17 from 18 ( 19 select 20 col1, col2, col3, 21 lag(col3) over (partition by col1 order by col2 asc) as last_flag 22 from data 23 ) 24 where last_flag != col3 25 or last_flag is null; COL1 COL2 COL LAS ------------ -------------------------- --- --- ABCD 10-FEB-2012 12 00:00 N ABCD 20-FEB-2012 12 00:00 Y N ABCD 01-MAR-2012 12 00:00 N Y ABCD 14-MAR-2012 12 00:00 Y N ABCD 25-MAR-2012 12 00:00 N Y ABCD 25-APR-2012 12 00:00 Y N 6 rows selected. Elapsed: 00:00:00.08 ME_XE?
See you soon,.
-
Query - remove duplicate records, based on the value of a field
Hello
Please view the information below,
How to delete records when his number 0
AND these records (name) repeat with count > 0
Thank you.existing data name loc count ------------------------------------------------------------------------ aaa a1 10 aaa a1 0 bbb b1 0 ccc c1 0 dcc d1 11 dcc d1 0 required output --------- name loc count ------------------------------------------------------------------------ aaa a1 10 bbb b1 0 ccc c1 0 dcc d1 11 remove these records - ----------- aaa a1 0 dcc d1 0
I guess that loc always matches the name. Thus, to find the lines of stay is just a simple group of
with data as( select 'aaa' name,'a1' loc,10 count from dual union all select 'aaa','a1',0 from dual union all select 'bbb','b1',0 from dual union all select 'ccc','c1',0 from dual union all select 'dcc','d1',11 from dual union all select 'dcc','d1',0 from dual ) select name , loc , max(count) cnt from data group by name , loc order by name , loc NAME LOC CNT aaa a1 10 bbb b1 0 ccc c1 0 dcc d1 11
to find that the other is just a minus
with data as( select 'aaa' name,'a1' loc,10 count from dual union all select 'aaa','a1',0 from dual union all select 'bbb','b1',0 from dual union all select 'ccc','c1',0 from dual union all select 'dcc','d1',11 from dual union all select 'dcc','d1',0 from dual ) select name,loc,count from data minus select name , loc , max(count) cnt from data group by name , loc order by name , loc NAME LOC COUNT aaa a1 0 dcc d1 0
would be a delete
delete from data where (name,loc,count) in (select name,loc,count from data minus ..
concerning
-
Select a record based on the date field MAX
I have the following query that works, but does include all the necessary columns. I need to JOIN the run_events table, which is a child of the runroute table, such that I choose not only the run_code and max event_timestamp, but also the LATITUDE, LONGITUDE columns. Each run_code has many events associated with it.
Any help or pointers would be appreciated!
Thank you
I've included descriptions of output and query table
WITH
ETV as (select run_code
-, LATITUDE, LONGITUDE
max (event_timestamp) TS
of run_events
Run_code group
)
SELECT all THE RR.run_code,
substr(PODDept.POD_NAME,1,10) DEPT,
To_char (ETD ' HH: mi: SS AM') r_ETD,.
To_char (ATD, ' HH: mi: SS AM') r_ATD,.
substr (PODDest.POD_NAME, 1, 10) Dest,
To_char (ETA, "HH: mi: SS AM'") r_ETA,.
To_char (ATA, ' HH: mi: SS AM') r_ATA
-- , VTE. LATITUDE, ETV. LONGITUDE
to_char (VTE. TS, ' dd-mm-yyyy hh: mi: SS AM') TS
OF routerun RR
PADE LEFT JOIN PODDest ON RR. PODEST_CODE = PODDest.POD_ID
LEFT JOIN PADE PODDept ON RR. PODEPT_CODE = PODDept.pod_id
ETV LEFT JOIN ON RR.run_code = VTE.run_code
WHERE ATA IS NULL
ORDER BY RR. ETA, RR. RUN_CODE
/
SQL > @rpt_runroute.sql
RUN_CODE DEPT R_ETD DEST R_ETA R_ATA TS R_ATD
--------------- ---------- --------------- --------------- ------------------ --------------- --------------- ----------------------
2013432247 NORFOLK 23:39:59 CHERRY PT 02:00 07/10/2013 01:00:15
NEW YORK 20:45:03 2013432224 CRESCENT B 06:00 10/07/2013 12:52:28 AM
2013432242 BALTIMORE 22:33:23 SALISBURY 10/07/2013 12:39:28 AM
Descriptions of table
PADE
Name Null? Type
---------------------- -------- --------------------------------------------------
POD_ID NOT NULL NUMBER (10)
POD_LONGITUDE NUMBER (10.6)
POD_LATITUDE NUMBER (10.6)
POD_NAME VARCHAR2 (64)
ROUTERUN
Name Null? Type
---------------------- -------- --------------------------------------------------
RUN_CODE NOT NULL VARCHAR2 (15)
REMARKS VARCHAR2 (1024)
PODEST_CODE NUMBER (10)
PODEPT_CODE NUMBER (10)
ETD DATE
ATD DATE
ETA DATE
ATA DATE
RUN_EVENTS
Name Null? Type
---------------------- -------- --------------------------------------------------
RUN_CODE NOT NULL VARCHAR2 (15)
EVENT_TIMESTAMP NOT NULL DATE
EVENT_CODE NOT NULL VARCHAR2 (6)
LONGITUDE NUMBER (10.6)
LATITUDE NUMBER (10.6)
Hello
One way is to use the MAX function analytical rather than the MAX aggregate, like this:
WITH
ETV as (select run_code
LATITUDE, LONGITUDE
, event_timestamp-* ADDED *.
, max (event_timestamp) OVER (PARTITION BY run_code)-* CHANGED *.
as TS
of run_events
-Group by run_code-* REMOVED *.
)
SELECT all THE RR.run_code,
substr(PODDept.POD_NAME,1,10) DEPT,
To_char (ETD ' HH: mi: SS AM') r_ETD,.
To_char (ATD, ' HH: mi: SS AM') r_ATD,.
substr (PODDest.POD_NAME, 1, 10) Dest,
To_char (ETA, "HH: mi: SS AM'") r_ETA,.
To_char (ATA, ' HH: mi: SS AM') r_ATA - if ATA is NULL, what's the point?
ETV. LATITUDE, ETV. LONGITUDE
to_char (VTE. TS, ' dd-mm-yyyy hh: mi: SS AM') TS
OF routerun RR
PADE LEFT JOIN PODDest ON RR. PODEST_CODE = PODDest.POD_ID
LEFT JOIN PADE PODDept ON RR. PODEPT_CODE = PODDept.pod_id
ETV LEFT JOIN ON RR.run_code = VTE.run_code
AND VTE.event_timestamp = VTE.ts-* ADDED *.
WHERE ATA IS NULL
ORDER BY RR. ETA, RR. RUN_CODE
/
If you would care to post, CREATE TABLE and INSERT statements for some sample data and the results you want from this data, then I could test it.
What happens if there is a tie for the final event_timestamp (i.e. 2 or more lines with the same exct run_code and event_timestamp)? You can use the analytic ROW_NUMBER function instead of MAX.
-
Separate records, based on the condition of a table
Hello PL/SQL gurus and experts.
I use Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64-bit Production version
I have table-
Note - Table do not have a primary key on Order_ID.
I want to go get these Order_ID who have Active Flg as NULL and do not have the entry for Active_Flg = YDROP TABLE T; create table T(Order_ID,Active_Flg) as select '201002', 'Y' from dual union all select '201002', '' from DUAL union all select '201003', '' from dual union all select '201004', 'Y' from DUAL union all select '201004', '' from dual union all select '201005', '' from DUAL ;
If use the following, then it returns the distinct Order_ID but not the expected-
Result-SELECT DISTINCT ORDER_ID FROM T WHERE ACTIVE_FLG IS NULL;
Kindly help...ORDER_ID ------ 201004 201002 201003 201005
This?
select order_id from ( select order_id , active_flg , count(decode(active_flg, 'Y',1)) over(partition by order_id) cnt1 , count(decode(active_flg, null,1)) over(partition by order_id) cnt2 from t ) where cnt1 = 0 and cnt2 > 0;
-
Select records based on the value
Hello
I have a table with 3 fields,
and I want to choose single route_id for a po_number where the cost is highWITH t1 AS(SELECT 'P1' po_number,'R1' route_id,1900 route_cost FROM dual UNION ALL SELECT 'P1','R2',2300 FROM dual UNION ALL SELECT 'P1','R3',1100 FROM dual UNION ALL SELECT 'P2','R7',1200 FROM dual UNION ALL SELECT 'P2','R8',4500 FROM dual) SELECT * FROM T1 PO_NUMBER ROUTE_ID ROUTE_COST P1 R1 1900 P1 R2 2300 P1 R3 1100 P2 R7 1200 P2 R8 4500
and my output should be
Thank youPO_NUMBER ROUTE_ID ROUTE_COST P1 R2 2300 P2 R8 4500
San
Published by: sandeep9 on April 9, 2011 04:22WITH t1 AS( SELECT 'P1' po_number,'R1' route_id,1900 route_cost FROM dual UNION ALL SELECT 'P1','R2',2300 FROM dual UNION ALL SELECT 'P1','R3',1100 FROM dual UNION ALL SELECT 'P2','R7',1200 FROM dual UNION ALL SELECT 'P2','R8',4500 FROM dual ) SELECT po_number, max(route_id) keep(dense_rank last order by route_cost) route_id, max(route_cost) route_cost FROM T1 GROUP BY po_number / PO RO ROUTE_COST -- -- ---------- P1 R2 2300 P2 R8 4500 SQL>
SY.
Maybe you are looking for
-
As soon as I go on youtube that Firefox crashes. I have Firefox and the latest Flash
I removed all plugins. Deleted Firefox. Reinstalled Firefox. Deleted Firefox again and remove the plugins/extensions. As soon as I install the latest version of Flash and go somewhere like youtube.com, Firefox disappears from the display. If I turn o
-
Skype create history entries in Internet Explorer for taboola sites
Hi all I found that when I open Skype, and ads in the interface are loaded, a couple of entry appear in my browser Internet Explorer 11 story... See the link trc.taboola network: https://TRC.taboola.com/MSN-Skype-Italy/log/3/available https://TRC.tab
-
Thai language is not rendered correctly
First of all, I want to tell you thank you for making this app. The beta version works quite well on my device, but there is a problem that I don't know if I could call it a bug or not because this seems odd somehow. Thai alphabet is not rendered cor
-
Satellite Pro A300: How to recover the Vista operating system
My friend has a Toshiba Satellite Pro A300 it has a 4 GB of ram, but on Windows Xp shows only 3 GBI also want to put in place the back of the Vista, but I can't not insatall any operating system (only the Toshiba Xp dvd)(there is a HDD recovery folde
-
PcCtlCom Module stopped working and was closed
When I turned on my Inspiron 1720 this morning above is what greeted me with the content: "A problem with the application to stop functioning properly. Windows will notify you if a solution is available. » In the meantime, I am unable to UPDATE NOW