oracle12c

Hibernate : How to prevent SQL injection when the collection elements needs to check with `like` operator?

ぃ、小莉子 提交于 2019-12-24 03:12:29
问题 I am having a query something like this. StringBuilder sbQry = new StringBuilder(); sbQry.append("select * from tableName where 1=1"); if(!myCollection.isEmpty()){ sbQry.append(" and ("); for (int i = 0; i < myCollection.size(); i++) { final String module = myCollection.get(i); sbQry.append("column = '" + module + "' or column like 'J_'||'" + module.replaceAll("-", "%") + "'"); if (!(i == (myCollection.size() - 1))) { sbQry.append(" or "); } } sbQry.append(") "); } Here this query sbQry is

Modify XML node value- UpdateXML equivalent for Oracle 12c

China☆狼群 提交于 2019-12-23 18:36:13
问题 I have some sample code as follows: WITH xtbl AS (SELECT 1 AS xtbl_id, xmltype ('<node_root> <node_1>12</node_1> <node_2>233</node_2> <node_3>223</node_3> <node_4>234</node_4> </node_root>') AS x FROM Dual UNION ALL SELECT 2, xmltype ('<node_root> <node_1></node_1> <node_2>233</node_2> <node_3>223</node_3> <node_4>234</node_4> </node_root>') FROM Dual) SELECT xtbl_id, x, Updatexml (x, '/node_root/node_2', NULL, '/node_root/node_3', NULL, '/node_root/node_4', NULL) AS xcol FROM xtbl WHERE

Oracle: Fastest way to compare tables containing CLOB and get diff

徘徊边缘 提交于 2019-12-23 18:20:05
问题 Suppose I have two tables with columns, Col1, Col2 and Col3 which are VARCHAR2, CLOB and NUMBER types respectively. How can I get the diff of these tables? (i.e The list of records that exist in the Table B , but not in the Table A ) Table A: ╔═══════╦═════════════════╦══════╗ ║ Col1 ║ Col2 ║ Col3 ║ ╠═══════╬═════════════════╬══════╣ ║ P1111 ║ some_long_text1 ║ 1234 ║ ║ P1111 ║ some_long_text1 ║ 1233 ║ ║ P1111 ║ some_long_text2 ║ 1233 ║ ╚═══════╩═════════════════╩══════╝ Table B: ╔═══════╦═══

Are the latest Oracle 12c Release 2 JDBC driver and UCP available via maven?

懵懂的女人 提交于 2019-12-23 17:17:56
问题 Oracle corporation released a new version 12.2.0.1 of their JDBC driver, for Oracle Database 12c Release 2. The JAR files can be manually downloaded from this location: http://www.oracle.com/technetwork/database/features/jdbc/jdbc-ucp-122-3110062.html But are these JAR files available through the Oracle Maven repository at maven.oracle.com? I setup my build originally following this Oracle Blog: Get Oracle JDBC drivers and UCP from Oracle Maven Repository (without IDEs) and have the ojdbc7

Hibernate3 with Oracle 12c

*爱你&永不变心* 提交于 2019-12-23 10:57:47
问题 We are upgrading oracle from 11g to 12c. My application is using hibernate3.jar which is 3.6.8-Final version. It works great with 11g using Oracle10gDialect but when I connect to 12c database I get below error. I also changed classes12.jar to ojdbc7.jar. Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to determine Dialect to use [name=Oracle, majorVersion=12]; user must register resolver or explicitly set 'hibernate.dialect' I tried downgrading

How to use temporal validity in Oracle 12c?

心已入冬 提交于 2019-12-23 09:33:29
问题 How to design a table in Oracle 11g so that it is compatible later on with the new "Temporal validity" feature in Oracle 12c? The online documentation of Oracle 12c specifies how to define temporal validity inthe SQL Language guide (http://docs.oracle.com/cd/E16655_01/server.121/e17209/statements_7002.htm#CJADHJHB) ALTER TABLE my_table ADD (PERIOD FOR my_valid_time (my_valid_start, my_valid_end) ); So one could use the good old valid_from and valid_till columns already in 11g and beef them up

Inserting a child node in an XMLTYPE column

坚强是说给别人听的谎言 提交于 2019-12-23 07:39:11
问题 I have a simple query: WITH xtbl AS ( SELECT XMLTYPE ('<a><b>1</b></a>') AS xcol FROM DUAL ) SELECT XMLQUERY ('copy $tmp := . modify insert node <c>2</c> into $tmp/a/b return $tmp' PASSING xcol RETURNING CONTENT) AS newxcol FROM xtbl; What I'm trying to do is to insert a node <c> after <b> inside the node <a> but Oracle 12c is throwing this error: ORA-19114: XPST0003 - error during parsing the XQuery expression: LPX-00801: XQuery syntax error at 'EOF' 5 - - ^ I want the output as: NEWXCOL ---

Managed Oracle Client with Oracle Advanced Security Options

南笙酒味 提交于 2019-12-23 02:17:18
问题 On October 14th, Oracle release the latest version of their Oracle Managed Client which was described to support Network Data Encryption. http://www.oracle.com/technetwork/topics/dotnet/tech-info/odac12cr4ds-2704217.pdf https://www.nuget.org/packages/Oracle.ManagedDataAccess/ Although for some reason after trying multiple configuration, we still weren't able to get it to work. We keep getting the infamous ORA-12570: Network Session: Unexpected packet read error exception wrapped in The

Oracle Query to rollup QTY by Year- only last 3 years

喜你入骨 提交于 2019-12-22 16:52:29
问题 I have a requirement to find out MAX VALUE from SUM of Quantities Divided by YEAR (Need to write a Oracle Query). For Example ITEM_ID ORG_ID YEAR QTY 100 121 2015 10 100 121 2016 5 100 121 2017 8 101 146 2014 10 101 146 2015 11 101 146 2016 12 101 146 2017 13 My Output should be like this :- for Item_id 100,121 the max_avg should be max(10+5+8/3, 5+10/2, 10/1)... max (7.6, 7.5, 8) = 8 for Item_id 101,146 the max_avg should be (11+12+13/3, 12+13/2, 13/1)... max(11.5, 12, 12.5, 13) = 13... I

Select where number range does not overlap

我与影子孤独终老i 提交于 2019-12-22 08:19:08
问题 I have two tables that contain records about road construction activites: table_a is the master list. table_b is a legacy list. For each road, in each year, I want to select the records from table_b that do not already exist in table_a . Also, the records should not overlap spatially along the road. More specifically, the from_m and to_m of the records in table_b should not overlap the from_m and to_m in table_a . How can I do this? I do not have Oracle Spatial. The data in Excel (for easy