oracle10g

Delete tables from database Oracle 10g

孤人 提交于 2019-12-22 09:40:03
问题 I have deleted some tables from an Oracle 10g database using the drop command. When I list the tables using select * from cat; I get the following : Are the tables deleted or not? Why do I have these BIN$... things? How can I remove them or the tables once and for all? Thanks! 回答1: They are entries in the Recycle Bin, created by the deletion of a table. They can be purged if required. http://docs.oracle.com/cd/B28359_01/server.111/b28310/tables011.htm 回答2: The tables prefixed with BIN$ are

user defined custom aggregate function using plsql

淺唱寂寞╮ 提交于 2019-12-22 08:58:00
问题 I have a problem.The tool i work on does not accept subqueries. So i have to write a user defined custom aggregate function that does the following. Example: col1 and col2 has numeric datatype. **col1** **col2** 243 401 57489 400 2789 401 598 400 SELECT sum(MinValue) FROM (SELECT Min(col1) AS MinValue,col2 FROM Table1 GROUP BY col2) Output:841 I want this query to work in a single step by using a single function rather than as the query shown above. Something like: SELECT MyMinSum(col1, col2)

How do I differentiate between Procedures and Functions in Oracle's Metadata?

天大地大妈咪最大 提交于 2019-12-22 08:51:38
问题 I want to list all the Stored Procedures which use overloading in a given schema. All the procedures are within packages. I can use the SQL below to nearly get there (anything with proc_count > 1). select object_name, procedure_name, count(procedure_name) as proc_count from all_procedures where owner = 'SCHEMA_NAME' group by object_name, procedure_name order by proc_count desc However there seems to be no way to differentiate between a function named 'ask_version' and a procedure named 'ask

Maximum of averages

一世执手 提交于 2019-12-22 08:37:00
问题 I'm supposed to get every departments average wage and only show the department with the highest average wage. I figured out this query, but it doesn't work. Anyone got some ideas? SELECT department, max(avg(wage)) FROM employees GROUP BY department; I get this error: ERROR at line 1: ORA-00937: not a single-group group function 回答1: Without CTEs you can do: Select Z.Department, Z.AvgWage From ( Select Department, Avg(Wage) AvgWage From Employees Group By Department ) As Z Where AvgWage = (

Oracle Hierarchical Query

蹲街弑〆低调 提交于 2019-12-22 07:58:25
问题 Using Oracle 10g. I have two tables: User Parent ------------- 1 (null) 2 1 3 1 4 3 Permission User_ID ------------------- A 1 B 3 The values in the permissions table get inherited down to the children. I would like to write a single query that could return me something like this: User Permission ------------------ 1 A 2 A 3 A 3 A 3 B 4 A 4 B Is it possible to formulate such a query using 10g connect .. by syntax to pull in rows from previous levels? 回答1: you can achieve the desired result

“loader constraints violated when linking javax/xml/namespace/QName class” from webapp on Oracle 10g

久未见 提交于 2019-12-22 06:59:11
问题 We have a web application that can be deployed on many application servers, including Oracle 10g. On that platform, however, we are having classpath issues. The webapp uses JAXB 2, but Oracle 10g ships with JAXB 1, and this was causing errors. To get around those we configured Oracle to prefer classes in our webapp, but now we are getting the above error when attempting to instantiate a JAXB context. Looking up the "loader constraints violated" exception - it seems to be thrown when a class

How do I use the BLOB data type with Hibernate?

耗尽温柔 提交于 2019-12-22 05:30:19
问题 I am retrieving a blob field containing JSON file from Oracle 10g database. I want to convert it in to a string in my DAO and give it to an incoming service request. My entity class is: @Lob @Column(name = "DTA_BLOB") private Blob DataBlob; /** * @return the DataBlob * */ public Blob getDataBlob(){ return DataBlob; } /** * @param DataBlob the DataBlob to set */ public void setDataBlob(Blob DataBlob) { this.DataBlob = DataBlob; } My DAO have the method to get the string from the blob as shown

ORACLE SQL get difference of two values retrieved from 2 select statements

眉间皱痕 提交于 2019-12-22 04:56:38
问题 We have 2 very simple SELECT statements: SELECT value from table where date between DATE1 and DATE2 SELECT value from table where date between DATE3 and DATE4 We need a way to write a single SQL statement which will get the difference of the "value" that is returned from these two SQL statements. We tried the following but it was not successful: SELECT value from table where date between DATE1 and DATE2 minus SELECT value from table where date between DATE3 and DATE4 Any suggestion is highly

Is a globally partitioned index better (faster) than a non-partitioned index?

懵懂的女人 提交于 2019-12-22 04:34:18
问题 I'm interested to find out if there is a performance benefit to partitioning a numeric column that is often the target of a query. Currently I have a materialized view that contains ~50 million records. When using a regular b-tree index and searching by this numeric column I get a cost of 7 and query results in about 0.8 seconds (with non-primed cache). After adding a global hash partition (with 64 partitions) for that column I get a cost of 6 and query results in about 0.2 seconds (again

Select string as number on Oracle

和自甴很熟 提交于 2019-12-22 04:17:08
问题 I found this odd behavior and I'm breaking my brains with this... anyone has any ideas? Oracle 10g: I have two different tables, both have this column named " TESTCOL " as Varchar2(10) , not nullable. If I perform this query on table1 , i get the proper results: select * from table1 where TESTCOL = 1234; Note that I'm specifically not placing '1234'... it's not a typo, that's a dynamic generated query and I will try not to change it (at least not in the near future). But, if I run the same