oracle10g

Oracle Script problem - create trigger not terminating

蹲街弑〆低调 提交于 2019-12-10 20:21:09
问题 I am trying to make some changes to an oracle database and have a script put together to do so. The problem is when it gets to a point in the script where I am creating a trigger it seems like the Create Trigger block does not properly terminate, when I look at the trigger afterwards it contains all of the remaining code in the script. This is what I have: CREATE OR REPLACE TRIGGER user_publish_log_trg BEFORE INSERT ON USER_PUBLISH_LOG FOR EACH ROW BEGIN SELECT user_publish_log_seq.NEXTVAL

Oracle jdbc driver: implicit statement cache or setPoolable(true)?

女生的网名这么多〃 提交于 2019-12-10 19:49:12
问题 Oracle JDBC driver 11.2.x: Should I rely on the implicit statement cache or should I invoke setPoolable(true) on each created Statement? What are the differences, advantages and disadvantages of both methods? 回答1: Statement caching improves performance by caching executable statements that are used repeatedly, such as in a loop or in a method that is called repeatedly. When you enable implicit Statement caching, JDBC automatically caches the prepared or callable statement when you call the

Limit SQL query to only the top two counts per group [duplicate]

可紊 提交于 2019-12-10 19:32:34
问题 This question already has answers here : Get top results for each group (in Oracle) (5 answers) Closed last year . If I have a DB table called FAVORITE_FLAVOR where each row has a user's favorite flavor of ice cream. User ID | Flavor | State 1 | Chocolate | CA 2 | Vanilla | ND 3 | Chocolate | CA 4 | Rocky Road | CA 5 | vanilla | CA 6 | Vanilla | CA 7 | Vanilla | CA Now, if I want to query the 2 most popular flavors in each state (normalizing capitalization and whitespace), I could query:

sqlplus - using a bind variable in “IN” clause

谁都会走 提交于 2019-12-10 19:05:42
问题 I am setting a bind variable in a PL/SQL block, and I'm trying to use it in another query's IN expression. Something like this: variable x varchar2(255) declare x varchar2(100); begin for r in (select id from other_table where abc in ('&val1','&val2','&val3') ) loop x := x||''''||r.id||''','; end loop; --get rid of the trailing ',' x:= substr(x,1,length(x)-1); select x into :bind_var from dual; end; / print :bind_var; select * from some_table where id in (:bind_var); And I get an error (ORA

Mapping clobs using Fluent NHibernate, Oracle 10g and OracleClientConfiguration.Oracle10

随声附和 提交于 2019-12-10 18:44:24
问题 I've been trying to map a clob field using Fluent NHibernate 1.2.0.712 against Oracle 10g. I'm using System.Data provider as it's available by default and was trying to avoid adding reference to ODP.Net due to previous client issues. However, when I try to insert entities with mapped clob properties, I get the error: ORA-01461: can bind a LONG value only for insert into a LONG column I've tried to fix this by using the below convention, and decorating the appropriate property with

Oracle SQL XML Functions - How to get encoding in XML Prolog?

╄→гoц情女王★ 提交于 2019-12-10 18:20:20
问题 This SQL SELECT XMLRoot(XMLType('<poid>143598</poid>'), VERSION '1.0', STANDALONE YES) AS xmlroot FROM DUAL; generates an output as follows XMLROOT -------------------------------------- <?xml version="1.0" standalone="yes"?> <poid>143598</poid> How can get encoding in my xml prolog? Ex - I want output to be something like XMLROOT -------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <poid>143598</poid> Reference - Generate XML Data from the database 回答1: select

Query insisting on columns in the 'Order By' clause match columns in the 'Group by' clause

做~自己de王妃 提交于 2019-12-10 18:12:16
问题 A bit of an odd one this one. I am trying to run the following query joining 3 tables. Select t3.id, t3.name, t3.phone_no, t1.reg_dtm, count(t1.reg_dtm) from tableA t1, tableB t2, tableC t3 Where t1.id = t2.id And t2.id = t3.id Group by t3.id, t3.name, t3.phone_no, t1.reg_dtm Order by t2.id, t1.reg_dtm The above query returns the following error ORA-00979: not a GROUP BY expression But if i change it so that everything in the group by clause is in the order by clause then it works. Select t3

Oracle ODP.NET problems calling package procedure with parameters

一世执手 提交于 2019-12-10 17:29:01
问题 Problem: Trying to call a packaged stored procedure, but the call is failing depending on the values of the parameters. ORA-06502: PL/SQL: numeric or value error ORA-06512: at line 1 Procedure Definition: procedure DUP_EXACT ( SSN in VARCHAR2, LASTNAME in VARCHAR2, FIRSTNAME in VARCHAR2, MASTERRECORD IN VARCHAR2 DEFAULT NULL, C_Table out sp_cursor) Parameter Creation: For Each SearchParameter In SearchParameters ValueParameter = New OracleParameter ValueParameter.Direction =

oracle : Dynamic column name [duplicate]

*爱你&永不变心* 提交于 2019-12-10 16:33:30
问题 This question already has an answer here : Closed 6 years ago . Possible Duplicate: Oracle Rows to Column Transformation My real problem is just like this but has many tables related to each other. So, I just created a example, so assuming if this gets solved, my real problem gets solved. Here are my tables : tbl_products tp_id | tp_name 1 apple 2 mango 3 pineapple tbl_sales ts_id | ts_location | ts_tp_id | ts_sales 1 NY 2 5 2 LN 2 10 3 QL 1 25 4 QL 3 20 5 LN 3 35 6 NY 3 50 7 NY 1 100 If I

how to get the root ancestors in a hierarchy query using oracle-10g?

会有一股神秘感。 提交于 2019-12-10 15:41:37
问题 the table is very simple,pid means the parent id,and cid means the child id.And there may be more than one trees in the table.So my question is: knowing several cid,how can we get the root ancestors here is an example pid cid 1 2 2 3 3 4 5 6 6 7 7 8 given cid = 4 or cid = 8,I want to get their root ancestors whose pid is 1 ro 5 finally,I'm using an oracle 10g 回答1: select t1.cid, connect_by_root(t1.pid) as root from your_table t1 left join your_table t2 on t2.cid = t1.pid where t1.cid in (4, 8