oracle11g

Materialized view fast refresh with HAVING clause?

Deadly 提交于 2019-12-04 06:17:34
On Oracle 11g I'm trying to create a materialized view with FAST REFRESH ON COMMIT that contains a HAVING clause. The Database Data Warehousing Guide says: General Restrictions on Fast Refresh The defining query of the materialized view is restricted as follows: It cannot contain a HAVING clause with a subquery. But if I add HAVING count(*)>1 (note: no subquery) to an otherwise working materialized view, I get this error: ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view dbms_mview.explain_mview() says: REFRESH_FAST N REFRESH_FAST_AFTER_INSERT N 2011 a HAVING

homework - trying to calculate multiple flight stops between two cities?

喜夏-厌秋 提交于 2019-12-04 06:03:16
问题 This is for a database class, using Oracle DB 11g Tables: • Flight (flt_no, from_city, to_city, flt_distance, flt_departs, flt_arrives, flt_price) • Aircraft (craft_id, craft_name, cruising_range) • Employee (emp_id, emp_name, emp_salary) • Certified (emp_id, craft_id) QUERY: A customer wants to travel from Madison to New York with no more than two changes of flight. List the choice of departures from Madison if the customer wants to arrive at New York by 6pm. ANY Help is appreciate for this.

query to ignore duplicate/null records

▼魔方 西西 提交于 2019-12-04 05:58:51
问题 Below are the 3 tables which we need to join to get the data TableA TableB TableC AId BId Name CId DeclareDate value 1 1 abc 1 September 11 2 2 def 1 October 12 3 3 xyz 1 November 13 4 4 pqr 1 December 14 5 5 ghi 2 September 15 3 October 16 4 August 17 5 October 18 5 December 19 From TableC we have same fund with CId 1 is declaring in all the 4 months, in that case I need only the december row and if the fund is not declaring in december then I need to get the null valure for that C id. So

Error: PLS-00435: DML statement without BULK In-BIND cannot be used inside FORALL

旧城冷巷雨未停 提交于 2019-12-04 05:48:56
问题 I am getting the below error message. Can you please help me to sort out this problem. "Error: PLS-00435: DML statement without BULK In-BIND cannot be used inside FORALL" This is my coding. create or replace procedure inst4 is var1 varchar2(20); type nest is table of coll%rowtype; emp1 nest; cursor emp2 is select * from coll; ex_dml_errors exception; l_error_count NUMBER; PRAGMA EXCEPTION_INIT(ex_dml_errors, -24381); begin select * BULK COLLECT into emp1 from coll; FORALL i in emp1.FIRST.

Oracle - Function not working

社会主义新天地 提交于 2019-12-04 05:42:29
问题 Oracle - Function not working So I got no idea what i'm doing wrong. I've been at it for hours and i'd really appreciate some help. So basically I have 2 tables, one is called student and it's a list of students with student_no being the primary key, and the other table called enrol which basically has the list of programs that the student is enrolled into. So i've written a function that compares the logged in student's username, which in this case is the student_no , to the list of students

“Dynamic” partitions in oracle 11g

£可爱£侵袭症+ 提交于 2019-12-04 05:30:03
问题 I have a log table with a lot of information. I would like to partition it into two: first part is the logs from the past month, since they are commonly viewed. Second part is the logs from the rest of the year (Compressed). My problem is that all the examples of partitions where "up until 1/1/2013", "more recent than 1/1/2013" - That is with fixed dates... What I am looking for/expecting is a way to define a partition on the last month, so that when the day changes, the logs from 30 days ago

nvarchar in sql ,oracle and mysql in Hibernate annotation mapping

六眼飞鱼酱① 提交于 2019-12-04 05:22:28
问题 We are using MS-SQL ,Oracle and mysql as our database. We have used hibernate annotations to create tables, in the annotation class file we have declared column definition as @Column(name="UCAALSNO",nullable=false,columnDefinition="nvarchar(20)") and this works fine for MS-SQL. But when it comes to Oracle nvarchar throws an exception as oracle supports only nvarchar2 and Mysql only supports nchar()(max length=255) How to create annotation file to support datatype nvarchar for three databases.

Oracle LISTAGG() for querying use

99封情书 提交于 2019-12-04 05:19:46
问题 So I'm trying to make use of the LISTAGG() function to simply build a comma delimited list to use within an underlying query. The list generation works fine and I just applied an output for debug purposes where I can see my list as it should be: VALUES: 'AB','AZ','BC','CA','CT','DC','FL','FO','GA','IL','KS','MA','MB','ME','MN','MS','MT','NB','NC','NL','NOVA SCOTIA','NS','NT','NU','NY','ON','ONTARIO','OR','PE','QC','QUEBEC','QUÉBEC','SASKATCHEWAN','SK','TX','VT','WA','YT' When I try to pass

How can I calculate aggregate affected rows if there are Multiple DML query in my PLSQL block?

非 Y 不嫁゛ 提交于 2019-12-04 05:17:38
问题 I have a scenario where there may exist multiple DML statements inside my PLSQL Block, I was looking for some generic approach by using which I can calculate total no of rows affected using this block of code. Test Data and Structure for reference: create table cust_temp_a (Name varchar2(100), id varchar2(100)); insert into cust_temp_a VALUES ('Hasu','10'); insert into cust_temp_a VALUES ('Aasu','20'); insert into cust_temp_a VALUES ('Basu','30'); insert into cust_temp_a VALUES ('Casu','10');

Grouping rows considering “difference” between rows

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 05:15:53
I've got a table which contains start-times (using number in example to keep it simple), and durations of events. I would like to identify "blocks" and their start- and the end-time. Whenever the difference between the end-time (start-time + duration) of the previous row (sorted by start-time) and the start-time of the current row is >=5 , a new "block" should begin. This is my test-data, including an attempt of a graphical explanation in the comments: WITH test_data AS ( SELECT 0 s, 2 dur FROM dual UNION ALL --# ■■ SELECT 2 , 2 FROM dual UNION ALL --# ■■ SELECT 10 , 1 FROM dual UNION ALL --#