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
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.
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; /
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].........
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')
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.
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;
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
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').
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.
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.
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 )
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.
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.
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;
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?
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
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?
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;