oracle11g

Materialized view fast refresh with HAVING clause?

拥有回忆 提交于 2019-12-21 14:01:31
问题 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

oracle.net.READ_TIMEOUT vs. oracle.jdbc.ReadTimeout

a 夏天 提交于 2019-12-21 12:42:50
问题 I tried setting oracle.net.READ_TIMEOUT as connection properties but it seems like it is not working, however setting oracle.jdbc.ReadTimeout works. Any idea why? I am using 11g JDBC Drivers. And the DB server version is 11g. 回答1: According to http://www.javamonamour.org/2012/09/oraclenetconnecttimeout.html oracle.net.READ_TIMEOUT for jdbc versions < 10.1.0.5 oracle.jdbc.ReadTimeout for jdbc versions >=10.1.0.5 So if you are using a JDBC driver version 10.1.0.5 or higher, then oracle.jdbc

Oracle BLOB to base64 CLOB

◇◆丶佛笑我妖孽 提交于 2019-12-21 11:36:23
问题 Can I convert an oracle BLOB to Base64 CLOB in One go? like: CREATE TABLE test ( image BLOB, imageBase64 CLOB ); INSERT INTO test(image) VALUES (LOAD_FILE('/full/path/to/new/image.jpg')); UPDATE test SET imageBase64 = UTL_ENCODE.base64_encode(image); commit; I know I can add functions/Stored proc to do the work. Performance aspect is very important,so I am asking if there is a way to overcome the 32K limitation by directly pushing the data into a CLOB. 回答1: Provided that stored procs would

Oracle BLOB to base64 CLOB

落花浮王杯 提交于 2019-12-21 11:36:04
问题 Can I convert an oracle BLOB to Base64 CLOB in One go? like: CREATE TABLE test ( image BLOB, imageBase64 CLOB ); INSERT INTO test(image) VALUES (LOAD_FILE('/full/path/to/new/image.jpg')); UPDATE test SET imageBase64 = UTL_ENCODE.base64_encode(image); commit; I know I can add functions/Stored proc to do the work. Performance aspect is very important,so I am asking if there is a way to overcome the 32K limitation by directly pushing the data into a CLOB. 回答1: Provided that stored procs would

Loop through an explicit cursor in Oracle

ぐ巨炮叔叔 提交于 2019-12-21 11:31:57
问题 How can I loop through an implicit cursor which is created, for example, from a query? Here is the sample code: SERVEROUTPUT on; DECLARE TYPE ref_cursor IS REF CURSOR; cur REF_CURSOR; BEGIN OPEN cur FOR 'SELECT i.item_no, i.item_descr FROM ITEMS i WHERE i.item_no in (1,2,3)'; ... loop statement to print all item descriptions? END; 回答1: Here's how to do it allowing for dynamic SQL. You can build the query string up in code however needed (usual warnings about SQL injection apply). DECLARE TYPE

How to find name of the stored procedure using Column name in Oracle 11g

£可爱£侵袭症+ 提交于 2019-12-21 11:31:25
问题 I have hundreds of stored procedures and i want to find out the name of the procedure which uses the particular column name in query 回答1: This will do it, but might produce false positives for generic column names SELECT DISTINCT type, name FROM dba_source WHERE owner = 'OWNER' AND text LIKE '%COLUMN_NAME%'; where OWNER is the schema which owns the stored procedures you want to search and COLUMN_NAME is the column name that you want to find. If you don't use mixed case column names then you

Loop through an explicit cursor in Oracle

断了今生、忘了曾经 提交于 2019-12-21 11:30:33
问题 How can I loop through an implicit cursor which is created, for example, from a query? Here is the sample code: SERVEROUTPUT on; DECLARE TYPE ref_cursor IS REF CURSOR; cur REF_CURSOR; BEGIN OPEN cur FOR 'SELECT i.item_no, i.item_descr FROM ITEMS i WHERE i.item_no in (1,2,3)'; ... loop statement to print all item descriptions? END; 回答1: Here's how to do it allowing for dynamic SQL. You can build the query string up in code however needed (usual warnings about SQL injection apply). DECLARE TYPE

BigDecimal precision not persisted with JPA annotations

你说的曾经没有我的故事 提交于 2019-12-21 10:34:48
问题 I am using the javax.persistence API and Hibernate to create annotations and persist entities and their attributes in an Oracle 11g Express database. I have the following attribute in an entity: @Column(precision = 12, scale = 9) private BigDecimal weightedScore; The goal is to persist a decimal value with a maximum of 12 digits and a maximum of 9 of those digits to the right of the decimal place. After calculating weightedScore , the result is 0.1234, but once I commit the entity with the

BigDecimal precision not persisted with JPA annotations

时间秒杀一切 提交于 2019-12-21 10:34:42
问题 I am using the javax.persistence API and Hibernate to create annotations and persist entities and their attributes in an Oracle 11g Express database. I have the following attribute in an entity: @Column(precision = 12, scale = 9) private BigDecimal weightedScore; The goal is to persist a decimal value with a maximum of 12 digits and a maximum of 9 of those digits to the right of the decimal place. After calculating weightedScore , the result is 0.1234, but once I commit the entity with the

How to reduce code duplication caused by substring and instring?

假如想象 提交于 2019-12-21 06:55:35
问题 I need to parse a text field (Description), delimited by '\n', into three separate fields. I am doing this by utilizing substr and instr , but it results in difficult to read and repetitive sql. Is there a way to create and use a variable or expression to hold the "position" value returned by the instring function so I can pass that variable to substr instead? My code posted below functions and returns the correct results, but it doesn't feel right. There's a lot of duplication. Relevant Raw