Set View To Show Records Equal To Date?

Sep 14, 2007

I have set up a view that pulls news & events records.

SELECTc.priority, c.startDate, p.headline, p.newsID, p.kicker, p.category, p.webPath, p.makePopup, p.thumbnail, p.shortDesc, p.storyType
FROM(so_news p LEFT OUTER JOIN so_news_deptLevel c ON p.newsID = c.newsID) LEFT OUTER JOIN so_departments d ON d.deptID = c.deptID

[Code].....

For events I want only the events that have a p.startDate equal to today. I have tried setting that line up a few different ways.

p.startDate = sysDate didn't provide any records for events
p.startDate = TO_CHAR(sysDate, 'MM/DD/YYYY') freaked the system out and nothing appeared for either parts of the union

how to output only events that are for today?

View 3 Replies


ADVERTISEMENT

SQL & PL/SQL :: Value For Closest Or Equal Date

Aug 23, 2013

I have two tables e.g. test_bb and test_sub

I would like to select test_sub.price as per the below conditions. If test_bb.value_date, test_bb.vehicle matches to test_sub.value_date,test_sub.vehicle then display test_sub.price

If there is no match then as above find the closest test_sub.value_date which is less than test_bb.value_date and select corresponding test_sub.price for the same vehicle combination.

e.g.

select * from test_sub;
VEHICLE VALUE_DAT PRICE
---------- --------- ----------
10 12-APR-12 2
10 08-JAN-10 4
10 14-APR-14 6
10 06-AUG-47 8
20 24-JAN-14 10
20 20-FEB-06 12
20 18-FEB-04 14
20 28-FEB-06 16
20 22-DEC-07 19
8 rows selected.

select * from test_bb;
VEHICLE VALUE_DAT
---------- ---------
10 12-APR-12
10 10-FEB-10
20 24-JAN-14
20 22-FEB-08

Required output:
VEHICLE PRICE VALUE_DAT
---------- ---------- ---------
10 2 12-APR-12
10 4 08-JAN-10
20 10 24-JAN-14
20 19 22-DEC-07

create table test_bb(vehicle number, value_date date);

begin
insert into test_bb values(10,to_date('12-04-2012','dd-mm-yyyy'));
insert into test_bb values(10,to_date('10-02-2010','dd-mm-yyyy'));
insert into test_bb values(20,to_date('24-01-2014','dd-mm-yyyy'));
insert into test_bb values(20,to_date('22-02-2008','dd-mm-yyyy'));
end;
/

create table test_sub(vehicle number, value_date date,price number);

begin
insert into test_sub values(10,to_date('12-04-2012','dd-mm-yyyy'),2);
insert into test_sub values(10,to_date('08-01-2010','dd-mm-yyyy'),4);
insert into test_sub values(10,to_date('14-04-2014','dd-mm-yyyy'),6);
insert into test_sub values(10,to_date('06-08-1947','dd-mm-yyyy'),8);
insert into test_sub values(20,to_date('24-01-2014','dd-mm-yyyy'),10);
insert into test_sub values(20,to_date('20-02-2006','dd-mm-yyyy'),12);
insert into test_sub values(20,to_date('18-02-2004','dd-mm-yyyy'),14);
insert into test_sub values(20,to_date('28-02-2006','dd-mm-yyyy'),16);
insert into test_sub values(20,to_date('22-DEC-2007','dd-mm-yyyy'),19);
end;
/

I could write as below but I would like to know if there is a better way of doing it.

select bb.vehicle
,sub.price
,bb.value_date
from test_bb bb
,test_sub sub
where bb.vehicle=sub.vehicle
[code].........

View 8 Replies View Related

Forms :: Expiry Date To Automatically Show A Date 15 Years After Initial Date

Apr 12, 2010

I have a two date fields in my form; valid from date and expiry date.

Currently my valid from date has an inital value property of $$date$$ which automaitcally brings up todays date.

I need my expiry date to automatically show a date 15 years after this date?

View 8 Replies View Related

SQL & PL/SQL :: Create A View To Show Counter For Occurrences?

Jul 24, 2011

I am trying to create view that selects a number of rows from a table and has a calculated field which is a counter form 1 to n next to each row.

