oracle11g

How do I create an Oracle table with nested tables of object types?

旧街凉风 提交于 2019-12-19 04:23:28
问题 I have a highly nested OBJECT TYPE structure that allows me to hold data in a tree-like manner. I'd now like to create a table to cache these objects, but I'm having difficulty getting the table to create. I suspect my problem is the multiple nesting levels, but not sure how to fix. CREATE TYPE STEP_OBJ AS OBJECT ( ID VARCHAR2(20), OTHER_FIELDS VARCHAR2(100)); / CREATE TYPE STEP_TAB_OBJ AS TABLE OF STEP_OBJ; / CREATE TYPE TREE_OBJ AS OBJECT ( STEPS STEP_TAB_OBJ, COMPLETE VARCHAR2(1)); /

sqlplus error on select from external table: ORA-29913: error in executing ODCIEXTTABLEOPEN callout

心已入冬 提交于 2019-12-19 02:32:18
问题 I have setup a simple Oracle external table test that I (alongside a DBA and Unix admin) can't get to work. The following is based on Oracle's External Tables Concepts. The database we're using is 11g. This is the external table definition: drop table emp_load; CREATE TABLE emp_load (employee_number CHAR(5), employee_dob DATE, employee_last_name CHAR(20), employee_first_name CHAR(15), employee_middle_name CHAR(15), employee_hire_date DATE) ORGANIZATION EXTERNAL (TYPE ORACLE_LOADER DEFAULT

Oracle: Create a View with Auto Increment id column

泪湿孤枕 提交于 2019-12-18 22:38:09
问题 I have created a view that fills data from different tables. I used 10 select statements and combine the results of those select statements using UNION ALL . I want to add primary key column to my view. because I have to create XML file using data in this view . so I need a primary key column for some process in my XML building application. I have add rownum to all my select statements. But it returned duplicate ids. because rownum in each select statements start from 1. Then I have created a

update x set y = null takes a long time

China☆狼群 提交于 2019-12-18 18:54:01
问题 At work, I have a large table (some 3 million rows, like 40-50 columns). I sometimes need to empty some of the columns and fill them with new data. What I did not expect is that UPDATE table1 SET y = null takes much more time than filling the column with data which is generated, for example, in the sql query from other columns of the same table or queried from other tables in a subquery. It does not matter if I go through all table rows at once (like in the update query above) or if I use a

Why do I get an open transaction when just selecting from a database View?

霸气de小男生 提交于 2019-12-18 15:56:12
问题 If I execute a simple select statement in pl/sql developer against a database table, I get a standard set of results back as I would expect. Recently, I pasted a query from a stored procedure that happened to select from a view, and noticed that a transaction was seemingly left open. This was appraent by the rollback and commit options were available in PL/SQL developer. A poll of other developers revealed that this seems to affect some but not others, which lead me to suspect PL/SQL

Slow performance for deeply nested subquery factoring (CTE)

大兔子大兔子 提交于 2019-12-18 15:54:11
问题 This query consists of 16 equal steps. Every step is doing the same calculation on the same dataset (a single row), but last steps take too much time for it. with t0 as (select 0 as k from dual) ,t1 as (select k from t0 where k >= (select avg(k) from t0)) ,t2 as (select k from t1 where k >= (select avg(k) from t1)) ,t3 as (select k from t2 where k >= (select avg(k) from t2)) ,t4 as (select k from t3 where k >= (select avg(k) from t3)) ,t5 as (select k from t4 where k >= (select avg(k) from t4

Oracle SID and Service name; connection problems

戏子无情 提交于 2019-12-18 13:39:13
问题 I'm trying to connect to oracle db on remote server through sql developer. I copied the connection details to tnsnames and I'm able to connect to the db. However i have another db application which is same as sqldeveloper and when I try to make a connection, I keep getting this error. This application uses oracle jdbc thin client which requires hostname and SID. I got the below error: java.sql.SQLException: Listener refused the connection with the following error: ORA-12505, TNS:listener does

Forgot Oracle username and password, how to retrieve?

蓝咒 提交于 2019-12-18 13:28:29
问题 I have forgotten my Oracle username and password and hence not able to use it. My Oracle version is 11.2.0.1.0(11g). I consulted Internet. They asked me to execute commands like ‘SYSDBA’ but I was unable to do it as once I give ‘SYSDBA’ on Command Prompt screen, it takes the command as the username and next asks for password. I cannot execute any commands suggested by them as whatever I enter is taken as the username, subsequently password is asked and error occurs. 回答1: Open your SQL command

listunagg function?

纵然是瞬间 提交于 2019-12-18 13:26:14
问题 is there such thing in oracle like listunagg function? For example, if I have a data like: ------------------------------------------------------------ | user_id | degree_fi | degree_en | degree_sv | -------------------------------------------------------------- | 3601464 | 3700 | 1600 | 2200 | | 1020 | 100 | 0 | 0 | | 3600520 | 100,3200,400 | 1300, 800, 3000 | 1400, 600, 1500 | | 3600882 | 0 | 100 | 200 | -------------------------------------------------------------- and I'd like to show

Oracle 11g - How to optimize slow parallel insert select?

独自空忆成欢 提交于 2019-12-18 13:25:27
问题 we want to speed up the run of the parallel insert statement below. We are expecting to insert around 80M records and it is taking around 2 hours to finish. INSERT /*+ PARALLEL(STAGING_EX,16) APPEND NOLOGGING */ INTO STAGING_EX (ID, TRAN_DT, RECON_DT_START, RECON_DT_END, RECON_CONFIG_ID, RECON_PM_ID) SELECT /*+PARALLEL(PM,16) */ SEQ_RESULT_ID.nextval, sysdate, sysdate, sysdate, '8a038312403e859201405245eed00c42', T1.ID FROM PM T1 WHERE STATUS = 1 and not exists(select 1 from RESULT where T1