oracle12c

oracle - same query but different plan in 11g and 12c

人盡茶涼 提交于 2019-12-13 06:48:49
问题 This Question is relative to this question. This is code i try to use in 12c SELECT * FROM DMProgDate_00001 WHERE 1=1 AND ProgressOID IN ( SELECT P.OID FROM ( SELECT OID FROM ( SELECT A.OID, ROWNUM as seqNum FROM ( SELECT OID FROM DMProgress_00001 WHERE 1=1 AND Project = 'Moho' AND Phase = 'Procurement' AND Displine = 'Q340' ORDER BY actCode ) A WHERE ROWNUM <= 20 ) WHERE seqNum > 0 ) P ); result 11g : under 1 sec 12c : over 8 sec This is the query plan in 11g This is the query plan in 12c

Oracle: is it possible to create a copy of a IOT using CTAS without specifying columns?

别来无恙 提交于 2019-12-13 04:17:51
问题 I make use of the CTAS (Create Table As Select) syntax to create a copy of a table, in this way: CREATE TABLE TABLE2 AS SELECT * FROM TABLE1; So TABLE2 is a full copy of TABLE1, with all its columns. I would like to make the same thing with the IOT tables. But if I try to execute the following: CREATE TABLE IOT_TABLE2 ORGANIZATION INDEX AS SELECT * FROM IOT_TABLE1; I obtain: ORA-25175: no PRIMARY KEY constraint found There is some trick to do that, or is simply impossible to create a copy

SELECT: Group by function result

让人想犯罪 __ 提交于 2019-12-13 04:05:36
问题 I have a stored function that calculates the status of an entity (this status is NOT an attribute of the entity but needs to be calculated). Within a SELECT statement, I want to know how many elements have which status. For now, I got the following: SELECT my_function(entity_id) AS status, COUNT(*) FROM some_table GROUP BY my_function(entity_id) -- entity_id is a column of some_table ORDER BY status; This works but I find it quite ugly to repeat the function call within the GROUP BY statement

How to insert into temp table when looping through a string - Oracle - PL/SQL

亡梦爱人 提交于 2019-12-13 00:03:35
问题 CREATE GLOBAL TEMPORARY TABLE tt_temptable( RowNums NUMBER(3,0), procNums NUMBER(18,0) ) ON COMMIT PRESERVE ROWS; inputString VARCHAR2 ; inputString := '12,13,14,15' SELECT REGEXP_SUBSTR (inputString,'[^,]+',1,LEVEL) ProcNums FROM dual CONNECT BY REGEXP_SUBSTR (inputString,'[^,]+',1,LEVEL) IS NOT NULL; INSERT INTO tt_temptable( SELECT identity(3) RowNums,procNums FROM ); Want to insert 12 , 13, 14 , 15 and identity of 3 length in the temptable so total 4 rows in temptable 回答1: If you use

Oracle How to grant CREATE ANY DIRECTORY with the restriction that all directories must be created inside a given directory?

核能气质少年 提交于 2019-12-12 21:36:12
问题 I want to grant the CREATE ANY DIRECTORY permission to a user, with the following restriction: all directories created by this user must be inside of /foo/bar , and any attempt to create a directory outside of this should fail with a permission error. How may I do this on Oracle 11G or 12C? 回答1: That depends, if you want to restrict which OS directories Oracle can access from utl_file commands, you can set the utl_file_dir parameter. Unfortunately, this parameter is system wide, so you won't

ORA-04061: existing state of package body “PACKAGE.NAME” has been invalidated persists

女生的网名这么多〃 提交于 2019-12-12 15:52:00
问题 On one of Oracle DB instances I am working on I am observing a different than normal behavior when recompiling packages. Typically, (as in question Frequent error in Oracle ORA-04068: existing state of packages has been discarded) following error on first call is expected after PL/SQL package recompilation: ERROR at line 1: ORA-04068: existing state of packages has been discarded ORA-04061: existing state of package body "PACKAGE.NAME" has been invalidated ORA-06508: PL/SQL: could not find

java.sql.SQLException: ORA-06550: line 1, column 13: After granting user permission to EXECUTE package

主宰稳场 提交于 2019-12-12 13:14:08
问题 I've spent months developing a JAVA application with a Oracle db back-end. I am using Netbeans as my IDE and Oracle 12c on a laptop as my database. All PL/SQL has been compiled with no errors. After extensive testing (logged in as the schema owner), I attempted to add a user. I created the user, logged in as SYS_DBA, using CREATE USER E566299 IDENTIFIED BY tempPswrd , then granted permission using GRANT CREATE SESSION and GRANT EXECUTE ON C##FAI_CODE.FAI_ADMIN_PKG TO E566299 and received

Selecting Oracle object with collection of objects without bulk collect

我的梦境 提交于 2019-12-12 12:57:15
问题 Is there a way to select/fill an Oracle Collection (" IS TABLE OF ") in a normal select from jdbc i.e. no procedure with declared variable for bulk collect or anonymous block in Oracle12c ? The problems is selecting objects with collection of objects since I can't find a way to fill the collection and therefore it puts every object in a separate collection instead of collecting them in one (i.e., "a single-row query returned more than one row"). Long Story: Most of out services/apis have

Alternate of sys_refcursor

心不动则不痛 提交于 2019-12-12 06:56:11
问题 What is the alternate of sys_refcursor. After 12c upgrade, the resultset of sys_refcursor is unrecognizable by mulesoft/tibco . Reading it as null 回答1: Use TYPE cursor_type IS REF CURSOR; or a strongly typed cursor: CREATE PACKAGE SCHEMA_NAME.PACKAGE_NAME AS TYPE Table_Name_Cursor IS REF CURSOR RETURN SCHEMA_NAME.TABLE_NAME%ROWTYPE; -- You said this does not work. -- PROCEDURE get_Weakly_Typed_Cursor ( -- out_cursor OUT SYS_REFCURSOR -- ); PROCEDURE get_Strongly_Typed_Cursor ( out_cursor OUT

Error when run Oracle database sample schema script

大城市里の小女人 提交于 2019-12-12 05:59:48
问题 (I asked this question: SP2-0606: Cannot create SPOOL file , but I still stucked.) I am using Oracle 12c Release 2 on Windows 10 pro x64. Oracle installed at folder E:\app\summer\ . This is my tnsnames.ora # tnsnames.ora Network Configuration File: E:\app\summer\product\12.1.0\dbhome_1\network\admin\tnsnames.ora # Generated by Oracle configuration tools. ORACLR_CONNECTION_DATA = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) (CONNECT_DATA = (SID = CLRExtProc)