In the below example, s_name is repeated many times each with a differnet serial, I want to cteate a view that shows a counter for the occurences of s_name next to the serial.

CREATE TABLE XYZ
(
SERIAL NUMBER PRIMARY KEY,
S_NAME VARCHAR2(30)
);
INSERT ALL
INTO XYZ VALUES (1, 'ABC')
INTO XYZ VALUES (11, 'ABC')

[code].....

View 3 Replies View Related

SQL & PL/SQL :: External Table Does Not Show All Records

Jun 24, 2010

I have an external table as follows:

CREATE TABLE EXT1
(
COL1 NVARCHAR2(2000),
COL2 CLOB
)
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY FILE_DIR
ACCESS PARAMETERS
( RECORDS DELIMITED BY NEWLINE
FIELDS TERMINATED BY '|'
MISSING FIELD VALUES ARE NULL
( "COL1" CHAR,
[code]....

From here I can count all records and the total number of records matching the file record count, but could not read the clob columns. it's not picking up the values. but if I take this out

( "COL1" CHAR,
"COL2" RAW
)

then I am missing the record counts.Also if you put all varchar and char, that also missing the count against the file.

View 6 Replies View Related

New Tables And Indexes Created Not Show In Dba-segments View?

Aug 8, 2012

I have created 3 tables and some indexes, but these objects do not show up in dba_segments view. Is this a normal behaviour? Previously, with dictionary managed tablespace, I can specify the minimum extent to create, when the table/index is created. But I'm not sure how the locally managed tablespace work.

I'm using Oracle 11g R2 (11.2.0.1.0) for Microsoft Windows (x64), running on Windows 7.For the purpose of reproducing this issue, I have created the tablespaces as follow:

CREATE TABLESPACE CUST_DATA
DATAFILE 'd:appasusoradataorcl11gr2CUST_DATA01.DBF' SIZE 512K
AUTOEXTEND ON NEXT 256K MAXSIZE 2000K
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 256K
SEGMENT SPACE MANAGEMENT AUTO;

[code]...

View 2 Replies View Related

SQL & PL/SQL :: Show End Date Based On Next?

May 19, 2010

How to write a single query for the below scenario?I got only start date column, but I need show the end date based on next (start date-1). For the last row, need to show the same date in the end date column.

For Example:I have the data as shown below,

Start date End date
1-Jan-10
3-Mar-10
3-May-10
5-Jul-10
1-Aug-10

I wanted to output as shown below

Start date End date
1-Jan-10 2-Mar-10
3-Mar-10 2-May-10
3-May-10 4-Jul-10
5-Jul-10 31-Jul-10
1-Aug-10 1-Aug-10

View 10 Replies View Related

SQL & PL/SQL :: Show Date In Form With Abbreviated Name Of Day

Dec 1, 2010

i want to show the date exactly in following format:

00:16:15 Wed 1st Dec 2010

I have tried :
select to_char(to_date('01/12/2010 00:16:15' , 'dd/mm/yyyy hh24:mi:ss'), 'hh24:mi:ss Day dd Mon yyyy')
from dual

Result it is giving
00:16:15 Wednesday 01 Dec 2010

How to show date in form 1st 2nd 3rd and so on?
How to show Abbreviated name of the day?

View 13 Replies View Related

Forms :: How To Show Total Number Of Records In Text Item

May 3, 2013

I have a multi record field of five rows. And 3 values.

the values are

IT
CSE
ECE

And i have one text item name is COUNT.

how to show the total number of records in Text item .

View 10 Replies View Related

Creating A View To Show Employee Names / Age And Total Number Of Projects Assigned

Apr 14, 2009

I have following tables:

EMPLOYEE (E-Number, Name, Department, age)
ASSIGNMENT (E-Number, P-Number )
PROJECT( P-Number, Project, Manager)

Create a view to show employee names, age and total number of projects they are assigned to

View 2 Replies View Related

Reports & Discoverer :: Show Date In DD/MM/YYYY Format

Jan 2, 2013

I have a date column , and i want to show the date in 'DD/MM/YYYY' format for eg days with 2 digit or comming properly but when it comes to single digit the 0 is not comming for example 4/11/2012 should come as 04/11/2012 like 16/11/2012 , i even did the conversion like to_char(rh_dt,'DD/MM/RRRR').

View 4 Replies View Related

Application Express :: Show Input After Selecting Date In Datepicker?

Jun 11, 2012

I'm using apex 4.1.1 And i want to use a Date Picker item on my page. This works, but.. When a user selects a date you can see the date highlighted. But in the "textarea"corresponding tot the datepicker is not showing the date. This shows the date after clicking the close button.

I would like to show the date directly after selecting a new date.

View 7 Replies View Related

SQL View Showing Non-related Records?

Jun 27, 2011

I'm trying to get a list of values from a table, and I am just not seeing the answer -I have a table with 4 records (say A, B, C, and D), each record has a GUID to uniquely identify it.I have a 2nd table that holds the relationships (parent-child).

At this point, I have 2 rows:
A>B
A>C

So, A is a parent to B, and A is a parent to C (D is not related to anything at this point)

I would like to be able to go into the D record and see that it is NOT related to A (A would be the parent in this instance) - the trick however is I only want 1 instance of A to show up.attempted to use some inner/outer join qualifications and I just cannot seem to get the data to display properly.

View 1 Replies View Related

SQL & PL/SQL :: Query From The View Returning Zero Records

Feb 27, 2012

Im running the following query in DB - Prod2

select *
from t_act_rwrd_reimb_stay a
where reimbursed_amt < 0
and invoice_date = '01-JAN-1900'
and not exists ( select 'x' from t_act_rwrd_reimb_stay b
where a.GPM_ID_STAY = b.GPM_ID_STAY
and reimbursed_amt > 0 )

The above table t_act_rwrd_reimb_stay --> is from a view on the database Prod2 and this view is pulling the data from the database prod1 via dblink

When I run the same query on Prod1 it returns 3 rows. Is there any reason this is not fetching data on prod2 view? or whatz wrong with the above query

or for example if I run the above query as follows with the dblink "@prod1" it returns the data properly

select *
from t_act_rwrd_reimb_stay@Prod1 a
where reimbursed_amt < 0
and invoice_date = '01-JAN-1900'
and not exists ( select 'x' from t_act_rwrd_reimb_stay@prod1 b
where a.GPM_ID_STAY = b.GPM_ID_STAY
and reimbursed_amt > 0 )

View 10 Replies View Related

PL/SQL :: All Users To Be Able To View All Records From Table

Aug 1, 2013

I need all users to be able to view all records from table TABLE1. I would like to provide insert/ update/ delete privilege if the column "TABLE1"."UPD" = 'Y'. If TABLE1.UPD = 'N', then the users can only do select on the record. I don't know if the roles can handle based on row values.

View 5 Replies View Related

Application Express :: To Change The Default Behavior Of Hide / Show Region To Show

Jun 26, 2012

I am trying to change the default behavior of Hide/Show Region to show, after some attempts i got it partially working but now clicking the icon to toggle hide/show doesn't work also changed the icons and added type="" but its not working.

View 16 Replies View Related

Fast Way Of Inserting 60 Millions Of Records From A View To A Table?

May 8, 2012

which is the fast way of inserting 60 millions of records from a view to a table.

method 1:

create table t_temp_table as select * from v_dump_data;

method 2:

through bulk collect

---Bulk_Collect With FORALL----------
DECLARE
TYPE srvc_tab IS TABLE OF t_temp_table%ROWTYPE;
l_srvc_tab srvc_tab := srvc_tab();
l_start_time NUMBER;
l_end_time NUMBER;
l_error_count NUMBER;

[code].....

View 4 Replies View Related

Replication :: Oracle Materialized View / Deletion Of Records

Nov 13, 2009

One question reg Materialized views.

If as part of housekeeping of the Source database we delete some records (older records), will the materialized view also be updated with the deletion? I believe the answer is yes. In that case can we ensure that this delete does not happen?

Is there anyway we can prevent MView refresh from deleting the records that is once inserted even if we delete the same records in source DB?

View 3 Replies View Related

SQL & PL/SQL :: Count Of Records On Each Date?

Jan 26, 2011

PART_REF REGISTERED_BYREGISTERED_DATE
DCA544519 SVK 1/3/2011
DCA544520 SJA 1/3/2011
DCA544539 SJA 1/3/2011
DCA544572 THS 1/3/2011
DCA544608 GKA 1/3/2011
DCA544610 GKA 1/3/2011
DCA544611 THS1 1/3/2011

I just want a to get the total number of records registerd on particular date by particular user...

View 4 Replies View Related

SQL & PL/SQL :: How To Get Records Based On Max Date

May 18, 2011

I am trying to get records from a table based on date column. I should retrieve records if the date column is NULL

and if it is not null ,i shud get the records of MAX date.

How would i do this. Below is my query,by which i can get records based on either maxdate or Null date

select c.id, c.status,c.u_gr_code,
from
(
select id, status,u_gr_code,date_col,
max(record_valid_from) over (partition by entity_user_gr_id, status_id) max_date
[code].........

View 10 Replies View Related

Find Records That Have Most Current Date?

Apr 13, 2004

I have two tables

table_1
--Emp_id--|--Sup_id--|Sup_name|--Date--|
-------------------------------------------------
--00001--|--00005 --|---ABCD--|01-MARCH-2004
--00002--|--00006 --|---BCDE--|02-MARCH-2004
--00003--|--00007 --|---CDEF--|03-MARCH-2004
--00001--|--00008 --|---DEFG--|04-APRIL-2004
--00003--|--00009 --|---EFGH--|05-APRIL-2004

table_2
--Emp_id--|Emp_name|
--------------------------------
--00001--|--QWER--|
--00002--|--ASDF--|
--00003--|--ZXCV--|
--00004--|--POIU--|

table_1 contain records on employee and the supervisor they are under at a certain date.

As some employee(00001 & 00003) have a different supervisor from different date, I'll like to extract from table_1 the record of each employee in the table that only contain the supervisor info on the most recent date.And from table_2, i'll like to extract the employee's name. These records extracted from both the tables would the be put into a new table,table_3

Example: For employee 00001, only extract record that have the most recent date which is 04-APRIL-2004 and not on 01-MARCH-2004

table_3
Emp_id|Emp_name|Sup_id|Sup_name|Date|
------------------------------------------------
00001 |--QWER--|00008 |--DEFG---|04-APRIL-2004
00002 |--ASDF-- |00006 |--BCDE---|02-MARCH-2004
00003 |--ZXCV-- |00009 |--EFGH---|05-APRIL-2004

How to write an SQL statement to perform this?

View 6 Replies View Related

SQL & PL/SQL :: MAX DATE - Getting Records Out Of Source Table

Sep 28, 2011

Below is my requirement,

Source Table: SRC

COL1 DATE_CREATED CREATED_BY
1 27-SEP-2011 GURU
1 28-SEP-2011 SANKAR

Target Table:TGT

COl1 DATE_CREATED CREATED_BY
1 28-SEP-2011 SANKAR

I need to take the MAX of date_created record and store it in target.

I tried,

select max(date_created), col1, created_by from src
group by col1, created_by,date_created

Which is giving me 2 records which i don't want. How to get only one record out of that source table?

View 2 Replies View Related

SQL & PL/SQL :: Counting Records Within A Date Range?

Nov 1, 2011

I am trying to write part of an SQL where it gives me a count of bookings in any 6 month period made from the first booking.Example of records

enquirynumberenquiryaddresssubjectcodebookingdate
613651 Burberry AvenueBCHR20/10/2008 07:00:00
613801 Burberry AvenueBCHR20/11/2008 07:00:00693021 Barberry AvenueBCHR07/09/2009 07:00:00

I am so far getting 3 as a count result based on SQL below. I want the count to return 2 (because its inside the 6 month range):

SELECT
ce1.enquirynumber,
ce1.enquiryaddress,
es1.subjectcode,
b1.bookingdate,
(SELECT count(b2.bookingdate)
[code]....

View 2 Replies View Related

SQL & PL/SQL :: Select Records Where Date Is Max From Tables

Oct 6, 2011

I've got 3 tables and I need to select records where date is max from these tables.

select * from the_table_1
----------------------------------
contract_key date_1 saldo
1234 30.9.2011 12:06:50 14,6638

select * from the_table_2
----------------------------------
contract_key date_1 saldo
1234 26.9.2011 11:04:02 5,6638

select * from the_table_2
----------------------------------
contract_key date_1 saldo
1234 29.9.2011 17:39:43 2,5438

how to do that ?

View 11 Replies View Related

SQL & PL/SQL :: Select Statement To View Transaction Log For Specific Date?

Jul 24, 2011

I'm using Oracle 9i Enterprise edition, Is there a select statement to view transaction log for specific date?

View 1 Replies View Related

PL/SQL :: Create Reporting View Based On Date Column

Jul 30, 2012

My DBA gave me a table with only one date column say Table1.Date. Its in the format of Date and say it is = 7/23/2012.

Now i have to create my own Reporting View(which is used for reporting) based on that date column like below:

It should be a column with values in the following format =
2012-07
2012-06
2012-05 etc....upto
2010-01

So i started out my creating like this:

select
to_char(Table1.Date,'yyyy-mm')
from Table1
Union

[Code]....

.and so on till i get 2010-01.

there has to be a better way to do this.

View 7 Replies View Related

ORA-01476 Divisor Equal To 0

Oct 29, 2011

I am working on an application that allows a user to create a KPI formula, and the app dynamically creates a view for this formula. However as we started using it we have found that we are encountering the ORA-10476 (divisor is equal to zero) often. I have read about options of using decode or case to prevent this but it doesn't cover all our options. As a result of the fact that the user can create any equation he wants , and it can be as complicated as they want ( 2 examples:

A/(B/C-D/E) - If C or E or (B/C-D/E) are 0 the whole select will fall
A/(B-C/(D-F)) - if (D-F) or ((B-C/(D-F)) is 0 then again the select will fall.

I have seen that in MS SQL they have an option of arithabort which allows the database to return the rows that don't fall under the "divisor by 0".

either by setting something similar to arithabort, or maybe a procedure to check an equation and return the arithmetical steps in order that athey are performed?

View 2 Replies View Related

SQL & PL/SQL :: Divisor Is Equal To Zero Error?

May 26, 2010

The below code gives me error (ORA-01476: divisor is equal to zero)

SELECT
((COUNT(DECODE(SUBSTR(A.ASSETNUM,6,3),'ACS','ACS',0,null))/COUNT(DECODE(SUBSTR(A.PMNUM,1,3),'ACS','ACS',0,null)))*100)
FROM WORKORDER A
WHERE TO_CHAR(A.REPORTDATE,'MON-YYYY') = :WO_DATE;

View 8 Replies View Related

PL/SQL :: GROUP By Equal Values

Oct 30, 2012

I have data

Type, Month, Amount
=========
4, 1, 43333.33333
4, 2, 43333.33333
4, 3, 43333.33333
8, 5, 16000
8, 6, 16000
8, 7, 16000
8, 8, 16000
4, 2, 100
4, 3, 100and

I want to group and SUM() equal amounts and find MIN(month) and MAX(month), so the output should look like

Type, MIN(month), MAX(month), SUM(amount)
=========
4, 1, 3, 130000
8, 5, 8, 64000
4, 2, 3, 200

View 2 Replies View Related

SQL & PL/SQL :: Max Date Using Selected Columns - Millions Of Records

Dec 16, 2011

I am having a requirement like below,

Scene 1:

If duplicate records found for SSN,BWE with SAME DATE_CREATED than take the record with HIGHEST DATE_MODIFIED.

Table Structure:
SSN BWE DATE_CREATE DATE_MODIFIED
123 01-JAN-2008 02-JAN-2009 03-JAN-2014
123 01-JAN-2008 02-JAN-2009 03-JAN-2013

Output needed:

SSN BWE DATE_CREATE DATE_MODIFIED
123 01-JAN-2008 02-JAN-2009 03-JAN-2014

Scene 2:

If duplicate records found for SSN,BWE with different DATE_CREATED than take the record with HIGHEST DATE_CREATED.

Table Structure:

SSN BWE DATE_CREATE DATE_MODIFIED
123 01-JAN-2008 02-JAN-2009 03-JAN-2014
123 01-JAN-2008 04-JAN-2009 03-JAN-2013

Output needed:

SSN BWE DATE_CREATE DATE_MODIFIED
123 01-JAN-2008 04-JAN-2009 03-JAN-2013

How to achieve this requirement. My source data has 25 million of records like this.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved